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

[PUI] Set password (#8770)

* Add <ChangePassword> page

* Rename Set-Password to ResetPassword

* Add unit testing

* Ensure user is properly logged into page

* Update playwright tests

* Small tweaks
This commit is contained in:
Oliver
2024-12-27 11:01:48 +11:00
committed by GitHub
parent 5499884553
commit 189f2303b8
8 changed files with 181 additions and 10 deletions

View File

@ -116,6 +116,8 @@ test('Parts - Allocations', async ({ page }) => {
await page.getByText('5 / 109').waitFor();
// Navigate to the "Allocations" tab
await page.waitForTimeout(500);
await page.getByRole('tab', { name: 'Allocations' }).click();
await page.getByRole('button', { name: 'Build Order Allocations' }).waitFor();

View File

@ -95,3 +95,37 @@ test('Login - Failures', async ({ page }) => {
await page.waitForTimeout(2500);
});
test('Login - Change Password', async ({ page }) => {
await doQuickLogin(page, 'noaccess', 'youshallnotpass');
// Navigate to the 'change password' page
await page.goto(`${baseUrl}/settings/user/account`);
await page.getByLabel('action-menu-user-actions').click();
await page.getByLabel('action-menu-user-actions-change-password').click();
// First attempt with some errors
await page.getByLabel('input-password-1').fill('12345');
await page.getByLabel('input-password-2').fill('54321');
await page.getByRole('button', { name: 'Confirm' }).click();
await page.getByText('The two password fields didnt match').waitFor();
await page.getByLabel('input-password-2').fill('12345');
await page.getByRole('button', { name: 'Confirm' }).click();
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.getByLabel('input-password-2').fill('youshallnotpass');
await page.getByRole('button', { name: 'Confirm' }).click();
await page.getByText('Password Changed').waitFor();
await page.getByText('The password was set successfully').waitFor();
// Should have redirected to the index page
await page.waitForURL('**/platform/home**');
await page.getByText('InvenTree Demo Server - Norman Nothington');
await page.waitForTimeout(1000);
});