Skip to content

Commit e5ecbf2

Browse files
add compoent store and storybook (#435)
1 parent 0f44e98 commit e5ecbf2

26 files changed

+6657
-330
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************
3+
// This example commands.ts shows you how to
4+
// create various custom commands and overwrite
5+
// existing commands.
6+
//
7+
// For more comprehensive examples of custom
8+
// commands please read more here:
9+
// https://on.cypress.io/custom-commands
10+
// ***********************************************
11+
12+
// eslint-disable-next-line @typescript-eslint/no-namespace
13+
declare namespace Cypress {
14+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15+
interface Chainable<Subject> {
16+
login(email: string, password: string): void;
17+
}
18+
}
19+
//
20+
// -- This is a parent command --
21+
Cypress.Commands.add('login', (email, password) => {
22+
console.log('Custom command example: Login', email, password);
23+
});
24+
//
25+
// -- This is a child command --
26+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
27+
//
28+
//
29+
// -- This is a dual command --
30+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
31+
//
32+
//
33+
// -- This will overwrite an existing command --
34+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
7+
<title>ngu-carousel-example Components App</title>
8+
</head>
9+
<body>
10+
<div data-cy-root></div>
11+
</body>
12+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/component.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.ts using ES2015 syntax:
17+
import './commands';
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["cypress", "node"]
7+
},
8+
"include": [
9+
"support/**/*.ts",
10+
"../cypress.config.ts",
11+
"../**/*.cy.ts",
12+
"../**/*.cy.tsx",
13+
"../**/*.cy.js",
14+
"../**/*.cy.jsx",
15+
"../**/*.d.ts"
16+
]
17+
}

apps/ngu-carousel-example/project.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "ngu-carousel-example",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"projectType": "application",
45
"generators": {
56
"@schematics/angular:component": {
@@ -101,6 +102,13 @@
101102
"apps/ngu-carousel-example/**/*.html"
102103
]
103104
}
105+
},
106+
"component-test": {
107+
"executor": "@nrwl/cypress:cypress",
108+
"options": {
109+
"cypressConfig": "apps/ngu-carousel-example/cypress.config.ts",
110+
"testingType": "component"
111+
}
104112
}
105113
}
106114
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
21
{
32
"extends": "../../tsconfig.base.json",
43
"compilerOptions": {
54
"outDir": "./out-tsc/app",
65
"types": ["hammerjs"]
76
},
87
"files": ["src/main.ts", "src/polyfills.ts"],
9-
"include": ["src/**/*.d.ts"]
8+
"include": ["src/**/*.d.ts"],
9+
"exclude": [
10+
"cypress/**/*",
11+
"cypress.config.ts",
12+
"**/*.cy.ts",
13+
"**/*.cy.js",
14+
"**/*.cy.tsx",
15+
"**/*.cy.jsx"
16+
]
1017
}

libs/ngu/carousel/.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
{
66
"files": ["*.ts"],
77
"parserOptions": {
8-
"project": ["libs/ngu/carousel/tsconfig.*?.json"],
8+
"project": [
9+
"libs/ngu/carousel/tsconfig.*?.json",
10+
"libs/ngu/carousel/.storybook/tsconfig.json"
11+
],
912
"createDefaultProgram": true
1013
},
1114
"rules": {

libs/ngu/carousel/.storybook/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
core: { builder: 'webpack5' },
3+
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
4+
addons: ['@storybook/addon-essentials']
5+
};
6+
7+
// To customize your webpack configuration you can use the webpackFinal field.
8+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
9+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs

0 commit comments

Comments
 (0)