@samitouri / QOSami-HFS / commits / 52b4f5e5

dx: solved flaky test

Massimo Melina committed Apr 25, 2026 at 18:36 UTC 52b4f5e56eaeaa0712031a66c6355e6d864e3bef
2 files changed +14 -2
e2e/frontend.spec.ts
+11
@@ -271,6 +271,17 @@ test('admin1', async ({ page }) => {
271 await screenshot(page, '.MuiDataGrid-root')
272 await clickAdminMenu(page, 'Plugins')
273 await expect(page.getByText('antibrute')).toBeVisible() // wait for data
274 + // ensure Test plugin is running
275 + const stopTest = page.getByRole('button', { name: 'Stop test' })
276 + if (!await stopTest.isVisible()) {
277 + await page.getByRole('button', { name: 'Start test' }).click()
278 + await expect(stopTest).toBeVisible()
279 + }
280 + // reload the list from the server so the plugin screenshot doesn't depend on SSE timing
281 + await page.reload()
282 + await expect(page.getByRole('heading', { name: 'Plugins', exact: true })).toBeVisible()
283 + await expect(page.getByRole('button', { name: 'Stop test' })).toBeVisible()
284 +
285 await screenshot(page)
286 await page.getByRole('tab', { name: 'Get more' }).click()
287 await page.getByRole('tab', { name: 'updates' }).click()
e2e/serial.spec.ts
+3 -2
@@ -86,7 +86,7 @@ const NETWORK_PRESETS = {
86 } as const
87
88 // some interactions, no screenshots
89 -test('admin2', async ({ page }) => {
89 +test('admin2', async ({ page, browserName }) => {
90 const isPhone = await loginAdmin(page)
91
92 await clickAdminMenu(page, 'Accounts')
@@ -162,7 +162,8 @@ test('admin2', async ({ page }) => {
162 await expect(page.getByText('antibrute')).toBeVisible()
163 const pluginTabs = page.getByRole('tab')
164 await pluginTabs.nth(0).click()
165 - if (!isPhone) {
165 + // plugin state is shared by all browser projects, so mutate it from one project to avoid cross-browser races
166 + if (!isPhone && browserName === 'chromium') {
167 const downloadCounterRow = page.getByRole('row', { name: /download-counter/ })
168 const startDownloadCounter = downloadCounterRow.getByRole('button', { name: 'Start download-counter' })
169 const stopDownloadCounter = downloadCounterRow.getByRole('button', { name: 'Stop download-counter' })