2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-18 10:46:31 +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:
Oliver
2025-07-02 22:12:17 +10:00
committed by GitHub
parent 2ce7e225ad
commit 3f14ae3f7d
11 changed files with 169 additions and 87 deletions

View File

@@ -21,6 +21,10 @@ const OUTPUT_DIR = '../../src/backend/InvenTree/web/static/web';
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
// In 'build' mode, we want to use an empty base URL (for static file generation)
const baseUrl: string | undefined = command === 'build' ? '' : undefined;
console.log(`Running Vite in '${command}' mode -> base URL: ${baseUrl}`);
return {
plugins: [
react({
@@ -57,7 +61,7 @@ export default defineConfig(({ command, mode }) => {
],
// When building, set the base path to an empty string
// This is required to ensure that the static path prefix is observed
base: command == 'build' ? '' : undefined,
base: baseUrl,
build: {
manifest: true,
outDir: OUTPUT_DIR,