Skip to content
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

Core: Testing Module UI improvements #30773

Draft
wants to merge 8 commits into
base: next
Choose a base branch
from
2 changes: 1 addition & 1 deletion code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"devDependencies": {
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"@testing-library/react": "^14.0.0",
"execa": "^9.5.2",
"picocolors": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.7.3"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"devDependencies": {
"@storybook/blocks": "workspace:*",
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion code/addons/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"devDependencies": {
"@devtools-ds/object-inspector": "^1.1.2",
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.4.0",
"@types/node": "^22.0.0",
"ansi-to-html": "^0.7.2",
"formik": "^2.2.9",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"upath": "^2.0.1"
},
"devDependencies": {
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-resize-detector": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/measure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"tiny-invariant": "^1.3.1"
},
"devDependencies": {
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.7.3"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"@neoconfetti/react": "^1.0.0",
"@radix-ui/react-dialog": "^1.0.5",
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"@storybook/react": "workspace:*",
"framer-motion": "^11.0.3",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/outline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.7.3"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
},
"dependencies": {
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.12",
"@storybook/icons": "^1.4.0",
"@storybook/test": "workspace:*",
"polished": "^4.2.2",
"prompts": "^2.4.0",
Expand Down
17 changes: 16 additions & 1 deletion code/addons/test/src/components/TestProviderRender.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react';

import type { TestProviderConfig, TestProviderState } from 'storybook/internal/core-events';
import { ManagerContext } from 'storybook/internal/manager-api';
import { ManagerContext, addons } from 'storybook/internal/manager-api';
import { styled } from 'storybook/internal/theming';
import { Addon_TypesEnum } from 'storybook/internal/types';

import type { Meta, StoryObj } from '@storybook/react';
import { expect, fn } from '@storybook/test';

import { ADDON_ID as A11Y_ADDON_ID } from '../../../a11y/src/constants';
import { type Details, storeOptions } from '../constants';
import { store as mockStore } from '../manager-store.mock';
import { TestProviderRender } from './TestProviderRender';
Expand Down Expand Up @@ -100,6 +101,7 @@ export default {
layout: 'fullscreen',
},
beforeEach: async () => {
addons.register(A11Y_ADDON_ID, () => {});
return () => {
mockStore.setState(storeOptions.initialState);
};
Expand Down Expand Up @@ -137,7 +139,18 @@ export const Watching: Story = {
},
};

export const CoverageEnabled: Story = {
args: Default.args,
beforeEach: async () => {
mockStore.setState({
...storeOptions.initialState,
config: { ...storeOptions.initialState.config, coverage: true },
});
},
};

export const WithCoverageNegative: Story = {
...CoverageEnabled,
args: {
state: {
...config,
Expand All @@ -154,6 +167,7 @@ export const WithCoverageNegative: Story = {
};

export const WithCoverageWarning: Story = {
...CoverageEnabled,
args: {
state: {
...config,
Expand All @@ -170,6 +184,7 @@ export const WithCoverageWarning: Story = {
};

export const WithCoveragePositive: Story = {
...CoverageEnabled,
args: {
state: {
...config,
Expand Down
Loading