test: firefox

Massimo Melina committed Aug 6, 2025 at 15:50 UTC 27403db56c0b80a944528e23f49f4dee0080450e
4 files changed +9 -4
e2e/common.ts
+1 -1
@@ -3,7 +3,7 @@ import fs from 'fs'
3
4 export const username = 'rejetto'
5 export const password = 'password'
6 -export const URL = 'http://localhost:81/'
6 +export const URL = 'http://[::1]:81/'
7 export const uploadName = 'uploaded'
8
9 const t = Date.UTC(2025, 0, 20, 3, 0, 0, 0) / 1000 // a fixed timestamp, for visual comparison
e2e/frontend.spec.ts
+1 -1
@@ -76,7 +76,7 @@ test('around1', async ({ page }) => {
76 const pageListPromise = page.waitForEvent('popup');
77 await page.getByRole('link', { name: 'Get list' }).click();
78 const pageList = await pageListPromise;
79 - await expect(pageList.getByText('localhost')).toBeVisible();
79 + await expect(pageList.getByText('::1')).toBeVisible();
80 await pageList.close()
81
82 await page.getByRole('link', { name: 'home' }).click();
e2e/serial.spec.ts
+3 -2
@@ -7,7 +7,7 @@ import { clearUploads, password, uploadName, URL, username } from './common'
7 export const fileToUpload = 'dev-plugins.md'
8
9 test('upload1', async ({ page, context, browserName }) => {
10 - if (page.viewportSize()?.width! < 1000 || browserName !== 'chromium') return // test only for desktop, as safari has no cdpSession, and to disconnect i need only 1 upload at a time
10 + if (page.viewportSize()?.width! < 1000 || browserName !== 'chromium') return // test only for desktop, as only chromium has cdpSession, and to disconnect i need only 1 upload at a time
11 await page.goto(URL);
12 await page.getByRole('button', { name: 'Login' }).click();
13 await page.getByRole('textbox', { name: 'Username' }).fill(username);
@@ -30,13 +30,14 @@ test('upload1', async ({ page, context, browserName }) => {
30 await page.getByRole('button', { name: 'Pick files' }).click();
31 const fileChooser = await fileChooserPromise;
32 await fileChooser.setFiles(fileToUpload);
33 + // can't do without. I tried using route.continue, but i can't send half-body keeping the full content-length, and i also cannot pass a stream (to throttle)
34 const cdpSession = await context.newCDPSession(page)
35 await cdpSession.send('Network.emulateNetworkConditions', NETWORK_PRESETS.Regular2G)
36 await page.getByRole('button', { name: 'Edit' }).click();
37 await page.getByRole('textbox').fill(uploadName);
38 await page.getByRole('button', { name: 'Continue' }).click();
39 await page.getByRole('button', { name: 'Send 1 file' }).click();
39 - await wait(2000)
40 + await wait(1500)
41 await pageAdmin.getByRole('cell', { name: uploadName }).click();
42 await pageAdmin.getByRole('button', { name: '(Disconnect)' }).click();
43 await pageAdmin.getByRole('button', { name: '(Close)' }).click();
playwright.config.ts
+4
@@ -41,6 +41,10 @@ export default defineConfig({
41 name: 'iPhone 6',
42 use: { ...devices['iPhone 6'] },
43 },
44 + {
45 + name: 'firefox',
46 + use: { ...devices['Desktop Firefox'] },
47 + }
48 /*
49 {
50 name: 'firefox',