dx: steadier UI tests
Massimo Melina committed
May 16, 2025 at 20:03 UTC
73b1409d3d893bd78c2a15229576c1ae41f2fcc2
3 files changed
+5
-5
admin/src/InternetPage.ts
+3
-3
@@ -5,7 +5,7 @@ import { CardMembership, Check, Dns, HomeWorkTwoTone, Lock, Public, PublicTwoTon
5
import { apiCall, useApiEvents, useApiEx } from './api'
6
import {
7
closeDialog, DAY, formatTimestamp, wait, wantArray, with_, PORT_DISABLED, isIP, CFG, md,
8
- useRequestRender, replace, restartAnimation, prefix, isIpLan
8
+ useRequestRender, replace, restartAnimation, prefix, isIpLan, HIDE_IN_TESTS
9
} from './misc'
10
import { Flex, LinkBtn, Btn, Country, wikiLink } from './mui'
11
import { alertDialog, confirmDialog, formDialog, promptDialog, toast, waitDialog } from './dialog'
@@ -307,7 +307,7 @@ export default function InternetPage({ setTitleSide }: PageProps) {
307
const direct = publicIps.includes(data?.localIp!)
308
return h(Flex, { justifyContent: 'space-around' },
309
h(Device, { name: "Server", icon: direct ? Storage : HomeWorkTwoTone, color: localColor, ip: data?.localIp,
310
- below: port && h(Box, { fontSize: 'smaller', className: 'port' }, "port ", port),
310
+ below: port && h(Box, { fontSize: 'smaller', className: 'port ' + HIDE_IN_TESTS }, "port ", port),
311
}),
312
!direct && h(DataLine),
313
!direct && h(Device, {
@@ -462,7 +462,7 @@ function Device({ name, icon, color, ip, below }: any) {
462
return h(Box, { display: 'inline-block', textAlign: 'center' },
463
h(icon, { color, sx: { fontSize, mb: '-0.1em' } }),
464
h(Box, { fontSize: 'larger' }, name),
465
- h(Box, { fontSize: 'smaller', whiteSpace: 'pre-wrap', className: 'ip' }, wantArray(ip).join('\n') || "unknown"),
465
+ h(Box, { fontSize: 'smaller', whiteSpace: 'pre-wrap', className: 'ip ' + HIDE_IN_TESTS }, wantArray(ip).join('\n') || "unknown"),
466
below,
467
)
468
}
e2e/frontend.spec.ts
+1
-1
@@ -269,7 +269,7 @@ test('admin1', async ({ page }) => {
269
await clickMenu('Internet');
270
await expect(page.getByRole('button', { name: 'Verify' })).toBeVisible({ timeout: 10000 }); // wait for data (get_nat can be very slow)
271
await page.mouse.click(1, 1); // avoid focus inconsistencies
272
- await screenshot(page, '.ip,.port')
272
+ await screenshot(page)
273
await clickMenu('Logout');
274
await screenshot(page);
275
});
src/cross-const.ts
+1
-1
@@ -13,7 +13,7 @@ export const UPLOAD_RESUMABLE_HASH = 'upload.hash'
13
export const UPLOAD_REQUEST_STATUS = 'upload.status'
14
export const PREVIOUS_TAG = 'previous'
15
export const ALLOW_SESSION_IP_CHANGE = 'allow_session_ip_change'
16
-export const HIDE_IN_TESTS = 'hideInTests'
16
+export const HIDE_IN_TESTS = 'hideInTests' // elements that have variable size, where masking would produce changes, must be hidden
17
18
export const HTTP_OK = 200
19
export const HTTP_NO_CONTENT = 204