Skip to content

Commit b6af29b

Browse files
authored
ci: isolate performance tests in separate job (#477)
1 parent 9366ba3 commit b6af29b

11 files changed

+59
-11
lines changed

.github/workflows/pr-visual-tests-report.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ jobs:
3838
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
3939
AWS_DEFAULT_REGION: ru-central1
4040
AWS_EC2_METADATA_DISABLED: true
41-
run: aws s3 cp playwright-report s3://playwright-reports/charts/pulls/${{ steps.pr.outputs.id}}/ --endpoint-url=https://storage.yandexcloud.net --recursive
41+
run: |
42+
aws s3 cp playwright-report s3://playwright-reports/charts/pulls/${{ steps.pr.outputs.id }}/ --endpoint-url=https://storage.yandexcloud.net --recursive
43+
if [ -d playwright-report-perf ]; then
44+
aws s3 cp playwright-report-perf s3://playwright-reports/charts/pulls/${{ steps.pr.outputs.id }}/perf/ --endpoint-url=https://storage.yandexcloud.net --recursive
45+
fi
4246
shell: bash
4347
- name: Create Comment
4448
uses: marocchino/sticky-pull-request-comment@v2
4549
with:
4650
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
4751
number: ${{ steps.pr.outputs.id }}
4852
header: visual tests report
49-
message: '[Visual Tests Report](https://storage.yandexcloud.net/playwright-reports/charts/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.'
53+
message: |
54+
[Visual Tests Report](https://storage.yandexcloud.net/playwright-reports/charts/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.
55+
[Performance Tests Report](https://storage.yandexcloud.net/playwright-reports/charts/pulls/${{ steps.pr.outputs.id }}/perf/index.html) is ready.

.github/workflows/pr-visual-tests.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install Packages
1515
run: npm ci
1616
- name: Run Visual Tests
17-
run: npm run playwright
17+
run: npm run playwright:visual
1818
env:
1919
CI: 'true'
2020
- name: Upload Playwright Report
@@ -36,3 +36,24 @@ jobs:
3636
with:
3737
name: pr
3838
path: ./pr-id.txt
39+
40+
visual_tests_perf:
41+
name: Visual Tests (Performance)
42+
runs-on: ubuntu-latest
43+
container:
44+
image: mcr.microsoft.com/playwright:v1.56.1-jammy
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Install Packages
48+
run: npm ci
49+
- name: Run Performance Tests
50+
run: npm run playwright:perf
51+
env:
52+
CI: 'true'
53+
- name: Upload Playwright Report
54+
if: always()
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: playwright-report-perf
58+
path: ./playwright-report
59+
retention-days: 1

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"docs:build": "cd ./docs && npm run docs:build",
5858
"playwright:install": "playwright install chromium webkit --with-deps",
5959
"playwright": "playwright test --config=playwright/playwright.config.ts",
60+
"playwright:visual": "playwright test --project=chromium --project=webkit --config=playwright/playwright.config.ts",
61+
"playwright:perf": "playwright test --project=chromium-perf --workers=1 --no-deps --config=playwright/playwright.config.ts",
6062
"playwright:update": "npm run playwright -- -u",
6163
"playwright:clear-cache": "rm -rf ./playwright/.cache",
6264
"playwright:docker": "./scripts/playwright-docker.sh 'npm run playwright'",

playwright/playwright.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ const config: PlaywrightTestConfig = {
6666
ignoreDefaultArgs: ['--hide-scrollbars'],
6767
},
6868
},
69+
grepInvert: /@perf/,
70+
},
71+
{
72+
name: 'chromium-perf',
73+
use: {
74+
...devices['Desktop Chrome'],
75+
deviceScaleFactor: 2,
76+
launchOptions: {
77+
ignoreDefaultArgs: ['--hide-scrollbars'],
78+
},
79+
},
80+
grep: /@perf/,
81+
workers: 1,
6982
},
7083
{
7184
name: 'webkit',

src/__tests__/area-series.visual.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ test.describe('Area series', () => {
403403
await expect(component.locator('svg')).toHaveScreenshot();
404404
});
405405

406-
test('Markers should not degrade render performance on large datasets', async ({mount}) => {
406+
test('Markers should not degrade render performance on large datasets @perf', async ({
407+
mount,
408+
}) => {
407409
test.setTimeout(120_000);
408410

409411
const pointCount = 25000;

src/__tests__/bar-y-series.visual.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ test.describe('Bar-y series', () => {
523523
await expect(component.locator('svg')).toHaveScreenshot();
524524
});
525525

526-
test('Performance', async ({mount}) => {
526+
test('Performance @perf', async ({mount}) => {
527527
test.setTimeout(120_000);
528528

529529
const categories = new Array(3000).fill(null).map((_, i) => String(i));

src/__tests__/line-series.visual.test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,9 @@ test.describe('Line series', () => {
438438
await expect(component.locator('svg')).toHaveScreenshot();
439439
});
440440

441-
test('Initial render should not degrade performance on large datasets', async ({mount}) => {
441+
test('Initial render should not degrade performance on large datasets @perf', async ({
442+
mount,
443+
}) => {
442444
test.setTimeout(120_000);
443445

444446
const categories = new Array(10000).fill(null).map((_, i) => String(i));
@@ -489,7 +491,9 @@ test.describe('Line series', () => {
489491
expect(median(widgetRenderTimes)).toBeLessThan(1100);
490492
});
491493

492-
test('Markers should not degrade render performance on large datasets', async ({mount}) => {
494+
test('Markers should not degrade render performance on large datasets @perf', async ({
495+
mount,
496+
}) => {
493497
test.setTimeout(120_000);
494498

495499
const pointCount = 25000;

src/__tests__/pie-series.visual.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ test.describe('Pie series', () => {
511511
await expect(component.locator('svg')).toHaveScreenshot();
512512
});
513513

514-
test('Performance', async ({mount}) => {
514+
test('Performance @perf', async ({mount}) => {
515515
test.setTimeout(120_000);
516516

517517
const items = new Array(1000).fill(null).map(() => ({

src/__tests__/treemap.visual.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ test.describe('Treemap series', () => {
181181
await expect(chart.locator('svg')).toHaveScreenshot();
182182
});
183183

184-
test('Performance', async ({mount}) => {
184+
test('Performance @perf', async ({mount}) => {
185185
test.setTimeout(120_000);
186186

187187
const items = new Array(1000).fill(null).map(() => ({

src/__tests__/x-axis.visual.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ test.describe('X-axis', () => {
389389
});
390390
});
391391

392-
test.describe('Performance', () => {
392+
test.describe('Performance @perf', () => {
393393
test('Long category labels', async ({mount}) => {
394394
test.setTimeout(120_000);
395395

0 commit comments

Comments
 (0)