Skip to content

Commit 58e1f23

Browse files
authored
feat(storybook): interaction testing init generator (#18051)
1 parent c364207 commit 58e1f23

File tree

24 files changed

+256
-115
lines changed

24 files changed

+256
-115
lines changed

docs/generated/packages/angular/generators/storybook-configuration.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
"x-dropdown": "projects",
1919
"x-priority": "important"
2020
},
21+
"interactionTests": {
22+
"type": "boolean",
23+
"description": "Set up Storybook interaction tests.",
24+
"x-prompt": "Do you want to set up Storybook interaction tests?",
25+
"alias": ["configureTestRunner"],
26+
"x-priority": "important",
27+
"default": true
28+
},
2129
"configureCypress": {
2230
"type": "boolean",
2331
"description": "Specifies whether to configure Cypress or not.",
24-
"x-prompt": "Configure a Cypress e2e app to run against the storybook instance?",
25-
"default": true,
26-
"x-priority": "important"
32+
"x-deprecated": "Please use Storybook interaction tests instead."
2733
},
2834
"generateStories": {
2935
"type": "boolean",
@@ -35,9 +41,7 @@
3541
"generateCypressSpecs": {
3642
"type": "boolean",
3743
"description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
38-
"x-prompt": "Automatically generate test files in the generated Cypress e2e app?",
39-
"default": true,
40-
"x-priority": "important"
44+
"x-deprecated": "Please use Storybook interaction tests instead."
4145
},
4246
"configureStaticServe": {
4347
"type": "boolean",
@@ -48,7 +52,8 @@
4852
},
4953
"cypressDirectory": {
5054
"type": "string",
51-
"description": "A directory where the Cypress project will be placed. Placed at the root by default."
55+
"description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56+
"x-deprecated": "Please use Storybook interaction tests instead."
5257
},
5358
"linter": {
5459
"description": "The tool to use for running lint checks.",
@@ -59,7 +64,7 @@
5964
"tsConfiguration": {
6065
"type": "boolean",
6166
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
62-
"default": false,
67+
"default": true,
6368
"x-priority": "important"
6469
},
6570
"skipFormat": {
@@ -79,10 +84,6 @@
7984
"**/**/src/**/*.other.*",
8085
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
8186
]
82-
},
83-
"configureTestRunner": {
84-
"type": "boolean",
85-
"description": "Add a Storybook Test-Runner target."
8687
}
8788
},
8889
"additionalProperties": false,

docs/generated/packages/react-native/generators/storybook-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"tsConfiguration": {
3333
"type": "boolean",
3434
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
35-
"default": false
35+
"default": true
3636
},
3737
"linter": {
3838
"description": "The tool to use for running lint checks.",

docs/generated/packages/react/generators/storybook-configuration.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
"x-dropdown": "projects",
1919
"x-priority": "important"
2020
},
21+
"interactionTests": {
22+
"type": "boolean",
23+
"description": "Set up Storybook interaction tests.",
24+
"x-prompt": "Do you want to set up Storybook interaction tests?",
25+
"x-priority": "important",
26+
"alias": ["configureTestRunner"],
27+
"default": true
28+
},
2129
"configureCypress": {
2230
"type": "boolean",
2331
"description": "Run the cypress-configure generator.",
24-
"x-prompt": "Configure a cypress e2e app to run against the storybook instance?",
25-
"default": true,
26-
"x-priority": "important"
32+
"x-deprecated": "Please use Storybook interaction tests instead."
2733
},
2834
"generateStories": {
2935
"type": "boolean",
@@ -35,9 +41,7 @@
3541
"generateCypressSpecs": {
3642
"type": "boolean",
3743
"description": "Automatically generate test files in the Cypress E2E app generated by the `cypress-configure` generator.",
38-
"x-prompt": "Automatically generate test files in the Cypress E2E app generated by the cypress-configure generator?",
39-
"default": true,
40-
"x-priority": "important"
44+
"x-deprecated": "Please use Storybook interaction tests instead."
4145
},
4246
"configureStaticServe": {
4347
"type": "boolean",
@@ -48,7 +52,8 @@
4852
},
4953
"cypressDirectory": {
5054
"type": "string",
51-
"description": "A directory where the Cypress project will be placed. Placed at the root by default."
55+
"description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56+
"x-deprecated": "Please use Storybook interaction tests instead."
5257
},
5358
"js": {
5459
"type": "boolean",
@@ -58,7 +63,7 @@
5863
"tsConfiguration": {
5964
"type": "boolean",
6065
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
61-
"default": false
66+
"default": true
6267
},
6368
"linter": {
6469
"description": "The tool to use for running lint checks.",
@@ -77,10 +82,6 @@
7782
"**/**/src/**/*.other.*",
7883
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
7984
]
80-
},
81-
"configureTestRunner": {
82-
"type": "boolean",
83-
"description": "Add a Storybook Test-Runner target."
8485
}
8586
},
8687
"required": ["name"],

