Implement integration tests with Playwright
This commit is contained in:
26
tests/admin.spec.ts
Normal file
26
tests/admin.spec.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Admin Dashboard', () => {
|
||||
// Use a beforeEach hook to log in before each test
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/en/admin');
|
||||
|
||||
// Check if login is needed
|
||||
const passwordInput = page.getByPlaceholder('Password');
|
||||
if (await passwordInput.isVisible()) {
|
||||
await passwordInput.fill('admin123'); // Default dev password
|
||||
await page.getByRole('button', { name: 'Login' }).click({ force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('Can access Admin Dashboard', async ({ page }) => {
|
||||
// Song Library was moved, check for Dashboard title and other sections
|
||||
await expect(page.getByRole('heading', { name: 'Hördle Admin Dashboard' })).toBeVisible();
|
||||
await expect(page.getByText('Manage Specials')).toBeVisible();
|
||||
});
|
||||
|
||||
test('Shows Daily Puzzles section', async ({ page }) => {
|
||||
// "Today's Daily Puzzles" is the text in en.json
|
||||
await expect(page.getByText("Today's Daily Puzzles")).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user