test: fixed timeout on ui/admin1
Massimo Melina committed
Apr 19, 2025 at 12:07 UTC
7e550fb2e88ad181a2f6db639e68b1c0fa8ccbb2
3 files changed
+9
-6
e2e/frontend.spec.ts
+7
-4
@@ -212,6 +212,7 @@ test('admin1', async ({ page }) => {
212
await page.getByRole('button', { name: 'Close' }).click();
213
}
214
215
+ await clickMenu('Internet'); // initiate get_nat process, so we'll have to wait less later
216
await clickMenu('Shared files')
217
await expect(page.getByText('cantListBut')).toBeVisible(); // wait for data
218
await screenshot(page)
@@ -223,13 +224,11 @@ test('admin1', async ({ page }) => {
224
await closePhoneDialog();
225
await clickMenu('Options');
226
await expect(page.getByText('Correctly working on port')).toBeVisible(); // wait for data
227
+ if (!isPhone)
228
+ await expect(page.getByText('Expire', { exact: true })).toBeVisible(); // wait for layout of 'block' table
229
await page.mouse.click(1, 1); // avoid focus inconsistencies
230
await screenshot(page)
231
229
- await clickMenu('Internet');
230
- await expect(page.getByRole('button', { name: 'Verify' })).toBeVisible(); // wait for data
231
- await page.mouse.click(1, 1); // avoid focus inconsistencies
232
- await screenshot(page, '.ip,.port')
232
await clickMenu('Logs');
233
await screenshot(page, '.MuiDataGrid-virtualScrollerRenderZone');
234
await page.getByRole('tab').nth(2).click();
@@ -250,6 +249,10 @@ test('admin1', async ({ page }) => {
249
await expect(page.getByRole('combobox', { name: 'Section Style' })).toBeVisible(); // wait for data to be loaded
250
await screenshot(page);
251
await page.getByRole('main').click();
252
+ await clickMenu('Internet');
253
+ await expect(page.getByRole('button', { name: 'Verify' })).toBeVisible({ timeout: 10000 }); // wait for data (get_nat can be very slow)
254
+ await page.mouse.click(1, 1); // avoid focus inconsistencies
255
+ await screenshot(page, '.ip,.port')
256
await clickMenu('Logout');
257
await screenshot(page);
258
});
shared/api.ts
+1
-1
@@ -16,7 +16,7 @@ const timeoutByApi: Dict = {
16
}
17
18
interface ApiCallOptions {
19
- timeout?: number | false
19
+ timeout?: number | false // seconds
20
modal?: undefined | ((cmd: string, params?: Dict) => (() => unknown))
21
onResponse?: (res: Response, body: any) => any
22
method?: string
src/roots.ts
+1
-1
@@ -27,7 +27,7 @@ export const rootsMiddleware: Koa.Middleware = (ctx, next) =>
27
if (ctx.path.startsWith(SPECIAL_URI)) { // special uris should be excluded...
28
if (!ctx.path.startsWith(API_URI)) return // ...unless it's an api
29
params = ctx.state.params || ctx.query // for api we'll translate params
30
- changeUriParams(v => removeStarting(ctx.state.revProxyPath, v)) // removal must be done before adding the root
30
+ changeUriParams(v => removeStarting(ctx.state.revProxyPath, v)) // this removal must be done before adding the root; this operation doesn't conceptually belong to "roots", and it may be placed in different middleware, but it's convenient to do it here
31
const { referer } = ctx.headers
32
if (referer && try_(() => new URL(referer).pathname.startsWith(ctx.state.revProxyPath + ADMIN_URI))) return // exclude apis for admin-panel
33
}