[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 authored and GitHub committed 2025-03-30 14:12:48 +11:00
1 parent 858eb8f807
commit 7f5a447769
40 files changed
+794 -575

No files matched your search

+14 -7
View File
@@ -1,11 +1,15 @@
/** Unit tests for form validation, rendering, etc */
import test from 'playwright/test';
import { navigate } from './helpers';
import { doQuickLogin } from './login';
import { doCachedLogin } from './login';
test('Forms - Stock Item Validation', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'steven',
password: 'wizardstaff',
url: 'stock/location/index/stock-items'
});
test('Forms - Stock Item Validation', async ({ page }) => {
await doQuickLogin(page, 'steven', 'wizardstaff');
await navigate(page, 'stock/location/index/stock-items');
await page.waitForURL('**/web/stock/location/**');
// Create new stock item form
@@ -74,9 +78,12 @@ test('Forms - Stock Item Validation', async ({ page }) => {
await page.getByRole('cell', { name: 'Electronics Lab' }).waitFor();
});
test('Forms - Supplier Validation', async ({ page, request }) => {
await doQuickLogin(page, 'steven', 'wizardstaff');
await navigate(page, 'purchasing/index/suppliers');
test('Forms - Supplier Validation', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'steven',
password: 'wizardstaff',
url: 'purchasing/index/suppliers'
});
await page.waitForURL('**/purchasing/index/**');
await page.getByLabel('action-button-add-company').click();