Skip to content

Commit

Permalink
Fix tests and onChange event
Browse files Browse the repository at this point in the history
  • Loading branch information
ddrosario committed Oct 5, 2023
1 parent aa00c2b commit fb1cb18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions client/src/Components/Counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function Counter({ label, min, max, name, onChange, value, isEditing }) {
id={name}
name={name}
value={value}
onChange={onChange}
/>
)}
<button type="button" className="usa-button counter__button counter__button--increment" onClick={handleIncrement}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/ER/Beds.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Beds({ statusUpdate, onStatusUpdate, incomingRingdownsCount }) {

function handleChange(event) {
const newStatusUpdate = new HospitalStatus(statusUpdate);
newStatusUpdate[event.target.name] = parseInt(event.target.value, 10);
newStatusUpdate[event.target.name] = parseInt(event.target.value, 10) || 0;
onStatusUpdate(newStatusUpdate);
}

Expand Down
18 changes: 8 additions & 10 deletions e2e/tests/erStatus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test.describe('ER status', () => {
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/er');
await appPage.reload();
await appPage.getByRole('button', { name: /hospital/i }).click();
await expect(appPage.getByText(/available beds/i)).toBeVisible();
await expect(appPage.getByText(/er conditions/i)).toBeVisible();
Expand All @@ -23,20 +24,16 @@ test.describe('ER status', () => {
test('EMS checks hospital status', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
await appPage.getByLabel('Email').fill('op.ems.1@c4sf.me');
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();
const ucsfRow = appPage.locator('.hospitalstatusrow_container').filter({ hasText: /ucsf parnassus/i });
await expect(ucsfRow.getByText('5')).toBeVisible();
await expect(ucsfRow.getByText('8')).toBeVisible();
await expect(ucsfRow.getByText('scanner broke')).toBeVisible();
await context.close();
});

Expand All @@ -48,6 +45,7 @@ test.describe('ER status', () => {
await password.fill('abcd1234');
await password.press('Enter');
await expect(appPage).toHaveURL('/er');
await appPage.reload();
await appPage.getByRole('button', { name: /hospital/i }).click();
await expect(appPage.getByText(/available beds/i)).toBeVisible();
await expect(appPage.getByText(/er conditions/i)).toBeVisible();
Expand All @@ -61,7 +59,7 @@ test.describe('ER status', () => {
test('EMS checks hospital status after reset', async ({ context }) => {
const appPage = await context.newPage();
await appPage.goto('/');
await appPage.getByLabel('Email').fill('[email protected]');
await appPage.getByLabel('Email').fill('op.ems.1@c4sf.me');
const password = appPage.getByLabel('Password');
await password.fill('abcd1234');
await password.press('Enter');
Expand Down

0 comments on commit fb1cb18

Please sign in to comment.