-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
113 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
node_modules | ||
npm-debug.log | ||
|
||
# env | ||
.env | ||
|
||
# tests | ||
test-results | ||
playwright-report | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,51 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
import config from './playwright.config'; | ||
import dotenv from 'dotenv'; | ||
|
||
// Define environment on the dev box in .env file: | ||
// .env: | ||
// PLAYWRIGHT_SERVICE_ACCESS_TOKEN=XXX | ||
// PLAYWRIGHT_SERVICE_URL=XXX | ||
|
||
// Define environment in your GitHub workflow spec. | ||
// env: | ||
// PLAYWRIGHT_SERVICE_ACCESS_TOKEN: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_TOKEN }} | ||
// PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }} | ||
// PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }} | ||
|
||
dotenv.config(); | ||
|
||
// Name the test run if it's not named yet. | ||
process.env.PLAYWRIGHT_SERVICE_RUN_ID = process.env.PLAYWRIGHT_SERVICE_RUN_ID || new Date().toISOString(); | ||
|
||
// Can be 'linux' or 'windows'. | ||
const os = process.env.PLAYWRIGHT_SERVICE_OS || 'linux'; | ||
|
||
export default defineConfig(config, { | ||
workers: 10, | ||
fullyParallel: true, | ||
|
||
// Enable screenshot testing and configure directory with expectations. | ||
// https://learn.microsoft.com/azure/playwright-testing/how-to-configure-visual-comparisons | ||
ignoreSnapshots: true, | ||
snapshotPathTemplate: `{testDir}/__screenshots__/{testFilePath}/${os}/{arg}{ext}`, | ||
|
||
use: { | ||
// Specify the service endpoint. | ||
connectOptions: { | ||
wsEndpoint: `${process.env.PLAYWRIGHT_SERVICE_URL}?cap=${JSON.stringify({ | ||
// Can be 'linux' or 'windows'. | ||
os, | ||
runId: process.env.PLAYWRIGHT_SERVICE_RUN_ID | ||
})}`, | ||
timeout: 30000, | ||
headers: { | ||
'x-mpt-access-key': process.env.PLAYWRIGHT_SERVICE_ACCESS_TOKEN! | ||
}, | ||
// Allow service to access the localhost. | ||
exposeNetwork: '<loopback>' | ||
} | ||
}, | ||
// Tenmp workaround for config merge bug in OSS https://github.com/microsoft/playwright/pull/28224 | ||
projects: config.projects? config.projects : [{}] | ||
}); |