Skip to content

Commit b68b895

Browse files
committed
Fixes for failed tests
Avoid test hangs by making modal and network waits tolerant of intermittent UI/background activity. In ClinicianDashboardPage.closeBringDataDialog the code now waits at most 7s for the "Bring Data into Tidepool" dialog, skips clicking if it never appears, and uses a bounded wait (10s) for the dialog to hide. In WorkspacesPage the unconditional waitForLoadState('networkidle') was removed because background polling/spinners can prevent networkidle from firing; the existing visibility checks are relied on instead.
1 parent ab630fa commit b68b895

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

page-objects/clinician/ClinicianDashboardPage.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,22 @@ class ClinicianDashboardPage {
120120
}
121121

122122
/**
123-
* Closes the Bring Data into Tidepool dialog by clicking Done.
123+
* Dismiss the "Bring Data into Tidepool" dialog if it appears after adding a
124+
* patient. This modal is incidental to the add/edit/delete flow, and not every
125+
* app build shows it (or shows it on the same timing), so the wait is bounded
126+
* and best-effort: if the dialog isn't shown within a few seconds we simply
127+
* move on. The previous unbounded `waitFor({ state: 'visible' })` hung until the
128+
* whole test timed out whenever the dialog didn't appear.
124129
*/
125130
async closeBringDataDialog(): Promise<void> {
126-
await this.bringDataDialog.waitFor({ state: 'visible' });
131+
const appeared = await this.bringDataDialog
132+
.waitFor({ state: 'visible', timeout: 7000 })
133+
.then(() => true)
134+
.catch(() => false);
135+
if (!appeared) return;
136+
127137
await this.bringDataDialog_doneButton.click();
128-
await this.bringDataDialog.waitFor({ state: 'hidden' });
138+
await this.bringDataDialog.waitFor({ state: 'hidden', timeout: 10000 }).catch(() => {});
129139
}
130140

131141
/**

page-objects/clinician/WorkspacesPage.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export default class WorkspacesPage {
3939
await this.page.getByRole('button', { name: 'Go To Workspace' }).first().waitFor({
4040
state: 'visible',
4141
});
42-
await this.page.waitForLoadState('networkidle');
42+
// NB: deliberately NOT waiting for 'networkidle'. The app keeps background
43+
// activity (polling/analytics/loading spinners) that can prevent networkidle
44+
// from ever firing, which hangs this method until the test times out. The two
45+
// visibility waits above already confirm the workspaces list has rendered.
4346
}
4447

4548
async visitFirstClinic(): Promise<void> {

0 commit comments

Comments
 (0)