2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

[PUI] Test for errors in console (#7114)

* ensure no errors are thrown in the console

* fix key issue

* add missing keys

* fix table order

* fix wrong imports

* add missing key

* fix accessor ref

* fix style

* mark internal fetching errors and ignore them

* do not raise internal errors

* ignore barcode api calls

* style fix

* do not raise on chrome errors

* refactor url

* more exclusion

* remove duplicate assertation
This commit is contained in:
Matthias Mair
2024-04-25 11:26:04 +02:00
committed by GitHub
parent 47c797db88
commit b5b0ff2666
15 changed files with 62 additions and 27 deletions

View File

@ -50,6 +50,24 @@ export const test = baseTest.extend({
)
);
}
},
// Ensure no errors are thrown in the console
page: async ({ baseURL, page }, use) => {
const messages = [];
page.on('console', (msg) => {
const url = msg.location().url;
if (
msg.type() === 'error' &&
!msg.text().startsWith('ERR: ') &&
url != 'http://localhost:8000/api/barcode/' &&
url != 'http://localhost:8000/api/news/?search=&offset=0&limit=25' &&
url != 'https://docs.inventree.org/en/versions.json' &&
!url.startsWith('chrome://')
)
messages.push(msg);
});
await use(page);
expect(messages).toEqual([]);
}
});

View File

@ -4,11 +4,6 @@ import { doQuickLogin } from './login.js';
test('PUI - Modals as admin', async ({ page }) => {
await doQuickLogin(page, 'admin', 'inventree');
// Fail on console error
await page.on('console', (msg) => {
if (msg.type() === 'error') test.fail();
});
// use server info
await page.getByRole('button', { name: 'Open spotlight' }).click();
await page

View File

@ -1,5 +1,4 @@
import { test } from '@playwright/test';
import { test } from '../baseFixtures';
import { baseUrl } from '../defaults';
import { doQuickLogin } from '../login';