Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ target/
fixture/
storybook-static/
playwright-report/
blob-report/
all-blob-reports/
41 changes: 37 additions & 4 deletions .github/workflows/pull_request_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,40 @@ jobs:
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

test_e2e_prepare_report:
needs: test_e2e
name: Prepare e2e's HTML report
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Download Playwright blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: all-blob-reports

- name: Merge Playwright blob reports into HTML Report
run: yarn run playwright:cmd:merge-reports --reporter html ./all-blob-reports

- name: Upload Playwright HTML report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report
retention-days: 30

analyze_bundle_size:
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
needs: changed_files
Expand Down Expand Up @@ -126,7 +160,7 @@ jobs:
- changed_files
- linters
- test
- test_e2e
- test_e2e_prepare_report
runs-on: ubuntu-latest
name: Report CI results
steps:
Expand All @@ -140,13 +174,12 @@ jobs:
with:
name: test-output

- name: Download Playwright Report artifact
# см. [Примечание 1]
- name: Download Playwright HTML report from GitHub Actions Artifacts
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
uses: actions/download-artifact@v3
with:
name: playwright-report
path: playwright-report/
path: playwright-report

- name: Upload Playwright Report
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
Expand Down
35 changes: 11 additions & 24 deletions .github/workflows/reusable_workflow_test_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ jobs:
# см. https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal
image: mcr.microsoft.com/playwright:v1.37.0-focal
options: --ipc=host
name: Run visual (aka e2e) tests
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]
name: 'Run e2e tests for (shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -56,30 +61,12 @@ jobs:

- name: Run e2e tests for @vkontakte/vkui workspace
# Почему HOME=/root см. https://github.com/microsoft/playwright/issues/6500
run: HOME=/root yarn run test:e2e:ci
run: HOME=/root yarn run test:e2e:ci --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

# TODO Playwright реализовать покрытие
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# flags: e2e-${{ matrix.browser }}-${{ matrix.platform }}-${{ matrix.appearance }}
# files: .nyc_output/coverage.json
# fail_ci_if_error: true

- name: Upload test artifact
uses: actions/upload-artifact@v3
- name: Upload Playwright blob report to GitHub Actions Artifacts
if: always()
with:
name: e2e-output
path: |
packages/vkui/__diff_output__/
packages/vkui/e2e-results.json

- name: Upload Playwright HTML report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: packages/vkui/playwright-report/
retention-days: 30
name: all-blob-reports
path: packages/vkui/blob-report
retention-days: 1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ lint-results.json
e2e-results.json
yarn-error.log
playwright-report/
blob-report/
all-blob-reports/

# Caches
.cache
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ target/
fixture/
storybook-static/
playwright-report/
blob-report/
all-blob-reports/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"prepare": "husky install",
"pre-commit": "lint-staged",
"playwright:install": "playwright install --with-deps",
"playwright:cmd:merge-reports": "playwright merge-reports",
"codesandbox:install": "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install",
"deduplicate": "yarn-deduplicate --list && yarn-deduplicate --fail"
},
Expand Down
13 changes: 6 additions & 7 deletions packages/vkui/playwright-ct.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const TS_CONFIG_ALIASES = Object.entries(tsconfig.compilerOptions.paths).reduce<
return aliases;
}, {});

const DEFAULT_REPORTERS: ReporterDescription[] = [
['html', { open: 'never' }],
['json', { outputFile: 'e2e-results.json' }],
];
const DEFAULT_REPORTERS: ReporterDescription[] = [['json', { outputFile: 'e2e-results.json' }]];

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down Expand Up @@ -56,16 +53,18 @@ export default defineConfig<VKUITestOptions>({
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: 0,
/* Limit the number of failures on CI to save resources. */
maxFailures: process.env.CI ? 10 : undefined,
/* Opt out of parallel tests on CI. */
workers: process.env.CI
? 4
? 1
: typeof process.env.PLAYWRIGHT_WORKERS === 'string'
? Number(process.env.PLAYWRIGHT_WORKERS)
: undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI
? [['github'], ['dot'], ...DEFAULT_REPORTERS]
: [['list'], ...DEFAULT_REPORTERS],
? [['github'], ['dot'], ['blob'], ...DEFAULT_REPORTERS]
: [['list'], ['html', { open: 'never' }], ...DEFAULT_REPORTERS],

/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
Expand Down