Skip to content

Commit aa77b2c

Browse files
create app-one and app-two
1 parent 527ef1d commit aa77b2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2680
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,12 @@ Run "nx show project app-shell" to view details about this project.
8080
nx run app-shell:serve
8181
```
8282

83+
### Create 2 MFE apps
84+
85+
```shell
86+
npx nx generate @nrwl/angular:app apps/app-one --style=scss --routing=true --e2eTestRunner=cypress --bundler=webpack --ssr=false;npx nx generate @nrwl/angular:app apps/app-two --style=scss --routing=true --e2eTestRunner=cypress --bundler=webpack --ssr=false
87+
```
88+
89+
This will create app-one and app-two
90+
8391

apps/app-one-e2e/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
}
9+
]
10+
}

apps/app-one-e2e/cypress.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
2+
3+
import { defineConfig } from 'cypress';
4+
5+
export default defineConfig({
6+
e2e: {
7+
...nxE2EPreset(__filename, {
8+
cypressDir: 'src',
9+
webServerCommands: {
10+
default: 'nx run app-one:serve:development',
11+
production: 'nx run app-one:serve:production',
12+
},
13+
ciWebServerCommand: 'nx run app-one:serve-static',
14+
}),
15+
baseUrl: 'http://localhost:4200',
16+
},
17+
});

apps/app-one-e2e/project.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "app-one-e2e",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/app-one-e2e/src",
6+
"tags": [],
7+
"implicitDependencies": ["app-one"],
8+
"// targets": "to see all targets run: nx show project app-one-e2e --web",
9+
"targets": {}
10+
}

apps/app-one-e2e/src/e2e/app.cy.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getGreeting } from '../support/app.po';
2+
3+
describe('app-one-e2e', () => {
4+
beforeEach(() => cy.visit('/'));
5+
6+
it('should display welcome message', () => {
7+
// Custom command example, see `../support/commands.ts` file
8+
cy.login('my-email@something.com', 'myPassword');
9+
10+
// Function helper example, see `../support/app.po.ts` file
11+
getGreeting().contains(/Welcome/);
12+
});
13+
});
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": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const getGreeting = () => cy.get('h1');
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// <reference types="cypress" />
2+
3+
// ***********************************************
4+
// This example commands.ts shows you how to
5+
// create various custom commands and overwrite
6+
// existing commands.
7+
//
8+
// For more comprehensive examples of custom
9+
// commands please read more here:
10+
// https://on.cypress.io/custom-commands
11+
// ***********************************************
12+
13+
// eslint-disable-next-line @typescript-eslint/no-namespace
14+
declare namespace Cypress {
15+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16+
interface Chainable<Subject> {
17+
login(email: string, password: string): void;
18+
}
19+
}
20+
21+
// -- This is a parent command --
22+
Cypress.Commands.add('login', (email, password) => {
23+
console.log('Custom command example: Login', email, password);
24+
});
25+
//
26+
// -- This is a child command --
27+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
28+
//
29+
//
30+
// -- This is a dual command --
31+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
32+
//
33+
//
34+
// -- This will overwrite an existing command --
35+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.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';

apps/app-one-e2e/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"outDir": "../../dist/out-tsc",
6+
"module": "commonjs",
7+
"types": ["cypress", "node"],
8+
"sourceMap": false,
9+
"forceConsistentCasingInFileNames": true,
10+
"strict": true,
11+
"noImplicitOverride": true,
12+
"noPropertyAccessFromIndexSignature": true,
13+
"noImplicitReturns": true,
14+
"noFallthroughCasesInSwitch": true
15+
},
16+
"include": [
17+
"**/*.ts",
18+
"**/*.js",
19+
"cypress.config.ts",
20+
"**/*.cy.ts",
21+
"**/*.cy.js",
22+
"**/*.d.ts"
23+
]
24+
}

0 commit comments

Comments
 (0)