2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 22:21:37 +00:00

[CI] Playwright improvements (#9395)

* Allow port 4173 (vite preview)

* Change 'base' attr based on vite command

* Allow api_host to be specified separately

* Harden API host functionality

* Adjust server selections

* Cleanup vite.config.ts

* Adjust playwright configuration

- Allow to run in "production" mode
- Builds the code first
- Runs only the backend web server
- Not suitable for coverage

* Tweak github actions

* Tweak QC file

* Reduce number of steps

* Tweak CI file

* Fix typo

* Ensure translation before build

* Fix hard-coded test

* Test tweaks

* uncomment

* Revert some changes

* Run with gunicorn, single worker

* Reduce log output in DEBUG mode

* Update deps

* Add global-setup func

* Fix for .gitignore file

* Cached auth state

* Tweak login func

* Updated tests

* Enable parallel workers again

* Simplify config

* Try with a single worker again

* Single retry mode

* Run auth setup first

- Prevent issues with parallel test doing login

* Improve test setup process

* Tweaks

* Bump to 3 workers

* Tweak playwright settings

* Revert change

* Revert change
This commit is contained in:
Oliver
2025-03-30 14:12:48 +11:00
committed by GitHub
parent 858eb8f807
commit 7f5a447769
40 changed files with 794 additions and 575 deletions

View File

@@ -1,6 +1,6 @@
import { expect, test } from './baseFixtures.js';
import { activateTableView, loadTab, navigate } from './helpers.js';
import { doQuickLogin } from './login.js';
import { activateTableView, loadTab } from './helpers.js';
import { doCachedLogin } from './login.js';
import { setPluginState } from './settings.js';
/*
@@ -8,10 +8,9 @@ import { setPluginState } from './settings.js';
* Select a number of stock items from the table,
* and print labels against them
*/
test('Label Printing', async ({ page }) => {
await doQuickLogin(page);
test('Label Printing', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
await navigate(page, 'stock/location/index/');
await page.waitForURL('**/web/stock/location/**');
await loadTab(page, 'Stock Items');
@@ -50,10 +49,9 @@ test('Label Printing', async ({ page }) => {
* Navigate to a PurchaseOrder detail page,
* and print a report against it.
*/
test('Report Printing', async ({ page }) => {
await doQuickLogin(page);
test('Report Printing', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
await navigate(page, 'stock/location/index/');
await page.waitForURL('**/web/stock/location/**');
// Navigate to a specific PurchaseOrder
@@ -81,9 +79,11 @@ test('Report Printing', async ({ page }) => {
await page.context().close();
});
test('Report Editing', async ({ page, request }) => {
const [username, password] = ['admin', 'inventree'];
await doQuickLogin(page, username, password);
test('Report Editing', async ({ browser, request }) => {
const page = await doCachedLogin(browser, {
username: 'admin',
password: 'inventree'
});
// activate the sample plugin for this test
await setPluginState({