@samitouri / QOSami-HFS / commits / 93bc0303

dx: steadier tests

Massimo Melina committed Jul 5, 2025 at 11:19 UTC 93bc0303ccaa268b78c0ab01026b8caad4d39d22
6 files changed +7 -7
.gitignore
+1
@@ -5,6 +5,7 @@ dist
5 .DS_Store
6 #produced by running
7 tests/work
8 +tests/config.yaml.bak
9
10 # Playwright
11 /test-results/
e2e/frontend.spec.ts
+1 -2
@@ -14,12 +14,12 @@ test('around1', async ({ page }) => {
14 await screenshot(page);
15
16 await page.getByRole('textbox', { name: 'Username' }).fill(username + '!'); // wrong username
17 - await page.getByRole('textbox', { name: 'Username' }).press('Tab');
17 await page.getByRole('textbox', { name: 'Password' }).fill(password);
18 await page.getByRole('button', { name: 'Continue' }).click();
19 await expect(page.getByText('x!ErrorInvalid credentials')).toBeVisible();
20 await page.getByRole('alertdialog').getByRole('button', { name: 'Close' }).click();
21
22 + resetTimestamp();
23 await page.getByRole('textbox', { name: 'Username' }).fill(username);
24 await page.getByRole('button', { name: 'Continue' }).click();
25 await page.locator('div').filter({ hasText: 'Logged in' }).nth(3).click();
@@ -201,7 +201,6 @@ test('frontend-admin', async ({ page }) => {
201 await page.getByRole('button', { name: 'Close' }).click();
202 await page.getByRole('button', { name: 'Login' }).click();
203 await page.getByRole('textbox', { name: 'Username' }).fill(username);
204 - await page.getByRole('textbox', { name: 'Username' }).press('Tab');
204 await page.getByRole('textbox', { name: 'Password' }).fill(password);
205 await page.getByRole('textbox', { name: 'Password' }).press('Enter');
206 await page.getByRole('button', { name: 'Options' }).click();
e2e/serial.spec.ts
-1
@@ -11,7 +11,6 @@ test('upload1', async ({ page, context, browserName }) => {
11 await page.goto(URL);
12 await page.getByRole('button', { name: 'Login' }).click();
13 await page.getByRole('textbox', { name: 'Username' }).fill(username);
14 - await page.getByRole('textbox', { name: 'Username' }).press('Tab');
14 await page.getByRole('textbox', { name: 'Password' }).fill(password);
15 await page.getByRole('button', { name: 'Continue' }).click();
16 await page.locator('div').filter({ hasText: 'Logged in' }).nth(3).click();
frontend/.gitignore
+1
@@ -7,6 +7,7 @@
7
8 # testing
9 /coverage
10 +sonda-report.html
11
12 # production
13 /build
playwright.config.ts
+1 -1
@@ -17,7 +17,7 @@ export default defineConfig({
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
20 - workers: process.env.CI ? 1 : undefined, // Opt out of parallel tests on CI.
20 + //workers: process.env.CI ? 1 : undefined, // Opt out of parallel tests on CI.
21 reporter: 'html', // Reporter to use. See https://playwright.dev/docs/test-reporters
22 use: { // Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions.
23 /* Base URL to use in actions like `await page.goto('/')`. */
tests/test.ts
+3 -3
@@ -201,12 +201,12 @@ describe('after-login', () => {
201 test('upload.interrupted', async () => {
202 const fn = resolve(__dirname, UPLOAD_RELATIVE.replace('/', '/hfs$upload-'))
203 await rm(fn, {force: true})
204 - const neededTime = 300
204 + const neededTime = 600
205 const makeAbortedRequest = (afterMs: number) => {
206 const r = reqUpload(UPLOAD_DEST + '?supposedToAbort', 0, makeReadableThatTakes(neededTime))()
207 setTimeout(r.abort, afterMs)
208 return r.catch(() => {}) // wait for it to fail
209 - .then(() => wait(10)) // aborted requests don't guarantee that the server has finished and released the file, so we wait some arbitrary time
209 + .then(() => wait(500)) // aborted requests don't guarantee that the server has finished and released the file, so we wait some arbitrary time
210 }
211 const timeFirstRequest = neededTime * .5 // not enough to finish
212 await makeAbortedRequest(timeFirstRequest)
@@ -216,7 +216,7 @@ describe('after-login', () => {
216 throw Error("missing temp file")
217 await makeAbortedRequest(timeFirstRequest * .5) // upload less than r1
218 if (size !== getTempSize()) // shouldn't change, as r2 is smaller, and therefore only wrote to secondary temp file
219 - throw Error("modified temp file")
219 + throw Error(`modified temp file, it was ${size} and now it's ${getTempSize()}`)
220 await makeAbortedRequest(timeFirstRequest * 1.5) // upload more than r1
221 if (!(size < getTempSize()!)) // should be increased, as secondary temp file got bigger and replaced primary one
222 throw Error(`temp file not enlarged, it was ${size} and now it's ${getTempSize()}`)