2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-14 06:31:27 +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

@@ -4,15 +4,13 @@ import {
clearTableFilters,
globalSearch,
loadTab,
navigate,
setTableChoiceFilter
} from '../helpers.ts';
import { doQuickLogin } from '../login.ts';
import { doCachedLogin } from '../login.ts';
test('Sales Orders - Tabs', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Tabs', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'sales/index/' });
await navigate(page, 'sales/index/');
await page.waitForURL('**/web/sales/**');
await loadTab(page, 'Sales Orders');
@@ -63,10 +61,12 @@ test('Sales Orders - Tabs', async ({ page }) => {
await loadTab(page, 'Notes');
});
test('Sales Orders - Basic Tests', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Basic Tests', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Sales' }).click();
await page.waitForURL('**/sales/index/**');
await loadTab(page, 'Sales Orders');
await clearTableFilters(page);
@@ -102,10 +102,12 @@ test('Sales Orders - Basic Tests', async ({ page }) => {
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
});
test('Sales Orders - Shipments', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Shipments', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Sales' }).click();
await page.waitForURL('**/sales/index/**');
await loadTab(page, 'Sales Orders');
await clearTableFilters(page);
@@ -131,7 +133,7 @@ test('Sales Orders - Shipments', async ({ page }) => {
await page.getByRole('menuitem', { name: 'Edit' }).click();
// Ensure the form has loaded
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
let tracking_number = await page
.getByLabel('text-field-tracking_number')
@@ -201,10 +203,11 @@ test('Sales Orders - Shipments', async ({ page }) => {
.click();
});
test('Sales Orders - Duplicate', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Duplicate', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'sales/sales-order/11/detail'
});
await navigate(page, 'sales/sales-order/11/detail');
await page.getByLabel('action-menu-order-actions').click();
await page.getByLabel('action-menu-order-actions-duplicate').click();