Fix password update (#71)

* Fix password update
* Use next or callback params for retro-compatibility
This commit is contained in:
Giancarlo Buomprisco
2024-10-12 05:09:34 +02:00
committed by GitHub
parent 2fe8fc0231
commit 25adc2d1e3
6 changed files with 80 additions and 9 deletions

View File

@@ -80,4 +80,10 @@ export class AuthPageObject {
await this.visitConfirmEmailLink(email);
}
async updatePassword(password: string) {
await this.page.fill('[name="password"]', password);
await this.page.fill('[name="repeatPassword"]', password);
await this.page.click('[type="submit"]');
}
}

View File

@@ -0,0 +1,48 @@
import { expect, test } from '@playwright/test';
import { AuthPageObject } from './auth.po';
const email = 'owner@makerkit.dev';
const newPassword = (Math.random() * 10000).toString();
test.describe('Password Reset Flow', () => {
test.describe.configure({ mode: 'serial' });
test('will reset the password and sign in with new one', async ({ page }) => {
const auth = new AuthPageObject(page);
await page.goto('/auth/password-reset');
await page.fill('[name="email"]', email);
await page.click('[type="submit"]');
await auth.visitConfirmEmailLink(email);
await page.waitForURL('/update-password');
await auth.updatePassword(newPassword);
await page
.locator('a', {
hasText: 'Back to Home Page',
})
.click();
await page.waitForURL('/home');
await auth.signOut();
await page
.locator('a', {
hasText: 'Sign in',
})
.click();
await auth.signIn({
email,
password: newPassword,
});
await page.waitForURL('/home');
});
});