Skip to content

Commit fb1cb18

Browse files
committed
Fix tests and onChange event
1 parent aa00c2b commit fb1cb18

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

client/src/Components/Counter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function Counter({ label, min, max, name, onChange, value, isEditing }) {
4040
id={name}
4141
name={name}
4242
value={value}
43+
onChange={onChange}
4344
/>
4445
)}
4546
<button type="button" className="usa-button counter__button counter__button--increment" onClick={handleIncrement}>

client/src/ER/Beds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Beds({ statusUpdate, onStatusUpdate, incomingRingdownsCount }) {
1717

1818
function handleChange(event) {
1919
const newStatusUpdate = new HospitalStatus(statusUpdate);
20-
newStatusUpdate[event.target.name] = parseInt(event.target.value, 10);
20+
newStatusUpdate[event.target.name] = parseInt(event.target.value, 10) || 0;
2121
onStatusUpdate(newStatusUpdate);
2222
}
2323

e2e/tests/erStatus.spec.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test.describe('ER status', () => {
1010
await password.fill('abcd1234');
1111
await password.press('Enter');
1212
await expect(appPage).toHaveURL('/er');
13+
await appPage.reload();
1314
await appPage.getByRole('button', { name: /hospital/i }).click();
1415
await expect(appPage.getByText(/available beds/i)).toBeVisible();
1516
await expect(appPage.getByText(/er conditions/i)).toBeVisible();
@@ -23,20 +24,16 @@ test.describe('ER status', () => {
2324
test('EMS checks hospital status', async ({ context }) => {
2425
const appPage = await context.newPage();
2526
await appPage.goto('/');
26-
await appPage.getByLabel('Email').fill('[email protected]');
27+
await appPage.getByLabel('Email').fill('op.ems.1@c4sf.me');
2728
const password = appPage.getByLabel('Password');
2829
await password.fill('abcd1234');
2930
await password.press('Enter');
3031
await expect(appPage).toHaveURL('/ems');
3132
await appPage.getByRole('button', { name: /hospital info/i }).click();
32-
// await expect(appPage.locator('.hospitalstatusrow_container')
33-
// .filter({ hasText: /ucsf parnassus/i })
34-
// .filter({ has: appPage.locator('.hospitalstatusrow__notes').filter({ hasText: 'scanner fixed' })})).toBeVisible();
35-
const row = appPage.locator('.hospitalstatusrow_container').filter({ hasText: /ucsf parnassus/i });
36-
37-
// await expect(row.locator('.hospitalstatusrow__data', { hasText: '5' })).toBeVisible();
38-
// await expect(row.locator('.hospitalstatusrow__data', { hasText: '8' })).toBeVisible();
39-
await expect(row.locator('.hospitalstatusrow__notes').filter({ hasText: 'scanner broke' })).toBeVisible();
33+
const ucsfRow = appPage.locator('.hospitalstatusrow_container').filter({ hasText: /ucsf parnassus/i });
34+
await expect(ucsfRow.getByText('5')).toBeVisible();
35+
await expect(ucsfRow.getByText('8')).toBeVisible();
36+
await expect(ucsfRow.getByText('scanner broke')).toBeVisible();
4037
await context.close();
4138
});
4239

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

0 commit comments

Comments
 (0)