Files
myeasycms-v2/apps/e2e/tests/authentication/password-reset.spec.ts
Giancarlo Buomprisco 131b1061e6 Enforce RLS when user opted in to MFA. (#188)
* Allow Super Admin to view tables using RLS
* Replace previous usages of the Admin client using the authed client using the new RLS
* Enforce MFA for Super Admin users
* Enforce RLS when user opted in to MFA.
* Add Super Admin Access Policies and Update Database Types
* Consolidate super admin logic into a single function that uses the RPC is_super_admin
* Added Super Admin E2E tests
* Fixes and improvements
* Bump version to 2.5.0
2025-03-02 11:21:01 +08:00

72 lines
1.6 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { AuthPageObject } from './auth.po';
const newPassword = (Math.random() * 10000).toString();
test.describe('Password Reset Flow', () => {
test('will reset the password and sign in with new one', async ({ page }) => {
const auth = new AuthPageObject(page);
let email = '';
await expect(async () => {
email = `test-${Math.random() * 10000}@makerkit.dev`;
await page.goto('/auth/sign-up');
await auth.signUp({
email,
password: 'password',
repeatPassword: 'password',
});
await auth.visitConfirmEmailLink(email, {
deleteAfter: true,
subject: 'Confirm your email',
});
await page.context().clearCookies();
await page.reload();
await page.goto('/auth/password-reset');
await page.fill('[name="email"]', email);
await page.click('[type="submit"]');
await auth.visitConfirmEmailLink(email, {
deleteAfter: true,
subject: 'Reset your password',
});
await page.waitForURL('/update-password', {
timeout: 1000,
});
await auth.updatePassword(newPassword);
await page
.locator('a', {
hasText: 'Back to Home Page',
})
.click();
await page.waitForURL('/home');
}).toPass();
await auth.signOut();
await page.waitForURL('/');
await page.goto('/auth/sign-in');
await auth.signIn({
email,
password: newPassword,
});
await page.waitForURL('/home', {
timeout: 2000,
});
});
});