-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
CI: Add internal Storybook E2E job #35052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cd98d39
CI: Add internal Storybook E2E job and smoke test
ndelangen 4c920f7
Rename code/e2e-tests to e2e-sandbox
ndelangen b3759c1
Address PR review: gate internal Playwright project
cursoragent df4c926
Split internal Playwright config from sandbox config
cursoragent b14a360
Move internal Playwright config into e2e-internal
cursoragent 37a0b56
Merge branch 'next' into ci/internal-storybook-e2e
ndelangen 70fbce5
Drop redundant --project flag for internal e2e
cursoragent eb6ff1a
Address review: restore sandbox testDir, document e2e-internal
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,25 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import process from 'process'; | ||
|
|
||
| /** | ||
| * Smoke tests for the internal Storybook UI (`code/.storybook`), not sandbox templates. | ||
| * | ||
| * Run locally (from repo root) with internal Storybook on port 6006: | ||
| * cd code && yarn storybook:ui | ||
| * yarn task e2e-tests-internal --no-link -s e2e-tests-internal | ||
| */ | ||
|
|
||
| const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:6006'; | ||
|
|
||
| /** Stable core template story shipped with the internal UI. */ | ||
| const STORY_PATH = '/story/core-basics--basic'; | ||
|
|
||
| test.describe('internal Storybook UI', () => { | ||
| test('loads a story in the preview iframe', async ({ page }) => { | ||
| await page.goto(`${storybookUrl}/?path=${STORY_PATH}`); | ||
| await expect(page.locator('#storybook-preview-iframe')).toBeVisible(); | ||
|
|
||
| const preview = page.frameLocator('#storybook-preview-iframe'); | ||
| await expect(preview.getByRole('button', { name: 'Click Me!' })).toBeVisible(); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
| import waitOn from 'wait-on'; | ||
|
|
||
| import type { Task } from '../task.ts'; | ||
| import { exec } from '../utils/exec.ts'; | ||
|
|
||
| const STORYBOOK_PORT = 6006; | ||
|
|
||
| export const e2eTestsInternal: Task = { | ||
| description: 'Run e2e tests against the internal Storybook UI (code/.storybook)', | ||
| dependsOn: ['compile'], | ||
| junit: true, | ||
| async ready() { | ||
| return false; | ||
| }, | ||
| async run({ codeDir, junitFilename }, { dryRun, debug }) { | ||
| const storybookUrl = `http://localhost:${STORYBOOK_PORT}`; | ||
|
|
||
| await waitOn({ | ||
| resources: [`${storybookUrl}/index.json`], | ||
| interval: 16, | ||
| timeout: 300_000, | ||
| }); | ||
|
|
||
|
cursor[bot] marked this conversation as resolved.
|
||
| await exec( | ||
| 'yarn playwright test --project=internal-storybook', | ||
| { | ||
| env: { | ||
| CI: 'true', | ||
| STORYBOOK_URL: storybookUrl, | ||
| ...(junitFilename && { | ||
| PLAYWRIGHT_JUNIT_OUTPUT_NAME: junitFilename, | ||
| }), | ||
| }, | ||
| cwd: codeDir, | ||
| }, | ||
| { dryRun, debug } | ||
| ); | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| }, | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.