Skip to content

Commit 93987fa

Browse files
Merge pull request storybookjs#32089 from storybookjs/yann/increase-e2e-dev-coverage
Build: Testing more e2e-dev instead of e2e build
2 parents d6d2191 + 0dcb1d4 commit 93987fa

File tree

5 files changed

+73
-60
lines changed

5 files changed

+73
-60
lines changed

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -951,11 +951,11 @@ workflows:
951951
requires:
952952
- create-sandboxes
953953
- e2e-production:
954-
parallelism: 25
954+
parallelism: 7
955955
requires:
956956
- create-sandboxes
957957
- e2e-dev:
958-
parallelism: 1
958+
parallelism: 25
959959
requires:
960960
- create-sandboxes
961961
- test-runner-production:
@@ -1040,11 +1040,11 @@ workflows:
10401040
requires:
10411041
- create-sandboxes
10421042
- e2e-production:
1043-
parallelism: 12
1043+
parallelism: 6
10441044
requires:
10451045
- create-sandboxes
10461046
- e2e-dev:
1047-
parallelism: 1
1047+
parallelism: 12
10481048
requires:
10491049
- create-sandboxes
10501050
- test-runner-production:
@@ -1110,11 +1110,11 @@ workflows:
11101110
requires:
11111111
- create-sandboxes
11121112
- e2e-production:
1113-
parallelism: 8
1113+
parallelism: 6
11141114
requires:
11151115
- create-sandboxes
11161116
- e2e-dev:
1117-
parallelism: 1
1117+
parallelism: 8
11181118
requires:
11191119
- create-sandboxes
11201120
- test-runner-production:

code/e2e-tests/addon-onboarding.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import { expect, test } from '@playwright/test';
22
import process from 'process';
33

4-
import { SbPage } from './util';
4+
import { SbPage, hasOnboardingFeature } from './util';
55

66
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
77
const templateName = process.env.STORYBOOK_TEMPLATE_NAME || '';
88
const type = process.env.STORYBOOK_TYPE || 'dev';
99

10-
const supportsOnboarding =
11-
templateName.includes('react') ||
12-
templateName.includes('vue3') ||
13-
templateName.includes('angular') ||
14-
templateName.includes('next');
15-
1610
test.describe('addon-onboarding', () => {
1711
test.skip(type === 'build', `Skipping addon tests for production Storybooks`);
1812
test.skip(
19-
!supportsOnboarding,
13+
!hasOnboardingFeature(templateName),
2014
`Skipping ${templateName}, which does not have addon-onboarding set up.`
2115
);
2216
test('the onboarding flow', async ({ page }) => {

code/e2e-tests/module-mocking.spec.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,24 @@ test.describe('module-mocking', () => {
3333
'9 - [from meta afterEach]',
3434
];
3535

36-
// Assert that each LI text content contains the expected text in order
37-
for (let i = 0; i < expectedTexts.length; i++) {
38-
const nthText = await logItem.locator(`li >> nth=${i}`).innerText();
39-
expect(nthText).toMatch(expectedTexts[i]);
36+
// Collect all logs in the panel but only check the order of the logs
37+
// we care about, disregarding any other logs that could appear in between
38+
const logItemsCount = await logItem.locator('li').count();
39+
const actualTexts = [];
40+
for (let i = 0; i < logItemsCount; i++) {
41+
actualTexts.push(await logItem.locator(`li >> nth=${i}`).innerText());
42+
}
43+
44+
let lastMatchIndex = -1;
45+
46+
for (const expected of expectedTexts) {
47+
const foundIndex = actualTexts.findIndex(
48+
(text, i) => i > lastMatchIndex && text.includes(expected)
49+
);
50+
expect(foundIndex, `Expected log "${expected}" to appear in order`).toBeGreaterThan(
51+
lastMatchIndex
52+
);
53+
lastMatchIndex = foundIndex;
4054
}
4155
});
4256

code/e2e-tests/util.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,8 @@ const templateName: keyof typeof allTemplates = process.env.STORYBOOK_TEMPLATE_N
207207
const templates = allTemplates;
208208
export const hasVitestIntegration =
209209
!templates[templateName]?.skipTasks?.includes('vitest-integration');
210+
211+
export const hasOnboardingFeature = (templateName: string) =>
212+
['@storybook/react', '@storybook/vue3', '@storybook/angular'].includes(
213+
templates[templateName as keyof typeof templates]?.expected.renderer
214+
);

0 commit comments

Comments
 (0)