dx: solved flaky test
Massimo Melina committed
May 14, 2026 at 23:46 UTC
312173198fc7da245e070bbc9ef6de96aac1e2ad
3 files changed
+5
-4
e2e/common.ts
+1
-1
@@ -8,7 +8,7 @@ import { ADMIN_URI } from '../src/cross-const'
8
export const username = 'rejetto'
9
export const password = 'password'
10
// keep e2e URL aligned with the same config file used by tests/test.ts and server-for-test
11
-const TEST_PORT = Number(yaml.parse(readFileSync(resolve(process.cwd(), 'tests/config.yaml'), 'utf8')).port)
11
+export const TEST_PORT = Number(yaml.parse(readFileSync(resolve(process.cwd(), 'tests/config.yaml'), 'utf8')).port)
12
export const FRONTEND_URL = `http://[::1]:${TEST_PORT}/`
13
export const ADMIN_URL = new URL(ADMIN_URI, FRONTEND_URL).href
14
export const uploadName = 'uploaded'
e2e/dialog-back.spec.ts
+2
-1
@@ -4,7 +4,8 @@ import { clickAdminMenu, loginAdmin } from './common'
4
const pluginId = 'test'
5
6
function pluginRow(page: Page) {
7
- return page.getByRole('grid').getByRole('button', { name: /^Options$/ }).locator('xpath=ancestor::*[@role="row"][1]')
7
+ // target the fixture plugin row because other running plugins can expose their own Options button
8
+ return page.getByRole('grid').getByRole('row', { name: new RegExp(`\\b${pluginId}\\b`) })
9
}
10
11
async function ensureAuthAndGoPlugins(page: Page) {
e2e/frontend.spec.ts
+2
-2
@@ -2,7 +2,7 @@ import { test, expect, Page } from '@playwright/test'
2
import fs from 'fs'
3
import { wait } from '../src/cross'
4
import {
5
- clickAdminMenu, clickIconBtn, forwardConsole, loginAdmin, password, resetTimestamp, FRONTEND_URL, username
5
+ clickAdminMenu, clickIconBtn, forwardConsole, loginAdmin, password, resetTimestamp, FRONTEND_URL, username, TEST_PORT
6
} from './common'
7
8
const screenshotStyle = fs.readFileSync('e2e/screenshot.css', 'utf8')
@@ -293,7 +293,7 @@ test('admin1', async ({ page }) => {
293
await screenshot(page)
294
await page.getByRole('main').click()
295
await clickAdminMenu(page, 'Internet')
296
- await expect(page.getByText('Server')).toBeVisible({ timeout: 15000 }) // wait for data (get_nat can be very slow)
296
+ await expect(page.getByText(`port ${TEST_PORT}`)).toBeVisible({ timeout: 15000 }) // wait for data (get_nat can be very slow)
297
await page.mouse.click(1, 1) // avoid focus inconsistencies
298
await screenshot(page)
299
await clickAdminMenu(page, 'Logout')