test(playwright): add playwright report to track changes + correct playwright parameters
ci: fix actions/checkout@v6 → @v4 (v6 does not exist) GitHub started rejecting invalid action versions at parse time, causing every CI run to fail with 0s / 'workflow file issue' before any jobs could start. * test(e2e): only no retry * test(e2e): use static name in tests to facilitate screenshot comparaison * test(e2e): update linux screenshots * test(e2e): adapt test due to user-vignette generation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"pretest": "bash ../common/spawn-db.sh",
|
||||
"test": "npx playwright test --reporter=line,github --trace=on-first-retry scenarios/01-home-and-login.spec.ts scenarios/02-folder-management.spec.ts",
|
||||
"test": "FORCE_COLOR=true npx playwright test scenarios/01-home-and-login.spec.ts scenarios/02-folder-management.spec.ts",
|
||||
"posttest": "bash ../common/stop-db.sh"
|
||||
},
|
||||
"keywords": [],
|
||||
|
||||
@@ -27,9 +27,9 @@ export default defineConfig({
|
||||
testDir: './scenarios',
|
||||
fullyParallel: false,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
retries: 0,
|
||||
workers: 1,
|
||||
reporter: process.env.CI ? [['github'], ['html']] : 'html',
|
||||
reporter: process.env.CI ? [['line'], ['github'], ['html']] : [ ['list'], ['html']],
|
||||
|
||||
globalSetup: require.resolve('./global-setup'),
|
||||
globalTeardown: require.resolve('./global-teardown'),
|
||||
@@ -37,6 +37,9 @@ export default defineConfig({
|
||||
use: {
|
||||
baseURL: 'http://localhost:8087',
|
||||
trace: 'on-first-retry',
|
||||
headless: true,
|
||||
// take a screenshot on failure
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
|
||||
expect: {
|
||||
|
||||
@@ -73,7 +73,7 @@ test.describe('Folder management', () => {
|
||||
});
|
||||
|
||||
test('folder creation', async ({ page }) => {
|
||||
const name = `Test folder ${Date.now()}`;
|
||||
const name = `Test folder creation`;
|
||||
|
||||
await submitNewFolder(page, name);
|
||||
|
||||
@@ -92,7 +92,7 @@ test.describe('Folder management', () => {
|
||||
});
|
||||
|
||||
test('folder reject if already exists', async ({ page }) => {
|
||||
const name = `Test folder ${Date.now()}`;
|
||||
const name = `Test existing folder`;
|
||||
|
||||
// Prerequisite: create the folder once successfully.
|
||||
await submitNewFolder(page, name);
|
||||
@@ -122,9 +122,8 @@ test.describe('Folder management', () => {
|
||||
});
|
||||
|
||||
test('folder rename', async ({ page }) => {
|
||||
const ts = Date.now();
|
||||
const original = `Test folder ${ts}`;
|
||||
const renamed = `Renamed folder ${ts}`;
|
||||
const original = `Test folder`;
|
||||
const renamed = `Renamed folders`;
|
||||
|
||||
// Prerequisite: create the folder to rename.
|
||||
await submitNewFolder(page, original);
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 62 KiB |
@@ -7,7 +7,17 @@ export const TEST_ADMIN = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Log in as the test admin and wait until the main app is ready.
|
||||
* Log in as the test admin and wait until the main app is fully initialized.
|
||||
*
|
||||
* We wait for two things after the login redirect:
|
||||
* 1. `#sidebar` — confirms the main HTML has loaded.
|
||||
* 2. `#user-avatar-btn .user-vignette` — confirms that `setupUserMenu()` has
|
||||
* run and mounted the avatar vignette. This is the earliest reliable
|
||||
* signal that the click-handler on the avatar button is attached, so any
|
||||
* subsequent test that opens the user menu will not race against JS startup.
|
||||
*
|
||||
* Without (2), CI (Ubuntu + Xvfb) occasionally clicks the button before the
|
||||
* event listener is registered because the JS runtime is slower than on macOS.
|
||||
*/
|
||||
export async function loginAsAdmin(page: Page) {
|
||||
await goToLoginPage(page);
|
||||
@@ -15,6 +25,8 @@ export async function loginAsAdmin(page: Page) {
|
||||
await page.locator('#login-password').fill(TEST_ADMIN.password);
|
||||
await page.locator('#login-panel button[type="submit"]').click();
|
||||
await expect(page.locator('#sidebar')).toBeVisible({ timeout: 15_000 });
|
||||
// Wait for the JS app to initialise: avatar vignette present ⟹ click handler attached.
|
||||
await expect(page.locator('#user-avatar-btn .user-vignette')).toBeAttached({ timeout: 10_000 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user