test: add E2E testing to main site
This commit is contained in:
parent
810d994688
commit
296be0e5b2
5 changed files with 84 additions and 0 deletions
3
apps/main/.gitignore
vendored
3
apps/main/.gitignore
vendored
|
@ -1,2 +1,5 @@
|
||||||
static/skills.svg
|
static/skills.svg
|
||||||
static/resume.pdf
|
static/resume.pdf
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/test-results
|
||||||
|
|
12
apps/main/e2e/title.spec.ts
Normal file
12
apps/main/e2e/title.spec.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { expect, test } from "@playwright/test"
|
||||||
|
|
||||||
|
const prefix = "developomp | "
|
||||||
|
|
||||||
|
test("should have proper title", async ({ page }) => {
|
||||||
|
await page.goto("/")
|
||||||
|
expect(await page.title()).toEqual("developomp")
|
||||||
|
|
||||||
|
await page.goto("/404")
|
||||||
|
await page.waitForTimeout(1000)
|
||||||
|
expect(await page.title()).toEqual(`${prefix}Page Not Found`)
|
||||||
|
})
|
|
@ -6,7 +6,9 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"cp": "cp ../../packages/content/dist/skills.svg ../../packages/content/dist/resume.pdf static",
|
"cp": "cp ../../packages/content/dist/skills.svg ../../packages/content/dist/resume.pdf static",
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
"dev:headless": "vite dev --open false",
|
||||||
"build": "pnpm cp && vite build",
|
"build": "pnpm cp && vite build",
|
||||||
|
"test:e2e": "playwright test",
|
||||||
"clean": "rm -rf .turbo .svelte-kit build node_modules vite.config.ts.timestamp-*",
|
"clean": "rm -rf .turbo .svelte-kit build node_modules vite.config.ts.timestamp-*",
|
||||||
"lint": "eslint ."
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
|
@ -17,6 +19,7 @@
|
||||||
"@developomp-site/tailwind-config": "workspace:*",
|
"@developomp-site/tailwind-config": "workspace:*",
|
||||||
"@fontsource/noto-sans-kr": "^5.0.5",
|
"@fontsource/noto-sans-kr": "^5.0.5",
|
||||||
"@inqling/svelte-icons": "^3.3.2",
|
"@inqling/svelte-icons": "^3.3.2",
|
||||||
|
"@playwright/test": "^1.36.2",
|
||||||
"@sveltejs/adapter-static": "^2.0.2",
|
"@sveltejs/adapter-static": "^2.0.2",
|
||||||
"@sveltejs/kit": "^1.22.1",
|
"@sveltejs/kit": "^1.22.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
||||||
|
|
63
apps/main/playwright.config.ts
Normal file
63
apps/main/playwright.config.ts
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
import { devices, PlaywrightTestConfig } from "@playwright/test"
|
||||||
|
|
||||||
|
const baseURL = "http://localhost:5173"
|
||||||
|
|
||||||
|
// Reference: https://playwright.dev/docs/test-configuration
|
||||||
|
const config: PlaywrightTestConfig = {
|
||||||
|
// Timeout per test
|
||||||
|
timeout: 30 * 1000,
|
||||||
|
|
||||||
|
// Test directory
|
||||||
|
testDir: "e2e",
|
||||||
|
|
||||||
|
// Artifacts folder where screenshots, videos, and traces are stored.
|
||||||
|
outputDir: "test-results/",
|
||||||
|
|
||||||
|
// Run your local dev server before starting the tests:
|
||||||
|
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
|
||||||
|
webServer: {
|
||||||
|
command: "pnpm dev:headless",
|
||||||
|
url: baseURL,
|
||||||
|
timeout: 120 * 1000,
|
||||||
|
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||||
|
reuseExistingServer: !process.env.CI,
|
||||||
|
},
|
||||||
|
|
||||||
|
use: {
|
||||||
|
// Use baseURL so to make navigations relative.
|
||||||
|
// More information: https://playwright.dev/docs/api/class-testoptions#test-options-base-url
|
||||||
|
baseURL,
|
||||||
|
|
||||||
|
// Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc.
|
||||||
|
// More information: https://playwright.dev/docs/trace-viewer
|
||||||
|
trace: "retry-with-trace",
|
||||||
|
|
||||||
|
// All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context
|
||||||
|
// contextOptions: {
|
||||||
|
// ignoreHTTPSErrors: true,
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "Desktop Chrome",
|
||||||
|
use: {
|
||||||
|
...devices["Desktop Chrome"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Desktop Firefox",
|
||||||
|
use: {
|
||||||
|
...devices["Desktop Firefox"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Mobile Chrome",
|
||||||
|
use: {
|
||||||
|
...devices["Pixel 5"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
|
@ -155,6 +155,9 @@ importers:
|
||||||
'@inqling/svelte-icons':
|
'@inqling/svelte-icons':
|
||||||
specifier: ^3.3.2
|
specifier: ^3.3.2
|
||||||
version: 3.3.2(svelte@4.0.5)
|
version: 3.3.2(svelte@4.0.5)
|
||||||
|
'@playwright/test':
|
||||||
|
specifier: ^1.36.2
|
||||||
|
version: 1.36.2
|
||||||
'@sveltejs/adapter-static':
|
'@sveltejs/adapter-static':
|
||||||
specifier: ^2.0.2
|
specifier: ^2.0.2
|
||||||
version: 2.0.2(@sveltejs/kit@1.22.1)
|
version: 2.0.2(@sveltejs/kit@1.22.1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue