Skip to content

Commit fb5037f

Browse files
authored
add: delegate modules & federated npm to index; refactor: samples (#2741)
1 parent b0803fa commit fb5037f

File tree

12 files changed

+87
-63
lines changed

12 files changed

+87
-63
lines changed

delegate-modules/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ Run `yarn start`. This will build and serve both `app1` and `app2` on ports 3001
1313
- [localhost:3002](http://localhost:3002/) (STANDALONE REMOTE)
1414

1515
<img src="https://ssl.google-analytics.com/collect?v=1&t=event&ec=email&ea=open&t=event&tid=UA-120967034-1&z=1589682154&cid=ae045149-9d17-0367-bbb0-11c41d92b411&dt=ModuleFederationExamples&dp=/email/BasicRemoteHost">
16+
17+
# Running Cypress E2E Tests
18+
19+
To run tests in interactive mode, run `npm run cypress:debug` from the root directory of the project. It will open Cypress Test Runner and allow to run tests in interactive mode. [More info about "How to run tests"](../../cypress/README.md#how-to-run-tests)
20+
21+
To build app and run test in headless mode, run `yarn e2e:ci`. It will build app and run tests for this workspace in headless mode. If tets failed cypress will create `cypress` directory in sample root folder with screenshots and videos.
22+
23+
["Best Practices, Rules amd more interesting information here](../../cypress/README.md)

delegate-modules/app1/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@deletages/app1",
2+
"name": "delegate-modules_app1",
33
"version": "0.0.0",
44
"private": true,
55
"devDependencies": {
@@ -9,7 +9,7 @@
99
"html-webpack-plugin": "5.5.0",
1010
"serve": "13.0.4",
1111
"webpack": "5.72.1",
12-
"webpack-cli": "4.9.2",
12+
"webpack-cli": "4.10.0",
1313
"webpack-dev-server": "4.9.3"
1414
},
1515
"scripts": {

delegate-modules/app2/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@deletages/app2",
2+
"name": "delegate-modules_app2",
33
"version": "0.0.0",
44
"private": true,
55
"devDependencies": {
@@ -9,7 +9,7 @@
99
"html-webpack-plugin": "5.5.0",
1010
"serve": "13.0.4",
1111
"webpack": "5.72.1",
12-
"webpack-cli": "4.9.2",
12+
"webpack-cli": "4.10.0",
1313
"webpack-dev-server": "4.9.3"
1414
},
1515
"scripts": {

delegate-modules/e2e/checkApplications.cy.ts

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,30 @@ appsData.forEach(
2222
host: number
2323
}) {
2424

25-
describe(`Check ${property.appNameText}`, () => {
26-
27-
it(`Check header block with text visibility`, () => {
28-
basePage.openLocalhost(property.host)
29-
basePage.checkElementWithTextPresence({
30-
selector: baseSelectors.tags.headers.h1,
31-
text: Constants.commonConstantsData.basicComponents.basicHostRemote,
32-
visibilityState: 'be.visible'
25+
describe('Delegate Modules', () => {
26+
context(`Check ${property.appNameText}`, () => {
27+
it(`Check header block with text visibility`, () => {
28+
basePage.openLocalhost(property.host)
29+
basePage.checkElementWithTextPresence({
30+
selector: baseSelectors.tags.headers.h1,
31+
text: Constants.commonConstantsData.basicComponents.basicHostRemote,
32+
visibilityState: 'be.visible'
33+
})
34+
basePage.checkElementWithTextPresence({
35+
selector: baseSelectors.tags.headers.h2,
36+
text: `${property.appNameText}`,
37+
visibilityState: 'be.visible'
38+
})
3339
})
34-
basePage.checkElementWithTextPresence({
35-
selector: baseSelectors.tags.headers.h2,
36-
text: `${property.appNameText}`,
37-
visibilityState: 'be.visible'
40+
41+
it(`Check button text visibility`, () => {
42+
basePage.openLocalhost(property.host)
43+
basePage.checkElementWithTextPresence({
44+
selector: baseSelectors.tags.coreElements.button,
45+
text: Constants.updatedConstantsData.commonAppWithButton.app2,
46+
visibilityState: 'be.visible'
47+
})
3848
})
39-
})
40-
41-
it(`Check button text visibility`, () => {
42-
basePage.openLocalhost(property.host)
43-
basePage.checkElementWithTextPresence({
44-
selector: baseSelectors.tags.coreElements.button,
45-
text: Constants.updatedConstantsData.commonAppWithButton.app2,
46-
visibilityState: 'be.visible'
47-
})
48-
})
49-
})
49+
});
50+
});
5051
})

delegate-modules/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
},
1010
"version": "0.0.0",
1111
"scripts": {
12-
"start": "lerna run --parallel start",
13-
"build": "lerna run build",
14-
"serve": "lerna run --parallel serve",
15-
"clean": "lerna run --parallel clean"
12+
"start": "lerna run --scope=delegate-modules_* --parallel start",
13+
"build": "lerna run --scope=delegate-modules_* build",
14+
"serve": "lerna run --scope=delegate-modules_* --parallel serve",
15+
"clean": "lerna run --scope=delegate-modules_* --parallel clean",
16+
"e2e:ci": "yarn start & wait-on http-get://localhost:3001/ && npx cypress run --config-file ../cypress/config/cypress.config.ts --config '{\"supportFile\": \"../cypress/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
1617
},
1718
"devDependencies": {
1819
"lerna": "3.22.1"

federated-npm/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ Run `yarn start`. This will build and serve both `app1` and `app2` on ports 3001
1313
- [localhost:3002](http://localhost:3002/) (STANDALONE REMOTE)
1414

1515
<img src="https://ssl.google-analytics.com/collect?v=1&t=event&ec=email&ea=open&t=event&tid=UA-120967034-1&z=1589682154&cid=ae045149-9d17-0367-bbb0-11c41d92b411&dt=ModuleFederationExamples&dp=/email/BasicRemoteHost">
16+
17+
# Running Cypress E2E Tests
18+
19+
To run tests in interactive mode, run `npm run cypress:debug` from the root directory of the project. It will open Cypress Test Runner and allow to run tests in interactive mode. [More info about "How to run tests"](../../cypress/README.md#how-to-run-tests)
20+
21+
To build app and run test in headless mode, run `yarn e2e:ci`. It will build app and run tests for this workspace in headless mode. If tets failed cypress will create `cypress` directory in sample root folder with screenshots and videos.
22+
23+
["Best Practices, Rules amd more interesting information here](../../cypress/README.md)

federated-npm/app1/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@npm/app1",
2+
"name": "federated-npm_app1",
33
"version": "0.0.0",
44
"private": true,
55
"devDependencies": {
@@ -9,7 +9,7 @@
99
"html-webpack-plugin": "5.5.0",
1010
"serve": "13.0.4",
1111
"webpack": "5.72.1",
12-
"webpack-cli": "4.9.2",
12+
"webpack-cli": "4.10.0",
1313
"webpack-dev-server": "4.9.3"
1414
},
1515
"scripts": {

federated-npm/app2/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@npm/app2",
2+
"name": "federated-npm_app2",
33
"version": "0.0.0",
44
"private": true,
55
"devDependencies": {
@@ -9,7 +9,7 @@
99
"html-webpack-plugin": "5.5.0",
1010
"serve": "13.0.4",
1111
"webpack": "5.72.1",
12-
"webpack-cli": "4.9.2",
12+
"webpack-cli": "4.10.0",
1313
"webpack-dev-server": "4.9.3"
1414
},
1515
"scripts": {

federated-npm/app3/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@npm/app3",
2+
"name": "federated-npm_app3",
33
"version": "0.0.0",
44
"private": true,
55
"devDependencies": {
@@ -9,7 +9,7 @@
99
"html-webpack-plugin": "5.5.0",
1010
"serve": "13.0.4",
1111
"webpack": "5.72.1",
12-
"webpack-cli": "4.9.2",
12+
"webpack-cli": "4.10.0",
1313
"webpack-dev-server": "4.9.3"
1414
},
1515
"scripts": {

federated-npm/e2e/checkApplications.cy.ts

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const appsData = [
1414
host: 3002
1515
},
1616
{
17-
appNameText: Constants.commonConstantsData.commonCountAppNames.app2,
17+
appNameText: Constants.commonConstantsData.commonCountAppNames.app3,
1818
host: 3003
1919
},
2020
]
@@ -26,29 +26,30 @@ appsData.forEach(
2626
host: number
2727
}) {
2828

29-
describe(`Check ${property.appNameText}`, () => {
30-
31-
it(`Check header block with text visibility`, () => {
32-
basePage.openLocalhost(property.host)
33-
basePage.checkElementWithTextPresence({
34-
selector: baseSelectors.tags.headers.h1,
35-
text: Constants.commonConstantsData.basicComponents.basicHostRemote,
36-
visibilityState: 'be.visible'
37-
})
38-
basePage.checkElementWithTextPresence({
39-
selector: baseSelectors.tags.headers.h2,
40-
text: `${property.appNameText}`,
41-
visibilityState: 'be.visible'
29+
describe('Federated npm', () => {
30+
context(`Check ${property.appNameText}`, () => {
31+
it(`Check header block with text visibility`, () => {
32+
basePage.openLocalhost(property.host)
33+
basePage.checkElementWithTextPresence({
34+
selector: baseSelectors.tags.headers.h1,
35+
text: Constants.commonConstantsData.basicComponents.basicHostRemote,
36+
visibilityState: 'be.visible'
37+
})
38+
basePage.checkElementWithTextPresence({
39+
selector: baseSelectors.tags.headers.h2,
40+
text: property.host === 3003 ? appsData[1].appNameText : `${property.appNameText}`,
41+
visibilityState: 'be.visible'
42+
})
4243
})
43-
})
44-
45-
it(`Check button text visibility`, () => {
46-
basePage.openLocalhost(property.host)
47-
basePage.checkElementWithTextPresence({
48-
selector: baseSelectors.tags.coreElements.button,
49-
text: Constants.updatedConstantsData.commonAppWithButton.app2,
50-
visibilityState: 'be.visible'
44+
45+
it(`Check button text visibility`, () => {
46+
basePage.openLocalhost(property.host)
47+
basePage.checkElementWithTextPresence({
48+
selector: baseSelectors.tags.coreElements.button,
49+
text: Constants.updatedConstantsData.commonAppWithButton.app2,
50+
visibilityState: 'be.visible'
51+
})
5152
})
52-
})
53+
});
5354
})
5455
})

0 commit comments

Comments
 (0)