Skip to content

Commit

Permalink
chore: upgrade playwright example (#53584)
Browse files Browse the repository at this point in the history
Co-authored-by: Balázs Orbán <[email protected]>
  • Loading branch information
sand4rt and balazsorban44 authored Sep 4, 2023
1 parent 95e33c4 commit be3a7e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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
})

0 comments on commit be3a7e4

Please sign in to comment.