forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add smoke test for flight fixture (facebook#28350)
- Loading branch information
1 parent
0873658
commit 3357bea
Showing
6 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
# testing | ||
/coverage | ||
/playwright-report | ||
/test-results | ||
|
||
# production | ||
/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test('smoke test', async ({page}) => { | ||
const consoleErrors = []; | ||
page.on('console', msg => { | ||
const type = msg.type(); | ||
if (type === 'warn' || type === 'error') { | ||
consoleErrors.push({type: type, text: msg.text()}); | ||
} | ||
}); | ||
const pageErrors = []; | ||
page.on('pageerror', error => { | ||
pageErrors.push(error.stack); | ||
}); | ||
await page.goto('/'); | ||
await expect(page.locator('h1')).toHaveText('Hello World'); | ||
|
||
await expect(consoleErrors).toEqual([]); | ||
await expect(pageErrors).toEqual([]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {defineConfig, devices} from '@playwright/test'; | ||
|
||
const isCI = Boolean(process.env.CI); | ||
|
||
export default defineConfig({ | ||
// relative to this configuration file. | ||
testDir: '__tests__/__e2e__', | ||
fullyParallel: true, | ||
// Fail the build on CI if you accidentally left test.only in the source code. | ||
forbidOnly: !isCI, | ||
retries: isCI ? 2 : 0, | ||
// Opt out of parallel tests on CI. | ||
workers: isCI ? 1 : undefined, | ||
reporter: 'html', | ||
use: { | ||
baseURL: 'http://localhost:3000', | ||
|
||
trace: 'on-first-retry', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: {...devices['Desktop Chrome']}, | ||
}, | ||
], | ||
webServer: { | ||
command: 'FAST_REFRESH=false yarn dev', | ||
url: 'http://localhost:3000', | ||
reuseExistingServer: !isCI, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters