-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add option to create tests with Playwright #4056
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
Changes from 5 commits
39363e7
42a13f7
d70a82b
2f8c846
ab5e9b6
e39a1eb
9e3c8ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'create-svelte': patch | ||
--- | ||
|
||
Add option to create integration tests with Playwright |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('about page has expected h1', async ({ page }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does playwrigt support writing your code in TypeScript? If yes, should we add a variant for TS users? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, playwright does support typescript ootb, down to the playwright config too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't seem to get it to work. I keep seeing errors like this:
Am I doing something obviously wrong, or should we add TypeScript stuff in a follow-up PR? |
||
await page.goto('/about'); | ||
expect(await page.textContent('h1')).toBe('About this app'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('index page has expected h1', async ({ page }) => { | ||
await page.goto('/'); | ||
expect(await page.textContent('h1')).toBe('Welcome to SvelteKit'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"devDependencies": { | ||
"@playwright/test": "^1.19.1" | ||
}, | ||
"scripts": { | ||
"test": "playwright test" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** @type {import('@playwright/test').PlaywrightTestConfig} */ | ||
const config = { | ||
webServer: { | ||
command: 'npm run build && npm run preview', | ||
port: 3000 | ||
} | ||
}; | ||
|
||
export default config; |
Uh oh!
There was an error while loading. Please reload this page.