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

@ -11,12 +11,14 @@ import {
openFilterDrawer,
setTableChoiceFilter
} from '../helpers.ts';
import { doQuickLogin } from '../login.ts';
import { doCachedLogin } from '../login.ts';
test('Purchase Orders - Table', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Table', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
await activateTableView(page);
@ -42,10 +44,11 @@ test('Purchase Orders - Table', async ({ page }) => {
await page.getByText('2025-07-17').waitFor(); // Target Date
});
test('Purchase Orders - Calendar', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Calendar', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
// Ensure view is in "calendar" mode
@ -66,10 +69,11 @@ test('Purchase Orders - Calendar', async ({ page }) => {
await activateTableView(page);
});
test('Purchase Orders - Barcodes', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Barcodes', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/13/detail'
});
await navigate(page, 'purchasing/purchase-order/13/detail');
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
// Display QR code
@ -126,10 +130,11 @@ test('Purchase Orders - Barcodes', async ({ page }) => {
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
});
test('Purchase Orders - General', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - General', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await page.getByRole('cell', { name: 'PO0012' }).click();
await page.waitForTimeout(200);
@ -179,10 +184,15 @@ test('Purchase Orders - General', async ({ page }) => {
await page.getByRole('tab', { name: 'Details' }).waitFor();
});
test('Purchase Orders - Filters', async ({ page }) => {
await doQuickLogin(page, 'reader', 'readonly');
test('Purchase Orders - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'reader',
password: 'readonly'
});
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
await activateTableView(page);
@ -204,11 +214,13 @@ test('Purchase Orders - Filters', async ({ page }) => {
await page.getByRole('option', { name: 'Target Date After' }).waitFor();
});
test('Purchase Orders - Order Parts', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Order Parts', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Open "Order Parts" wizard from the "parts" table
await page.getByRole('tab', { name: 'Parts' }).click();
await page.waitForURL('**/part/category/index/**');
await page
.getByLabel('panel-tabs-partcategory')
.getByRole('tab', { name: 'Parts' })
@ -284,10 +296,12 @@ test('Purchase Orders - Order Parts', async ({ page }) => {
/**
* Tests for receiving items against a purchase order
*/
test('Purchase Orders - Receive Items', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Receive Items', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await page.getByRole('cell', { name: 'PO0014' }).click();
await loadTab(page, 'Order Details');
@ -351,10 +365,11 @@ test('Purchase Orders - Receive Items', async ({ page }) => {
await page.getByRole('cell', { name: 'bucket' }).first().waitFor();
});
test('Purchase Orders - Duplicate', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Duplicate', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/13/detail'
});
await navigate(page, 'purchasing/purchase-order/13/detail');
await page.getByLabel('action-menu-order-actions').click();
await page.getByLabel('action-menu-order-actions-duplicate').click();