Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add failing E2E test #531

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 46 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"author": "[email protected]",
"license": "MIT",
"devDependencies": {
"@playwright/test": "^1.38.1",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"documentation": "^13.2.5",
Expand Down Expand Up @@ -115,4 +116,4 @@
"volta": {
"node": "19.1.0"
}
}
}
39 changes: 34 additions & 5 deletions test/e2e/an-app/app.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
import { createDirname } from '../../../lib/buildtime/utils.js'
import { getExamplesPath, runViteDev } from '../../utils.js'
import { runViteDev } from '../../utils.js'

import { expect } from '@playwright/test'

const __dirname = createDirname(import.meta)

beforeAll(() => page.setDefaultTimeout(25000))

const { kill, port } = await runViteDev(`${__dirname}/app`)

afterAll(async () => {
await kill()
})

test('should see starter front page', async () => {
const { kill, port } = await runViteDev(`${__dirname}/app`)
await page.goto(`http://localhost:${port}`)
const result = await page.waitForSelector('h1')
expect(result).toBeTruthy()
await kill()
await expect(page.getByText('Hello world')).toBeVisible()
})

test('should see default module', async () => {
await page.goto(`http://localhost:${port}/composition`)
await expect(page.getByText('Default module')).toBeVisible()
})

test('should see reset module', async () => {
await page.goto(`http://localhost:${port}/composition/reset`)
await expect(page.getByText('Default module')).not.toBeVisible()
})

test('should see prepended module', async () => {
await page.goto(`http://localhost:${port}/composition/prepend`)
await expect(page.getByText('Default module')).toBeVisible()
await expect(page.getByText('Custom module')).toBeVisible()
})

test('should see replaced module', async () => {
await page.goto(`http://localhost:${port}/composition/replace`)
await page.getByText('Hello world - composition')
await expect(page.getByText('Default module')).not.toBeVisible()
await expect(page.getByText('Custom module')).toBeVisible()
})
2 changes: 1 addition & 1 deletion test/e2e/an-app/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "vite"
},
"devDependencies": {
"@roxi/routify": "file:../../../../../..",
"@roxi/routify": "file:../../../..",
"@sveltejs/vite-plugin-svelte": "^2.2.0",
"mdsvex": "^0.9.3",
"spank": "^2.0.0-12",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<h2>Custom module</h2>
<slot />
</div>
4 changes: 4 additions & 0 deletions test/e2e/an-app/app/src/routes/composition/_module.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<h2>Default module</h2>
<slot />
</div>
3 changes: 3 additions & 0 deletions test/e2e/an-app/app/src/routes/composition/index.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section class="hero">
<h1>Hello world - composition</h1>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section class="hero">
<h1>Hello world - composition</h1>
</section>
3 changes: 3 additions & 0 deletions test/e2e/an-app/app/src/routes/composition/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section class="hero">
<h1>Hello world - composition</h1>
</section>
3 changes: 3 additions & 0 deletions test/e2e/an-app/app/src/routes/composition/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section class="hero">
<h1>Hello world - composition</h1>
</section>
Loading