Fix password update (#71)
* Fix password update * Use next or callback params for retro-compatibility
This commit is contained in:
committed by
GitHub
parent
2fe8fc0231
commit
25adc2d1e3
@@ -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"]');
|
||||
}
|
||||
}
|
||||
|
||||
48
apps/e2e/tests/authentication/password-reset.spec.ts
Normal file
48
apps/e2e/tests/authentication/password-reset.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
@@ -15,11 +15,13 @@ export const generateMetadata = async () => {
|
||||
};
|
||||
};
|
||||
|
||||
const Logo = () => <AppLogo href={''} />;
|
||||
|
||||
async function UpdatePasswordPage() {
|
||||
await requireUserInServerComponent();
|
||||
|
||||
return (
|
||||
<AuthLayoutShell Logo={AppLogo}>
|
||||
<AuthLayoutShell Logo={Logo}>
|
||||
<UpdatePasswordForm redirectTo={pathsConfig.app.home} />
|
||||
</AuthLayoutShell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user