mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-08 05:43:18 +01:00
Add basic e2e tests for admin panel
This commit is contained in:
committed by
Constantin Graf
parent
a12ee1b029
commit
06a2048771
24
e2e/utils/admin.ts
Normal file
24
e2e/utils/admin.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { PLAYWRIGHT_BASE_URL } from '../../playwright/config';
|
||||
|
||||
/**
|
||||
* The seeded user that is allowed to access the Filament admin panel.
|
||||
*
|
||||
* Panel access is granted by email address via the `SUPER_ADMINS` config, so
|
||||
* the admin panel tests cannot use the throwaway users created by the default
|
||||
* fixture and rely on the seeded user instead.
|
||||
*/
|
||||
export const SUPER_ADMIN_EMAIL = 'admin@example.com';
|
||||
export const SEEDED_USER_PASSWORD = 'password';
|
||||
|
||||
/**
|
||||
* Log in as the seeded super admin user via the regular application login.
|
||||
*/
|
||||
export async function loginAsSuperAdmin(page: Page): Promise<void> {
|
||||
await page.goto(PLAYWRIGHT_BASE_URL + '/login');
|
||||
await page.getByLabel('Email').fill(SUPER_ADMIN_EMAIL);
|
||||
await page.getByLabel('Password').fill(SEEDED_USER_PASSWORD);
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await expect(page.getByTestId('dashboard_view')).toBeVisible({ timeout: 15000 });
|
||||
}
|
||||
Reference in New Issue
Block a user