@samitouri / QOSami-HFS / commits / ab56c3d2

dx: fix flaky test

Massimo Melina committed Mar 3, 2026 at 10:20 UTC ab56c3d2bbbe5e1de093b836e665477e277f6c14
1 file changed +7 -4
e2e/frontend.spec.ts
+7 -4
@@ -417,10 +417,12 @@ async function screenshot(page: Page, selectorForMask = '') {
417
418 test('anew', async ({ page, browserName }) => {
419 if (page.viewportSize()?.width! < 1000 || browserName !== 'chromium') return // test only for desktop chromium
420 - await wait(500)
421 - fs.writeFileSync('tests/work2/config.yaml', "port: 8082\nopen_browser_at_start: false\n")
422 - await wait(2000)
423 - await page.goto('http://localhost:8082/')
420 + // reset config so each run starts from the same default workspace state
421 + const port = 8082
422 + while (await page.goto(`http://localhost:${port}/`).then(() => 0, () => 1)) {
423 + fs.writeFileSync('tests/work2/config.yaml', `port: ${port}\nopen_browser_at_start: false\n`)
424 + await wait(100)
425 + }
426 await expect(page.getByText('Nothing here')).toBeVisible()
427 await page.getByRole('button', { name: 'Options' }).click()
428 const page1Promise = page.waitForEvent('popup')
@@ -430,6 +432,7 @@ test('anew', async ({ page, browserName }) => {
432 const addBtn = adminPage.getByRole('button').nth(1)
433 await addBtn.click()
434 await adminPage.getByRole('menuitem', { name: 'from disk' }).click()
435 + await expect(adminPage.getByText('data.kv')).toBeVisible()
436 await adminPage.getByRole('textbox', { name: /Filter results/ }).fill('data')
437 await expect(adminPage.getByText('Filter results (1/')).toBeVisible()
438 await adminPage.getByRole('checkbox').first().check()