Files
nat-as-server/e2e/website/routes.spec.ts
tom.hempel 06fc134299
Some checks failed
Tests / test (push) Has been cancelled
just testing the environment
2026-05-20 07:10:08 +02:00

65 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test';
import { loginAs, logout } from './helpers';
test.describe('Website routes (admin)', () => {
test.beforeEach(async ({ page }) => {
await loginAs(page, 'testadmin');
});
test('dashboard lists questionnaires', async ({ page }) => {
await expect(page.locator('h1')).toHaveText('Questionnaires');
await expect(page.locator('.q-card, .empty-state')).toBeVisible();
});
test('export page', async ({ page }) => {
await page.goto('/website/#/export');
await expect(page.locator('h1')).toContainText('Export');
});
test('users page for admin', async ({ page }) => {
await page.goto('/website/#/users');
await expect(page.locator('h1')).toContainText('Users');
});
test('clients page', async ({ page }) => {
await page.goto('/website/#/clients');
await expect(page.locator('h1')).toContainText('Clients');
});
test('assignments page', async ({ page }) => {
await page.goto('/website/#/assignments');
await expect(page.locator('h1')).toContainText('Assign');
});
test('editor for seeded questionnaire', async ({ page }) => {
await page.goto('/website/#/questionnaire/questionnaire_test_demo');
await expect(page.locator('#editorTitle')).not.toHaveText('Loading...');
await expect(page.locator('#editorContent')).toContainText('Questions');
});
test('results page', async ({ page }) => {
await page.goto('/website/#/questionnaire/questionnaire_test_demo/results');
await expect(page.locator('h1')).toContainText('Results');
});
test('logout clears session', async ({ page }) => {
await logout(page);
await page.goto('/website/#/');
await expect(page.locator('#loginForm')).toBeVisible();
});
});
test.describe('Website role nav', () => {
test('coach cannot see admin nav items', async ({ page }) => {
await loginAs(page, 'testcoach1');
const usersNav = page.locator('[data-nav-roles] a[href="#/users"]');
await expect(usersNav).toBeHidden();
});
test('supervisor sees users nav', async ({ page }) => {
await loginAs(page, 'testsuper1');
const usersNav = page.locator('[data-nav-roles] a[href="#/users"]');
await expect(usersNav).toBeVisible();
});
});