-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Expand file tree
/
Copy pathhealth.spec.ts
More file actions
36 lines (28 loc) · 1.23 KB
/
health.spec.ts
File metadata and controls
36 lines (28 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { test, expect } from '@playwright/test';
import { API_MODE } from './helpers/config';
test.describe('Health Checks', () => {
test('app should load successfully', async ({ page }) => {
await page.goto('/');
// Should see the app brand/logo
await expect(page.locator('a.navbar-brand')).toBeVisible({ timeout: 10000 });
// Should see navigation
await expect(page.locator('nav.navbar')).toBeVisible();
});
test('API should be accessible', async ({ request }) => {
test.skip(!API_MODE, 'API-only: direct API endpoint check');
const response = await request.get('https://api.realworld.show/api/tags');
expect(response.ok()).toBeTruthy();
});
test('can navigate to login page', async ({ page }) => {
await page.goto('/login');
// Should see login form
await expect(page.locator('h1')).toContainText('Sign in', { timeout: 10000 });
await expect(page.locator('input[name="email"]')).toBeVisible();
});
test('can navigate to register page', async ({ page }) => {
await page.goto('/register');
// Should see register form
await expect(page.locator('h1')).toContainText('Sign up', { timeout: 10000 });
await expect(page.locator('input[name="username"]')).toBeVisible();
});
});