mirror of
https://github.com/documenso/documenso.git
synced 2025-11-24 13:41:30 +10:00
feat: improve tests
This commit is contained in:
@ -2,9 +2,9 @@ import { type Page, expect, test as setup } from '@playwright/test';
|
||||
|
||||
import { STORAGE_STATE } from '../../../playwright.config';
|
||||
|
||||
const username = process.env.E2E_TEST_USERNAME || '';
|
||||
const email = process.env.E2E_TEST_USER_EMAIL || '';
|
||||
const password = process.env.E2E_TEST_USER_PASSWORD || '';
|
||||
const username = process.env.E2E_TEST_AUTHENTICATE_USERNAME || '';
|
||||
const email = process.env.E2E_TEST_AUTHENTICATE_USER_EMAIL || '';
|
||||
const password = process.env.E2E_TEST_AUTHENTICATE_USER_PASSWORD || '';
|
||||
|
||||
setup('authenticate', async ({ page }: { page: Page }) => {
|
||||
await page.goto('/signup');
|
||||
@ -16,9 +16,9 @@ setup('authenticate', async ({ page }: { page: Page }) => {
|
||||
const box = await canvas.boundingBox();
|
||||
|
||||
if (box) {
|
||||
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
|
||||
await page.mouse.move(box.x + box.width / 8, box.y + box.height / 6);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(box.x + box.width / 4, box.y + box.height / 4);
|
||||
await page.mouse.move(box.x + box.width / 8, box.y + box.height / 6);
|
||||
await page.mouse.up();
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ setup('authenticate', async ({ page }: { page: Page }) => {
|
||||
await page.getByLabel('Email').fill(email);
|
||||
await page.getByLabel('Password').fill(password);
|
||||
await page.getByRole('button', { name: 'Sign In' }).click();
|
||||
await page.waitForURL('/documents');
|
||||
|
||||
await expect(page).toHaveURL('/documents');
|
||||
await page.context().storageState({ path: STORAGE_STATE });
|
||||
});
|
||||
|
||||
@ -29,6 +29,9 @@ test('user can sign up with email and password', async ({ page }: { page: Page }
|
||||
}
|
||||
|
||||
await page.getByRole('button', { name: 'Sign Up' }).click();
|
||||
await page.waitForURL('/documents');
|
||||
|
||||
await expect(page).toHaveURL('/documents');
|
||||
});
|
||||
|
||||
test('user can login with user and password', async ({ page }: { page: Page }) => {
|
||||
@ -37,5 +40,6 @@ test('user can login with user and password', async ({ page }: { page: Page }) =
|
||||
await page.getByLabel('Password').fill(password);
|
||||
await page.getByRole('button', { name: 'Sign In' }).click();
|
||||
|
||||
await page.waitForURL('/documents');
|
||||
await expect(page).toHaveURL('/documents');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user