2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-28 13:54:25 +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
+17 -20
View File
@@ -7,12 +7,11 @@ import {
openFilterDrawer,
setTableChoiceFilter
} from '../helpers.js';
import { doQuickLogin } from '../login.js';
import { doCachedLogin } from '../login.js';
test('Stock - Basic Tests', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Basic Tests', 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, 'Location Details');
@@ -39,10 +38,9 @@ test('Stock - Basic Tests', async ({ page }) => {
await loadTab(page, 'Installed Items');
});
test('Stock - Location Tree', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Location Tree', 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, 'Location Details');
@@ -56,10 +54,13 @@ test('Stock - Location Tree', async ({ page }) => {
await page.getByRole('cell', { name: 'Factory' }).first().waitFor();
});
test('Stock - Filters', async ({ page }) => {
await doQuickLogin(page, 'steven', 'wizardstaff');
test('Stock - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'steven',
password: 'wizardstaff',
url: '/stock/location/index/'
});
await navigate(page, 'stock/location/index/');
await loadTab(page, 'Stock Items');
await openFilterDrawer(page);
@@ -101,8 +102,8 @@ test('Stock - Filters', async ({ page }) => {
await clearTableFilters(page);
});
test('Stock - Serial Numbers', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Serial Numbers', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Use the "global search" functionality to find a part we are interested in
// This is to exercise the search functionality and ensure it is working as expected
@@ -167,10 +168,8 @@ test('Stock - Serial Numbers', async ({ page }) => {
/**
* Test various 'actions' on the stock detail page
*/
test('Stock - Stock Actions', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'stock/item/1225/details');
test('Stock - Stock Actions', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/item/1225/details' });
// Helper function to launch a stock action
const launchStockAction = async (action: string) => {
@@ -231,11 +230,9 @@ test('Stock - Stock Actions', async ({ page }) => {
await page.getByLabel('action-menu-stock-operations-return').click();
});
test('Stock - Tracking', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Tracking', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/item/176/details' });
// Navigate to the "stock item" page
await navigate(page, 'stock/item/176/details/');
await page.getByRole('link', { name: 'Widget Assembly # 2' }).waitFor();
// Navigate to the "stock tracking" tab