This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): setup playwright testing (#52)
#### What this PR does / why we need it: For e2e testing.
- Loading branch information
Showing
15 changed files
with
219 additions
and
40 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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
tailwind.css | ||
tailwind.json | ||
tailwind.json | ||
playwright/ |
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,10 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('Detail', async () => { | ||
test('should go to /', async ({ page, baseURL }) => { | ||
await page.goto('/'); | ||
|
||
await page.getByTestId('GoToDetail').click(); | ||
await expect(page.getByTestId('DetailScreen')).toHaveText('Details Screen'); | ||
}); | ||
}); |
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,9 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('Example', async () => { | ||
test('should go to /', async ({ page, baseURL }) => { | ||
await page.goto('/'); | ||
await expect(page).toHaveURL(`${baseURL}/`); | ||
await expect(page.getByTestId('KeyChain')).toContainText('KeyChain'); | ||
}); | ||
}); |
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
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,55 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'app', | ||
testMatch: '*.e2e.ts', | ||
|
||
webServer: { | ||
command: 'yarn run start', | ||
// http://localhost:19000/ isn't reliable to determine if the server is ready. | ||
// However, AppEntry.bundle will only be available after the "Web Bundling complete" message. | ||
url: 'http://localhost:19000/AppEntry.bundle?platform=web&hot=false', | ||
reuseExistingServer: !process.env.CI, | ||
timeout: 180 * 1000, | ||
stdout: 'pipe', | ||
stderr: 'pipe', | ||
}, | ||
|
||
// Run all tests in parallel. | ||
fullyParallel: true, | ||
|
||
// Fail the build on CI if you accidentally left test.only in the source code. | ||
forbidOnly: !!process.env.CI, | ||
|
||
// Retry on CI only. | ||
retries: process.env.CI ? 1 : 0, | ||
|
||
// Opt out of parallel tests on CI. | ||
workers: process.env.CI ? 1 : undefined, | ||
|
||
outputDir: './playwright/test-results', | ||
|
||
// Reporter to use | ||
reporter: [ | ||
// For GitHub Actions CI to generate annotations | ||
['github'], | ||
['html', { outputFolder: './playwright/test-report' }], | ||
], | ||
|
||
use: { | ||
// Base URL to use in actions like `await page.goto('/')`. | ||
baseURL: 'http://localhost:19000', | ||
// Collect trace when retrying the failed test. | ||
trace: 'on', | ||
// equivalent to cypress: macbook-16 | ||
viewport: { width: 1200, height: 1200 }, | ||
video: 'on', | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
], | ||
}); |
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
module.exports = { | ||
extends: [ | ||
'universe', | ||
'universe/shared/typescript-analysis', | ||
'@stickyjs' | ||
], | ||
extends: ['universe', 'universe/shared/typescript-analysis', '@stickyjs'], | ||
rules: { | ||
'import/no-default-export': 'off', | ||
'@typescript-eslint/explicit-function-return-type': ['error', {allowExpressions: true}], | ||
} | ||
}; | ||
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.e2e.ts'], | ||
extends: ['prettier', 'plugin:playwright/playwright-test'], | ||
rules: { | ||
'unused-imports/no-unused-imports': 'error', | ||
'unused-imports/no-unused-vars': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
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