Skip to content

Commit 212bd2b

Browse files
committed
test(pages): find tables on the start page through one helper
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
1 parent af47970 commit 212bd2b

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

‎playwright/e2e/context.spec.ts‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ async function expectSelectedShare(page: Page, userId: string) {
5757
}
5858

5959
/**
60-
* Waits for a table of the application on its start page, where a table or view gets a widget
61-
* also when it is added after the application was created.
60+
* Waits for a table or view of the application on its start page, where the tables widget shows
61+
* every table and view, also one added after the application was created.
6262
*/
63-
async function expectTableOnStartPage(page: Page, tableTitle: string) {
64-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible()
63+
async function expectTableOnStartPage(page: Page, tableTitle: string, timeout?: number) {
64+
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible({ timeout })
6565
}
6666

6767
test.describe('Manage a context', () => {
@@ -103,7 +103,7 @@ test.describe('Manage a context', () => {
103103
await loadContext(page, `updated ${contextTitle}`)
104104

105105
await expect(page.locator('h1', { hasText: `updated ${contextTitle}` })).toBeVisible()
106-
// Tables and views added after the application was created get a widget on its start page
106+
// Tables and views added after the application was created show up in its tables widget
107107
await expect(page.locator('[data-cy="startPageGrid"]')).toBeVisible()
108108
await expectTableOnStartPage(page, tableTitle)
109109
await expectTableOnStartPage(page, viewTitle)
@@ -131,8 +131,7 @@ test.describe('Manage a context', () => {
131131

132132
await loadContext(page, contextTitle)
133133
await expect(page.locator('h1', { hasText: contextTitle })).toBeVisible({ timeout: 10000 })
134-
await expectTableOnStartPage(page, tableTitle)
135-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible({ timeout: 10000 })
134+
await expectTableOnStartPage(page, tableTitle, 10000)
136135

137136
// verify context was shared properly
138137
await page.context().clearCookies()
@@ -141,7 +140,7 @@ test.describe('Manage a context', () => {
141140

142141
await loadContext(page, contextTitle)
143142
await expect(page.locator('h1', { hasText: contextTitle })).toBeVisible()
144-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible()
143+
await expectTableOnStartPage(page, tableTitle)
145144
})
146145

147146
test('Transfer context', async ({ userPage: { page }, request }) => {
@@ -233,7 +232,6 @@ test.describe('Manage a context', () => {
233232

234233
await expect(page.locator('h1', { hasText: contextTitle })).toBeVisible()
235234
await expectTableOnStartPage(page, tableTitle)
236-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible()
237235

238236
await openContextEditModal(page, contextTitle)
239237
await page.locator('[data-cy="contextResourceList"] button').filter({ hasText: 'Delete' }).click({ force: true })
@@ -306,8 +304,7 @@ test.describe('Manage a context', () => {
306304
await updatePermsResponse
307305

308306
await expect(page.locator('h1', { hasText: contextTitle })).toBeVisible({ timeout: 10000 })
309-
await expectTableOnStartPage(page, tableTitle)
310-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible({ timeout: 10000 })
307+
await expectTableOnStartPage(page, tableTitle, 10000)
311308

312309
// verify that shared user can modify and delete data in the resource
313310
await page.context().clearCookies()
@@ -316,7 +313,7 @@ test.describe('Manage a context', () => {
316313

317314
await loadContext(page, contextTitle)
318315
await expect(page.locator('h1', { hasText: contextTitle })).toBeVisible()
319-
await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toBeVisible()
316+
await expectTableOnStartPage(page, tableTitle)
320317

321318
await page.locator('button').filter({ hasText: 'Create row' }).first().click()
322319
await fillInValueTextLine(page, 'title', 'first row')

0 commit comments

Comments
 (0)