Skip to content

Commit

Permalink
WIP add tests for ER status update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddrosario committed Oct 5, 2023
1 parent 6e9d293 commit 0e48d58
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions e2e/tests/erStatus.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const { test, expect } = require('@playwright/test');

test.describe('ER status', () => {
test.describe.configure({ mode: 'serial' });
test('Update ER status', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
const password = appPage.getByLabel('Password');
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/er');
await appPage.getByRole('button', { name: /hospital/i }).click();
await expect(appPage.getByText(/available beds/i)).toBeVisible();
await expect(appPage.getByText(/er conditions/i)).toBeVisible();
await appPage.getByRole('button', { name: /update hospital/i }).click();
await appPage.getByRole('textbox', { name: /er beds/i }).fill('5');
await appPage.getByRole('textbox', { name: /behavioral beds/i }).fill('8');
await appPage.locator('#additionalNotes').fill('scanner broke');
await appPage.getByRole('button', { name: /confirm/i }).click();
});

test('EMS checks hospital status', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
const password = appPage.getByLabel('Password');
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/ems');
await appPage.getByRole('button', { name: /hospital info/i }).click();
// await expect(appPage.locator('.hospitalstatusrow_container')
// .filter({ hasText: /ucsf parnassus/i })
// .filter({ has: appPage.locator('.hospitalstatusrow__notes').filter({ hasText: 'scanner fixed' })})).toBeVisible();
const row = appPage.locator('.hospitalstatusrow_container').filter({ hasText: /ucsf parnassus/i });

// await expect(row.locator('.hospitalstatusrow__data', { hasText: '5' })).toBeVisible();
// await expect(row.locator('.hospitalstatusrow__data', { hasText: '8' })).toBeVisible();
await expect(row.locator('.hospitalstatusrow__notes').filter({ hasText: 'scanner broke' })).toBeVisible();
await context.close();
});

test('Update ER status reset', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
const password = appPage.getByLabel('Password');
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/er');
await appPage.getByRole('button', { name: /hospital/i }).click();
await expect(appPage.getByText(/available beds/i)).toBeVisible();
await expect(appPage.getByText(/er conditions/i)).toBeVisible();
await appPage.getByRole('button', { name: /update hospital/i }).click();
await appPage.getByRole('textbox', { name: /er beds/i }).fill('0');
await appPage.getByRole('textbox', { name: /behavioral beds/i }).fill('0');
await appPage.locator('#additionalNotes').fill('');
await appPage.getByRole('button', { name: /confirm/i }).click();
});

test('EMS checks hospital status after reset', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
const password = appPage.getByLabel('Password');
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/ems');
await appPage.getByRole('button', { name: /hospital info/i }).click();
const row = appPage.locator('.hospitalstatusrow_container', { hasText: /ucsf parnassus/i });
// console.log("ROW: ", row)
await expect(row.locator('.hospitalstatusrow__data', { hasText: '5' })).not.toBeVisible();
await expect(row.locator('.hospitalstatusrow__data', { hasText: '8' })).not.toBeVisible();
await expect(row.locator('.hospitalstatusrow__notes', { hasText: 'scanner broke' })).not.toBeVisible();
await context.close();
});
});

0 comments on commit 0e48d58

Please sign in to comment.