dx: steadier test
Massimo Melina committed
Jun 6, 2025 at 09:30 UTC
564541889f4a73aee74e9825a5d777790a04d725
3 files changed
+10
-3
e2e/frontend.spec.ts
+3
-1
@@ -1,5 +1,6 @@
1
import { test, expect, Page } from '@playwright/test'
2
import fs from 'fs'
3
+import { wait } from '../src/cross'
4
5
const username = 'rejetto'
6
const password = 'password'
@@ -287,8 +288,9 @@ test('admin1', async ({ page }) => {
288
await screenshot(page);
289
});
290
290
-function screenshot(page: Page, selectorForMask='') {
291
+async function screenshot(page: Page, selectorForMask='') {
292
if (selectorForMask)
293
selectorForMask = ',' + selectorForMask
294
+ await wait(1000) // this accounts especially for our DataTable component which takes time to set the layout
295
return expect(page).toHaveScreenshot({ fullPage: true, mask: [page.locator(`.maskInTests${selectorForMask}`)] });
296
}
\ No newline at end of file
e2e/screenshot.css
+6
-1
@@ -3,4 +3,9 @@
3
main *:hover { background: none !important; }
4
5
.hideInTests, /* use for elements with variable size, where masking would produce changes anyway */
6
-.list-wrapper:not([uri="/"]) .entry-ts { display: none } /* ignore changing timestamps inside folders */
\ No newline at end of file
6
+.list-wrapper:not([uri="/"]) .entry-ts { display: none } /* ignore changing timestamps inside folders */
7
+
8
+.MuiTooltip-tooltip { /* tooltips are subjected to small displacements */
9
+ visibility: hidden !important;
10
+ pointer-events: none !important;
11
+}
\ No newline at end of file
playwright.config.ts
+1
-1
@@ -13,7 +13,7 @@ import { defineConfig, devices } from '@playwright/test';
13
*/
14
export default defineConfig({
15
testDir: './e2e',
16
- timeout: 15_000,
16
+ timeout: 20_000,
17
fullyParallel: true, // Run tests in files in parallel
18
forbidOnly: !!process.env.CI, // Fail the build on CI if you accidentally left test.only in the source code.
19
retries: process.env.CI ? 2 : 0, // Retry on CI only