docs/generated/packages/storybook/generators/configuration.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@
1818
"x-dropdown": "projects",
1919
"x-priority": "important"
2020
},
21+
"interactionTests": {
22+
"type": "boolean",
23+
"description": "Set up Storybook interaction tests.",
24+
"x-prompt": "Do you want to set up Storybook interaction tests?",
25+
"alias": ["configureTestRunner"],
26+
"default": true
27+
},
2128
"configureCypress": {
2229
"type": "boolean",
2330
"description": "Run the cypress-configure generator.",
24-
"x-prompt": "Configure a cypress e2e app to run against the storybook instance?",
25-
"x-priority": "important"
31+
"x-deprecated": "Please use Storybook interaction tests instead."
2632
},
2733
"cypressDirectory": {
2834
"type": "string",
29-
"description": "A directory where the Cypress project will be placed. Added at root by default."
35+
"description": "A directory where the Cypress project will be placed. Added at root by default.",
36+
"x-deprecated": "Please use Storybook interaction tests instead."
3037
},
3138
"linter": {
3239
"description": "The tool to use for running lint checks.",
@@ -56,10 +63,6 @@
5663
"description": "Add a static-storybook to serve the static storybook built files.",
5764
"default": false
5865
},
59-
"configureTestRunner": {
60-
"type": "boolean",
61-
"description": "Add a Storybook Test-Runner target."
62-
},
6366
"bundler": {
6467
"description": "The Storybook builder to use.",
6568
"type": "string",

e2e/storybook/src/storybook-nested.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ describe('Storybook generators and executors for standalone workspaces - using R
4040
describe('Storybook generated files', () => {
4141
it('should generate storybook files', () => {
4242
checkFilesExist(
43-
'.storybook/main.js',
44-
'.storybook/preview.js',
43+
'.storybook/main.ts',
44+
'.storybook/preview.ts',
4545
'tsconfig.storybook.json'
4646
);
4747
});

packages/angular/src/generators/storybook-configuration/lib/generate-storybook-configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function generateStorybookConfiguration(
1414
linter: options.linter,
1515
cypressDirectory: options.cypressDirectory,
1616
tsConfiguration: options.tsConfiguration,
17-
configureTestRunner: options.configureTestRunner,
17+
interactionTests: options.interactionTests,
1818
configureStaticServe: options.configureStaticServe,
1919
skipFormat: true,
2020
});

packages/angular/src/generators/storybook-configuration/schema.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export interface StorybookConfigurationOptions {
1111
tsConfiguration?: boolean;
1212
skipFormat?: boolean;
1313
ignorePaths?: string[];
14-
configureTestRunner?: boolean;
14+
interactionTests?: boolean;
1515
}

packages/angular/src/generators/storybook-configuration/schema.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
"x-dropdown": "projects",
1919
"x-priority": "important"
2020
},
21+
"interactionTests": {
22+
"type": "boolean",
23+
"description": "Set up Storybook interaction tests.",
24+
"x-prompt": "Do you want to set up Storybook interaction tests?",
25+
"alias": ["configureTestRunner"],
26+
"x-priority": "important",
27+
"default": true
28+
},
2129
"configureCypress": {
2230
"type": "boolean",
2331
"description": "Specifies whether to configure Cypress or not.",
24-
"x-prompt": "Configure a Cypress e2e app to run against the storybook instance?",
25-
"default": true,
26-
"x-priority": "important"
32+
"x-deprecated": "Please use Storybook interaction tests instead."
2733
},
2834
"generateStories": {
2935
"type": "boolean",
@@ -35,9 +41,7 @@
3541
"generateCypressSpecs": {
3642
"type": "boolean",
3743
"description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
38-
"x-prompt": "Automatically generate test files in the generated Cypress e2e app?",
39-
"default": true,
40-
"x-priority": "important"
44+
"x-deprecated": "Please use Storybook interaction tests instead."
4145
},
4246
"configureStaticServe": {
4347
"type": "boolean",
@@ -48,7 +52,8 @@
4852
},
4953
"cypressDirectory": {
5054
"type": "string",
51-
"description": "A directory where the Cypress project will be placed. Placed at the root by default."
55+
"description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56+
"x-deprecated": "Please use Storybook interaction tests instead."
5257
},
5358
"linter": {
5459
"description": "The tool to use for running lint checks.",
@@ -59,7 +64,7 @@
5964
"tsConfiguration": {
6065
"type": "boolean",
6166
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
62-
"default": false,
67+
"default": true,
6368
"x-priority": "important"
6469
},
6570
"skipFormat": {
@@ -82,10 +87,6 @@
8287
"**/**/src/**/*.other.*",
8388
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
8489
]
85-
},
86-
"configureTestRunner": {
87-
"type": "boolean",
88-
"description": "Add a Storybook Test-Runner target."
8990
}
9091
},
9192
"additionalProperties": false,

packages/react-native/src/generators/storybook-configuration/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"tsConfiguration": {
3333
"type": "boolean",
3434
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
35-
"default": false
35+
"default": true
3636
},
3737
"linter": {
3838
"description": "The tool to use for running lint checks.",

packages/react/src/generators/storybook-configuration/configuration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { nxVersion } from '../../utils/versions';
1111

1212
async function generateStories(host: Tree, schema: StorybookConfigureSchema) {
13+
// TODO(katerina): Remove cypress stuff for Nx 17?
1314
ensurePackage('@nx/cypress', nxVersion);
1415
const { getE2eProjectName } = await import(
1516
'@nx/cypress/src/utils/project-name'
@@ -57,7 +58,7 @@ export async function storybookConfigurationGenerator(
5758
linter: schema.linter,
5859
cypressDirectory: schema.cypressDirectory,
5960
tsConfiguration: schema.tsConfiguration,
60-
configureTestRunner: schema.configureTestRunner,
61+
interactionTests: schema.interactionTests,
6162
configureStaticServe: schema.configureStaticServe,
6263
uiFramework:
6364
bundler === 'vite'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy