testing
This commit is contained in:
parent
c7088a8b43
commit
ce07ca8b0d
|
@ -27,7 +27,7 @@ jobs:
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
run: npx playwright install --with-deps
|
run: npx playwright install --with-deps
|
||||||
- name: Run your tests
|
- name: Run your tests
|
||||||
run: npm test
|
run: pnpm run test
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|
|
@ -9,3 +9,6 @@ node_modules
|
||||||
/build
|
/build
|
||||||
/functions
|
/functions
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
General
|
||||||
|
test-results
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "svelte-kit preview",
|
"preview": "vite preview --port 3000",
|
||||||
"check": "svelte-check --tsconfig tsconfig.json",
|
"check": "svelte-check --tsconfig tsconfig.json",
|
||||||
"licenses": "license-checker --summary > licenses.csv",
|
"licenses": "license-checker --summary > licenses.csv",
|
||||||
"locale:download": "node scripts/locale.js"
|
"locale:download": "node scripts/locale.js"
|
||||||
|
|
|
@ -5,9 +5,14 @@
|
||||||
"dev:front": "pnpm --prefix frontend run dev",
|
"dev:front": "pnpm --prefix frontend run dev",
|
||||||
"dev:proxy": "node proxy.mjs",
|
"dev:proxy": "node proxy.mjs",
|
||||||
"dev": "run-p dev:*",
|
"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": "run-p ci:prepare:*",
|
||||||
"ci:prepare:backend": "cd backend && cargo build",
|
"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": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.23.4",
|
"@playwright/test": "^1.23.4",
|
||||||
|
|
|
@ -1,18 +1,25 @@
|
||||||
import type { PlaywrightTestConfig } from '@playwright/test'
|
import { devices, type PlaywrightTestConfig } from '@playwright/test'
|
||||||
|
|
||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
use: {
|
use: {
|
||||||
video: 'on-first-retry',
|
video: 'retain-on-failure',
|
||||||
baseURL: 'http://localhost:1234',
|
baseURL: 'http://localhost:1234',
|
||||||
actionTimeout: 3_000,
|
// actionTimeout: 10_000,
|
||||||
},
|
},
|
||||||
|
outputDir: './test-results',
|
||||||
testDir: './test',
|
testDir: './test',
|
||||||
testMatch: /.*\.ts/,
|
testMatch: /.*\.ts/,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'pnpm run dev',
|
command: 'pnpm run ci:server',
|
||||||
port: 1234,
|
port: 1234,
|
||||||
reuseExistingServer: true,
|
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
|
export default config
|
||||||
|
|
|
@ -18,6 +18,7 @@ async function checkLinkForText(page: Page, link: string, text: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkLinkDoesNotExist(page: Page, link: 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 page.goto(link)
|
||||||
await expect(page.locator('main')).toContainText('note was not found or was already deleted')
|
await expect(page.locator('main')).toContainText('note was not found or was already deleted')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue