mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
748 B
18 lines
748 B
import { Page, expect } from '@playwright/test';
|
|
|
|
// Credentials come from env so tests work against any environment.
|
|
export const adminEmail = process.env.DOCUSEAL_ADMIN_EMAIL || 'admin@example.com';
|
|
export const adminPassword = process.env.DOCUSEAL_ADMIN_PASSWORD || 'password';
|
|
|
|
export async function loginAs(page: Page, email: string, password: string): Promise<void> {
|
|
await page.goto('/users/sign_in');
|
|
await page.getByLabel(/email/i).fill(email);
|
|
await page.getByLabel(/password/i).fill(password);
|
|
await page.getByRole('button', { name: /sign in|log in/i }).click();
|
|
await expect(page).not.toHaveURL(/sign_in/);
|
|
}
|
|
|
|
export async function loginAsAdmin(page: Page): Promise<void> {
|
|
await loginAs(page, adminEmail, adminPassword);
|
|
}
|