test: fixed inconsistent results for 'admin1'
Massimo Melina committed
Apr 21, 2025 at 12:36 UTC
55ae160083110c77af5049f5bfb6dc4cc3fc6662
1 file changed
+15
-4
e2e/frontend.spec.ts
+15
-4
@@ -5,10 +5,10 @@ const username = 'rejetto'
5
const password = 'password'
6
7
const t = Date.UTC(2025, 0, 20, 3, 0, 0, 0) / 1000 // a fixed timestamp, for visual comparison
8
-fs.utimesSync('tests', t, t)
8
9
// a generic test touch several parts
10
test('around1', async ({ page }) => {
11
+ fs.utimesSync('tests', t, t);
12
await page.goto('http://localhost:81/');
13
await expect(page).toHaveTitle(/File server/);
14
await screenshot(page);
@@ -100,6 +100,7 @@ test('around1', async ({ page }) => {
100
});
101
102
test('search1', async ({ page }) => {
103
+ fs.utimesSync('tests', t, t)
104
await page.goto('http://localhost:81/');
105
await page.getByRole('button', { name: 'Search' }).click();
106
await page.locator('input[name="name"]').fill('a');
@@ -195,6 +196,7 @@ test('frontend-admin', async ({ page }) => {
196
})
197
198
test('admin1', async ({ page }) => {
199
+ await fs.promises.rm('tests/work/logs', {force: true, recursive: true}); // clear logs to have consistent screenshots
200
await page.goto('http://localhost:81/~/admin/');
201
await page.getByRole('textbox', { name: 'Username' }).fill(username);
202
await page.getByRole('textbox', { name: 'Password' }).fill(password);
@@ -212,7 +214,12 @@ test('admin1', async ({ page }) => {
214
await page.getByRole('button', { name: 'Close' }).click();
215
}
216
215
- await clickMenu('Internet'); // initiate get_nat process, so we'll have to wait less later
217
+ function dataTableLoading() {
218
+ return expect(page.getByRole('grid').getByRole('img')).toBeVisible({ visible: false });
219
+ }
220
+// const dataTableContent = '.MuiDataGrid-overlayWrapperInner,.MuiDataGrid-virtualScroller'
221
+
222
+ await clickMenu('Internet'); // initiate the get_nat process, so we'll have to wait less, later
223
await clickMenu('Shared files')
224
await expect(page.getByText('cantListBut')).toBeVisible(); // wait for data
225
await screenshot(page)
@@ -230,7 +237,8 @@ test('admin1', async ({ page }) => {
237
await screenshot(page)
238
239
await clickMenu('Logs');
233
- await screenshot(page, '.MuiDataGrid-virtualScrollerRenderZone');
240
+ await dataTableLoading()
241
+ await screenshot(page);
242
await page.getByRole('tab').nth(2).click();
243
await page.getByRole('tab').nth(3).click();
244
await page.getByRole('tab').nth(4).click();
@@ -239,7 +247,10 @@ test('admin1', async ({ page }) => {
247
await page.getByRole('button', { name: '(Close)' }).click();
248
await expect(page.getByText('LogsServedNot')).toBeVisible();
249
await clickMenu('Language');
242
- await screenshot(page, '.MuiDataGrid-virtualScrollerRenderZone');
250
+ await dataTableLoading()
251
+ if (!isPhone)
252
+ await expect(page.getByText('author', { exact: true })).toBeVisible(); // wait for layout to be stable
253
+ await screenshot(page);
254
await clickMenu('Plugins');
255
await expect(page.getByText('antibrute')).toBeVisible(); // wait for data
256
await screenshot(page);