Skip to content

Commit 8c8fbb3

Browse files
committed
Fix jobs tab test: wait for active class instead of networkidle
The navigateToTab() test was hanging because waitForLoadState('networkidle') never fired after previous tests left the page in an "idle" state. Add wait for tab to have border-primary class before waiting for content visibility.
1 parent 73b4b65 commit 8c8fbb3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/web/tests/pages/jobs-tab.page.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export class JobsTabPage {
99

1010
// Tab element
1111
readonly tab: Locator;
12+
13+
// Tab content
1214
readonly content: Locator;
1315

1416
// Action buttons
@@ -26,7 +28,6 @@ export class JobsTabPage {
2628
// Tab navigation - use button role with name pattern since tabs are buttons
2729
this.tab = page.getByRole('button', { name: /^jobs/i });
2830
this.content = page.locator('main'); // Jobs content is in main
29-
3031
// Action buttons - "create job" button in main content area (not header)
3132
this.createJobButton = page.locator('main').getByRole('button', { name: /create job/i });
3233

@@ -39,8 +40,11 @@ export class JobsTabPage {
3940

4041
async navigateToTab() {
4142
await this.tab.click();
43+
// Wait for the jobs tab to become active (has border-primary class)
44+
// This is more reliable than waitForLoadState('networkidle') which may never fire
45+
await expect(this.tab).toHaveAttribute('class', /border-primary/i);
46+
// Then wait for content to load
4247
await this.page.waitForLoadState('networkidle');
43-
// Wait for the jobs view to load - either table or empty state
4448
const jobsContent = this.jobsTable.or(this.emptyState);
4549
await expect(jobsContent).toBeVisible({ timeout: 15000 });
4650
}
@@ -65,7 +69,6 @@ export class JobsTabPage {
6569
async getJobByName(name: string): Promise<Locator | null> {
6670
const rows = this.tableRows;
6771
const count = await rows.count();
68-
6972
for (let i = 0; i < count; i++) {
7073
const row = rows.nth(i);
7174
const text = await row.textContent();

0 commit comments

Comments
 (0)