-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27358 from storybookjs/shilman/27352-fix-tags-com…
…position Tags: Fix composition with older storybooks
- Loading branch information
Showing
16 changed files
with
278 additions
and
125 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,43 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { SbPage } from './util'; | ||
|
||
const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:6006'; | ||
|
||
// This is a slow test, and (presumably) framework independent, so only run it on one sandbox | ||
const skipTest = process.env.STORYBOOK_TEMPLATE_NAME !== 'react-vite/default-ts'; | ||
|
||
test.describe('composition', () => { | ||
test.beforeEach(async ({ page }) => { | ||
if (skipTest) return; | ||
await page.goto(storybookUrl); | ||
await new SbPage(page).waitUntilLoaded(); | ||
}); | ||
|
||
test('should correctly filter composed stories', async ({ page }) => { | ||
if (skipTest) return; | ||
|
||
// Expect that composed Storybooks are visible | ||
await expect(await page.getByTitle('Storybook 8.0.0')).toBeVisible(); | ||
await expect(await page.getByTitle('Storybook 7.6.18')).toBeVisible(); | ||
|
||
// Expect composed stories to be available in the sidebar | ||
await page.locator('[id="storybook\\@8\\.0\\.0_components-badge"]').click(); | ||
await expect( | ||
await page.locator('[id="storybook\\@8\\.0\\.0_components-badge--default"]') | ||
).toBeVisible(); | ||
|
||
await page.locator('[id="storybook\\@7\\.6\\.18_components-badge"]').click(); | ||
await expect( | ||
await page.locator('[id="storybook\\@7\\.6\\.18_components-badge--default"]') | ||
).toBeVisible(); | ||
|
||
// Expect composed stories `to be available in the search | ||
await page.getByPlaceholder('Find components').fill('Button'); | ||
await expect( | ||
await page.getByRole('option', { name: 'Button Storybook 8.0.0 / @blocks / examples' }) | ||
).toBeVisible(); | ||
await expect( | ||
await page.getByRole('option', { name: 'Button Storybook 7.6.18 / @blocks / examples' }) | ||
).toBeVisible(); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -592,7 +592,7 @@ export class StoryIndexGenerator { | |
); | ||
|
||
this.lastIndex = { | ||
v: 4, | ||
v: 5, | ||
entries: sorted, | ||
}; | ||
|
||
|
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 |
---|---|---|
|
@@ -263,7 +263,7 @@ describe('useStoriesJson', () => { | |
"type": "story", | ||
}, | ||
}, | ||
"v": 4, | ||
"v": 5, | ||
} | ||
`); | ||
}, 20_000); | ||
|
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
Oops, something went wrong.