Skip to content

Commit 0cad511

Browse files
YourGitHubUsernameclaude
andcommitted
fix(e2e): waitForTable waits for 'N companies' count text
The previous spinner-wait approach (c7e8953) had a budget problem: 30s spinner wait + 30s selector wait could total 60s inside a 30s test timeout. Tests died in beforeEach before assertions ran. Replace with a single wait for the "N companies" count text inside [data-testid="company-table"]. This text only renders after isLoading becomes false and data is available. Single 30s budget, no multi-stage timeout stacking. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c7e8953 commit 0cad511

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

tests/e2e/pages/CompaniesPage.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,13 @@ export class CompaniesPage extends BasePage {
6464
* Wait for the companies table to load
6565
*/
6666
async waitForTable() {
67-
// Wait for the table container to appear
68-
await this.page.waitForSelector(this.selectors.table, {
69-
state: 'visible',
70-
timeout: 30000,
71-
});
72-
// CompanyTable renders the same data-testid on both the loading spinner
73-
// and the loaded table. Wait for the loading spinner inside the table to
74-
// disappear — that means the Supabase query completed and real rows are
75-
// rendered (or "No companies yet" if the user has zero companies).
67+
// CompanyTable renders [data-testid="company-table"] on both the loading
68+
// spinner and the loaded table. Wait for the "N companies" count text
69+
// which only appears after isLoading becomes false and data is rendered.
7670
await this.page
77-
.locator(`${this.selectors.table} .loading`)
78-
.first()
79-
.waitFor({ state: 'hidden', timeout: 30000 })
80-
.catch(() => {
81-
// Spinner may never appear if data loads before the selector check
82-
});
83-
await this.waitForLoad();
71+
.locator(`${this.selectors.table}`)
72+
.getByText(/\d+ compan/i)
73+
.waitFor({ state: 'visible', timeout: 30000 });
8474
}
8575

8676
/**

0 commit comments

Comments
 (0)