mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-14 06:31:27 +00:00
[bug] Playwright fixes (#9933)
* Fixes for playwright testing - Ensure cookies are completely cleaned between sessions - Fix base URL based on vite command - Fix samesite cookie mode - Prevent /static/ files being served by web server on :8000 * Remove gunicorn option * Readjust base URL * Simplify doCachedLogin * Fix logic func * Revert webserver cmd * Set base URL in playwrightconfig file * Fix URL checks * Fix URL definitions * adjust playwright base URL * Tweak for URL helper * Further login tweaks * Tweak test * wait for API before starting tests * Handle error * Adjust login functions * Don't use gunicorn - But still use the webserver to serve static files in CI * Enhanced login functions * Tweak login tests * Fix broken test * Flipped the flippies
This commit is contained in:
@@ -52,7 +52,7 @@ export const test = baseTest.extend({
|
||||
}
|
||||
},
|
||||
// Ensure no errors are thrown in the console
|
||||
page: async ({ baseURL, page }, use) => {
|
||||
page: async ({ page }, use) => {
|
||||
const messages = [];
|
||||
page.on('console', (msg) => {
|
||||
const url = msg.location().url;
|
||||
@@ -67,20 +67,20 @@ export const test = baseTest.extend({
|
||||
) < 0 &&
|
||||
msg.text() !=
|
||||
'Failed to load resource: the server responded with a status of 400 (Bad Request)' &&
|
||||
!msg.text().includes('http://localhost:8000/this/does/not/exist.js') &&
|
||||
url != 'http://localhost:8000/this/does/not/exist.js' &&
|
||||
url != 'http://localhost:8000/api/user/me/' &&
|
||||
url != 'http://localhost:8000/api/user/token/' &&
|
||||
url != 'http://localhost:8000/api/auth/v1/auth/login' &&
|
||||
url != 'http://localhost:8000/api/auth/v1/auth/session' &&
|
||||
url != 'http://localhost:8000/api/auth/v1/account/password/change' &&
|
||||
url != 'http://localhost:8000/api/barcode/' &&
|
||||
url != 'https://docs.inventree.org/en/versions.json' &&
|
||||
url != 'http://localhost:5173/favicon.ico' &&
|
||||
!msg.text().includes('/this/does/not/exist.js') &&
|
||||
!url.includes('/this/does/not/exist.js') &&
|
||||
!url.includes('/api/user/me/') &&
|
||||
!url.includes('/api/user/token/') &&
|
||||
!url.includes('/api/auth/v1/auth/login') &&
|
||||
!url.includes('/api/auth/v1/auth/session') &&
|
||||
!url.includes('/api/auth/v1/account/password/change') &&
|
||||
!url.includes('/api/barcode/') &&
|
||||
!url.includes('/favicon.ico') &&
|
||||
!url.startsWith('https://api.github.com/repos/inventree') &&
|
||||
!url.startsWith('http://localhost:8000/api/news/') &&
|
||||
!url.startsWith('http://localhost:8000/api/notifications/') &&
|
||||
!url.includes('/api/news/') &&
|
||||
!url.includes('/api/notifications/') &&
|
||||
!url.startsWith('chrome://') &&
|
||||
url != 'https://docs.inventree.org/en/versions.json' &&
|
||||
url.indexOf('99999') < 0
|
||||
)
|
||||
messages.push(msg);
|
||||
|
Reference in New Issue
Block a user