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

chore: upgrade playwright example #53584

Merged
merged 5 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 4 additions & 2 deletions examples/with-playwright/e2e/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ test('should navigate to the about page', async ({ page }) => {
// Start from the index page (the baseURL is set via the webServer in the playwright.config.ts)
await page.goto('/')
// Find an element with the text 'About Page' and click on it
await page.click('text=About Page')
await page.getByText('About Page').click()
// The new url should be "/about" (baseURL is used there)
await expect(page).toHaveURL('/about')
// The new page should contain an h1 with "About Page"
await expect(page.locator('h1')).toContainText('About Page')
await expect(page.getByRole('heading', { level: 1 })).toContainText(
'About Page'
)
})
2 changes: 1 addition & 1 deletion examples/with-playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"react-dom": "18.2.0"
},
"devDependencies": {
"@playwright/test": "^1.15.0"
"@playwright/test": "^1.36.2"
}
}
7 changes: 3 additions & 4 deletions examples/with-playwright/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PlaywrightTestConfig, devices } from '@playwright/test'
import { defineConfig, devices } from '@playwright/test'
import path from 'path'

// Use process.env.PORT by default and fallback to port 3000
Expand All @@ -8,7 +8,7 @@ const PORT = process.env.PORT || 3000
const baseURL = `http://localhost:${PORT}`

// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
export default defineConfig({
// Timeout per test
timeout: 30 * 1000,
// Test directory
Expand Down Expand Up @@ -73,5 +73,4 @@ const config: PlaywrightTestConfig = {
use: devices['iPhone 12'],
},
],
}
export default config
})