-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(egress-composite): screenshot/snapshot Playwright setup (#1023)
- Loading branch information
1 parent
bfe7bea
commit da140cb
Showing
24 changed files
with
666 additions
and
117 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Egress Composite E2E | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
paths: | ||
- 'sample-apps/react/egress-composite/**' | ||
- 'packages/client/**' | ||
- 'packages/react-sdk/**' | ||
- 'packages/styling/**' | ||
- 'packages/react-bindings/**' | ||
env: | ||
VITE_STREAM_API_KEY: ${{ vars.EGRESS_STREAM_API_KEY }} | ||
VITE_STREAM_USER_TOKEN: ${{ secrets.EGRESS_USER_TOKEN }} | ||
STREAM_SDK_TEST_APP: ${{ secrets.STREAM_SDK_TEST_APP }} | ||
STREAM_SDK_TEST_ACCOUNT_EMAIL: ${{ secrets.STREAM_SDK_TEST_ACCOUNT_EMAIL }} | ||
STREAM_SDK_TEST_ACCOUNT_PASSWORD: ${{ secrets.STREAM_SDK_TEST_ACCOUNT_PASSWORD }} | ||
STREAM_SDK_TEST_ACCOUNT_OTP_SECRET: ${{ secrets.STREAM_SDK_TEST_ACCOUNT_OTP_SECRET }} | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: 'yarn' | ||
cache-dependency-path: 'yarn.lock' | ||
|
||
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Build packages | ||
env: | ||
NODE_ENV: production | ||
run: yarn build:react:deps | ||
|
||
- name: Cache Playwright browsers | ||
uses: actions/cache@v3 | ||
id: playwright-cache | ||
with: | ||
path: ~/.cache/ms-playwright | ||
key: ${{ runner.os }}${{ runner.arch }}-playwright-browsers | ||
|
||
- name: Install Playwright browsers if not cached | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
run: npx playwright install chromium | ||
|
||
- name: Install Playwright system dependencies (always) | ||
run: npx playwright install-deps | ||
|
||
- name: Run Playwright tests | ||
working-directory: sample-apps/react/egress-composite | ||
run: yarn buddy auth && yarn test:e2e |
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 |
---|---|---|
|
@@ -23,3 +23,6 @@ dist-ssr | |
*.sln | ||
*.sw? | ||
.vercel | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
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,42 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
fullyParallel: true, | ||
retries: process.env.CI ? 2 : 0, | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: 'list', | ||
// custom path to omit architecture/system from file name (darwin-amd64/darwin-arm64/linux-amd64...) | ||
snapshotPathTemplate: './tests/__screenshots__/{testFilePath}/{arg}{ext}', | ||
expect: { | ||
toHaveScreenshot: { | ||
// to account for CI headless | ||
maxDiffPixelRatio: 0.05, | ||
}, | ||
}, | ||
use: { | ||
headless: !!process.env.CI, | ||
trace: 'on-first-retry', | ||
viewport: { width: 1920, height: 1080 }, | ||
baseURL: 'http://localhost:5173', | ||
// TODO: find out why custom data-test-id does not work | ||
// testIdAttribute: 'data-testid', | ||
}, | ||
webServer: [ | ||
{ | ||
timeout: 10000, | ||
command: 'yarn buddy server --port 4567', | ||
reuseExistingServer: false, | ||
port: 4567, | ||
}, | ||
{ | ||
timeout: 10000, | ||
command: 'yarn dev', | ||
reuseExistingServer: false, | ||
port: 5173, | ||
}, | ||
], | ||
}); |
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
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,3 @@ | ||
export * from './useExternalCSS'; | ||
export * from './useNotifyEgress'; | ||
export * from './useInitializeClient'; |
Oops, something went wrong.