This commit is contained in:
cupcakearmy 2022-07-19 12:41:42 +02:00
parent c7088a8b43
commit ce07ca8b0d
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
6 changed files with 23 additions and 7 deletions

View File

@ -27,7 +27,7 @@ jobs:
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run your tests
run: npm test
run: pnpm run test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2

3
.gitignore vendored
View File

@ -9,3 +9,6 @@ node_modules
/build
/functions
.env
General
test-results

View File

@ -3,7 +3,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "svelte-kit preview",
"preview": "vite preview --port 3000",
"check": "svelte-check --tsconfig tsconfig.json",
"licenses": "license-checker --summary > licenses.csv",
"locale:download": "node scripts/locale.js"

View File

@ -5,9 +5,14 @@
"dev:front": "pnpm --prefix frontend run dev",
"dev:proxy": "node proxy.mjs",
"dev": "run-p dev:*",
"test": "playwright test",
"ci:server": "run-p ci:server:*",
"ci:server:backend": "cd backend && cargo run",
"ci:server:front": "pnpm --prefix frontend run preview",
"ci:server:proxy": "node proxy.mjs",
"ci:prepare": "run-p ci:prepare:*",
"ci:prepare:backend": "cd backend && cargo build",
"ci:prepare:front": "pnpm --prefix frontend install"
"ci:prepare:front": "pnpm --prefix frontend install && pnpm --prefix frontend run build"
},
"devDependencies": {
"@playwright/test": "^1.23.4",

View File

@ -1,18 +1,25 @@
import type { PlaywrightTestConfig } from '@playwright/test'
import { devices, type PlaywrightTestConfig } from '@playwright/test'
const config: PlaywrightTestConfig = {
use: {
video: 'on-first-retry',
video: 'retain-on-failure',
baseURL: 'http://localhost:1234',
actionTimeout: 3_000,
// actionTimeout: 10_000,
},
outputDir: './test-results',
testDir: './test',
testMatch: /.*\.ts/,
webServer: {
command: 'pnpm run dev',
command: 'pnpm run ci:server',
port: 1234,
reuseExistingServer: true,
timeout: 20_000,
},
projects: [
{ name: 'Chrome', use: { ...devices['Desktop Chrome'] } },
{ name: 'Firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'Safari', use: { ...devices['Desktop Safari'] } },
],
}
export default config

View File

@ -18,6 +18,7 @@ async function checkLinkForText(page: Page, link: string, text: string) {
}
async function checkLinkDoesNotExist(page: Page, link: string) {
await page.goto('/') // Required due to firefox: https://github.com/microsoft/playwright/issues/15781
await page.goto(link)
await expect(page.locator('main')).toContainText('note was not found or was already deleted')
}