2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-13 19:36:46 +00:00

[bug] Playwright fixes (#9933)

* Fixes for playwright testing

- Ensure cookies are completely cleaned  between sessions
- Fix base URL based on vite command
- Fix samesite cookie mode
- Prevent /static/ files being served by web server on :8000

* Remove gunicorn option

* Readjust base URL

* Simplify doCachedLogin

* Fix logic func

* Revert webserver cmd

* Set base URL in playwrightconfig file

* Fix URL checks

* Fix URL definitions

* adjust playwright base URL

* Tweak for URL helper

* Further login tweaks

* Tweak test

* wait for API before starting tests

* Handle error

* Adjust login functions

* Don't use gunicorn

- But still use the webserver to serve static files in CI

* Enhanced login functions

* Tweak login tests

* Fix broken test

* Flipped the flippies
This commit is contained in:
Oliver
2025-07-02 22:12:17 +10:00
committed by GitHub
parent 2ce7e225ad
commit 3f14ae3f7d
11 changed files with 169 additions and 87 deletions

View File

@@ -45,13 +45,13 @@ test('Login - Failures', async ({ page }) => {
});
test('Login - Change Password', async ({ page }) => {
await doLogin(page, 'noaccess', 'youshallnotpass');
await page.waitForLoadState('networkidle');
await doLogin(page, {
username: 'noaccess',
password: 'youshallnotpass'
});
// Navigate to the 'change password' page
await navigate(page, 'settings/user/account');
await page.waitForLoadState('networkidle');
await navigate(page, 'settings/user/account', { waitUntil: 'networkidle' });
await page.getByLabel('action-menu-account-actions').click();
await page.getByLabel('action-menu-account-actions-change-password').click();
@@ -69,9 +69,16 @@ test('Login - Change Password', async ({ page }) => {
await page.getByText('This password is too short').waitFor();
await page.getByText('This password is entirely numeric').waitFor();
await page.getByLabel('input-password-1').fill('youshallnotpass');
await page.waitForTimeout(250);
await page.getByLabel('password', { exact: true }).clear();
await page.getByLabel('input-password-1').clear();
await page.getByLabel('input-password-2').clear();
await page.getByLabel('password', { exact: true }).fill('youshallnotpass');
await page.getByLabel('input-password-1').fill('youshallnotpass');
await page.getByLabel('input-password-2').fill('youshallnotpass');
await page.getByRole('button', { name: 'Confirm' }).click();
await page.getByText('Password Changed').waitFor();