2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 11:40:58 +00:00

[CI] Playwright testing improvements (#8985)

* Run playwright tests in headless mode

* Add navigation helper

* Validate files

* test fix

* Remove 'headless'

* Fixes

* Fix for 'navigate' helper

* Further updates
This commit is contained in:
Oliver
2025-02-01 16:29:13 +11:00
committed by GitHub
parent 66496fb669
commit 821b311d73
16 changed files with 116 additions and 87 deletions

View File

@ -1,5 +1,6 @@
import { expect } from './baseFixtures.js';
import { baseUrl, logoutUrl, user } from './defaults';
import { navigate } from './helpers.js';
/*
* Perform form based login operation from the "login" URL
@ -8,7 +9,7 @@ export const doLogin = async (page, username?: string, password?: string) => {
username = username ?? user.username;
password = password ?? user.password;
await page.goto(logoutUrl);
await navigate(page, logoutUrl);
await expect(page).toHaveTitle(/^InvenTree.*$/);
await page.waitForURL('**/platform/login');
await page.getByLabel('username').fill(username);
@ -31,7 +32,7 @@ export const doQuickLogin = async (
password = password ?? user.password;
url = url ?? baseUrl;
await page.goto(`${url}/login/?login=${username}&password=${password}`);
await navigate(page, `${url}/login/?login=${username}&password=${password}`);
await page.waitForURL('**/platform/home');
await page.getByLabel('navigation-menu').waitFor();
@ -43,6 +44,6 @@ export const doQuickLogin = async (
};
export const doLogout = async (page) => {
await page.goto(`${baseUrl}/logout/`);
await navigate(page, 'logout');
await page.waitForURL('**/platform/login');
};