Spaces:
Paused
Paused
Download tests/e2e/auth.spec.js from Kraft102/widgettdc-api: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/Kraft102/widgettdc-api/resolve/main/tests/e2e/auth.spec.js
- Command line
-
hf download hf://spaces/Kraft102/widgettdc-api/tests/e2e/auth.spec.js
-
curl -L -o auth.spec.js https://huggingface.co/spaces/Kraft102/widgettdc-api/resolve/main/tests/e2e/auth.spec.js
1.31 kB
| const { test, expect } = require('@playwright/test'); | |
| test.describe('Authentication Flow', () => { | |
| test('should successfully login with valid credentials', async ({ page }) => { | |
| await page.goto('/login'); | |
| await page.fill('input[name="email"]', 'admin@widgettdc.dev'); | |
| await page.fill('input[name="password"]', 'password'); | |
| await page.click('button[type="submit"]'); | |
| await expect(page).toHaveURL('/dashboard'); | |
| await expect(page.locator('text=Welcome')).toBeVisible(); | |
| }); | |
| test('should show error with invalid credentials', async ({ page }) => { | |
| await page.goto('/login'); | |
| await page.fill('input[name="email"]', 'wrong@example.com'); | |
| await page.fill('input[name="password"]', 'wrongpass'); | |
| await page.click('button[type="submit"]'); | |
| await expect(page.locator('.error-message')).toBeVisible(); | |
| await expect(page.locator('.error-message')).toContainText('Invalid credentials'); | |
| }); | |
| test('should logout successfully', async ({ page }) => { | |
| await page.goto('/login'); | |
| await page.fill('input[name="email"]', 'admin@widgettdc.dev'); | |
| await page.fill('input[name="password"]', 'password'); | |
| await page.click('button[type="submit"]'); | |
| await page.click('button[aria-label="Logout"]'); | |
| await expect(page).toHaveURL('/login'); | |
| }); | |
| }); | |