Add docker-compose Playwright E2E stack
This commit is contained in:
parent
fd03a5ade3
commit
7ffec2c324
12 changed files with 359 additions and 65 deletions
49
test/e2e-playwright/playwright.config.mjs
Normal file
49
test/e2e-playwright/playwright.config.mjs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* global process */
|
||||
import { defineConfig, devices } from 'playwright/test'
|
||||
|
||||
const baseURL = process.env.E2E_BASE_URL || 'http://localhost:8080'
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './specs',
|
||||
// Paths are resolved relative to this config file directory.
|
||||
outputDir: 'test-results',
|
||||
timeout: 60_000,
|
||||
expect: {
|
||||
timeout: 10_000
|
||||
},
|
||||
retries: process.env.CI ? 1 : 0,
|
||||
reporter: process.env.CI
|
||||
? [
|
||||
['line'],
|
||||
['html', { outputFolder: 'playwright-report', open: 'never' }]
|
||||
]
|
||||
: [
|
||||
['list'],
|
||||
['html', { outputFolder: 'playwright-report', open: 'never' }]
|
||||
],
|
||||
use: {
|
||||
baseURL,
|
||||
screenshot: 'only-on-failure',
|
||||
trace: 'on-first-retry',
|
||||
video: 'retain-on-failure'
|
||||
},
|
||||
webServer: {
|
||||
command: 'yarn dev -- --host 0.0.0.0 --port 8080 --strictPort',
|
||||
url: baseURL,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120_000,
|
||||
env: {
|
||||
...process.env,
|
||||
VITE_PROXY_TARGET: process.env.VITE_PROXY_TARGET || 'http://localhost:4000',
|
||||
VITE_PROXY_ORIGIN: process.env.VITE_PROXY_ORIGIN || process.env.VITE_PROXY_TARGET || 'http://localhost:4000'
|
||||
}
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox']
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
25
test/e2e-playwright/specs/admin_smoke.spec.js
Normal file
25
test/e2e-playwright/specs/admin_smoke.spec.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* global process */
|
||||
import { test, expect } from 'playwright/test'
|
||||
|
||||
const adminUsername = process.env.E2E_ADMIN_USERNAME || 'admin'
|
||||
const adminPassword = process.env.E2E_ADMIN_PASSWORD || 'adminadmin'
|
||||
|
||||
test('admin can open the admin settings modal', async ({ page }) => {
|
||||
await page.goto('/login')
|
||||
|
||||
const loginForm = page.locator('#main-scroller form.login-form')
|
||||
await loginForm.locator('#username').fill(adminUsername)
|
||||
await loginForm.locator('#password').fill(adminPassword)
|
||||
await loginForm.getByRole('button', { name: 'Log in' }).click()
|
||||
|
||||
await page.waitForURL(/\/main\/friends/)
|
||||
|
||||
await expect(page.getByTitle('Administration')).toBeVisible()
|
||||
await page.getByTitle('Administration').click()
|
||||
|
||||
const modal = page.locator('.settings-modal-panel')
|
||||
await expect(modal.getByRole('heading', { name: 'Administration' })).toBeVisible()
|
||||
|
||||
await modal.getByRole('tab', { name: 'Emoji' }).click()
|
||||
await expect(modal.getByText('Emoji packs')).toBeVisible()
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue