forked from module-federation/module-federation-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommonChecks.cy.ts
134 lines (127 loc) · 7.09 KB
/
commonChecks.cy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { BaseMethods } from "../../cypress/common/base";
import { baseSelectors } from "../../cypress/common/selectors";
import { Constants } from "../../cypress/fixtures/constants";
const basePage: BaseMethods = new BaseMethods()
describe('React Nested Routers', () => {
context('It checks app1/app2', () => {
const appsData = [
{
host: 8081,
message: Constants.commonPhrases.reactNestedRoutersApp.pagesMessages.page1App1,
linkMessage: Constants.elementsText.reactNestedRoutersApp.shellAppTextedLinks[4]
},
{
host: 8082,
message: Constants.commonPhrases.reactNestedRoutersApp.pagesMessages.pageAApp2,
linkMessage: Constants.elementsText.reactNestedRoutersApp.shellAppTextedLinks[4].replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[0], Constants.elementsText.reactNestedRoutersApp.replaceValues[4])
}
]
appsData.forEach((property: { host: number, message: string, linkMessage: string }) => {
it(`Checks page message visibility`, () => {
basePage.openLocalhost({
number: property.host
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message,
visibilityState: 'be.visible'
})
});
it(`Checks texted link visibility`, () => {
basePage.openLocalhost({
number: property.host
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.host === appsData[1].host? property.linkMessage.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[4],
Constants.elementsText.reactNestedRoutersApp.replaceValues[1]) : property.linkMessage,
visibilityState: 'be.visible'
})
});
it(`Checks that on click on link url texts on page changed & changes is not reverted after reload`, () => {
basePage.openLocalhost({
number: property.host
})
if(property.host === appsData[0].host) {
basePage.checkUrlText(Constants.commonConstantsData.commonLinks.page2, false)
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message,
visibilityState: 'be.visible'
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage,
visibilityState: 'be.visible'
})
basePage.clickElementWithText({
selector: baseSelectors.tags.coreElements.link,
text: appsData[0].linkMessage
})
basePage.checkUrlText(Constants.commonConstantsData.commonLinks.page2, true)
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message,
isVisible: false,
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage,
isVisible: false,
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[2], Constants.elementsText.reactNestedRoutersApp.replaceValues[3]),
visibilityState: 'be.visible'
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[0], Constants.elementsText.reactNestedRoutersApp.replaceValues[4]),
visibilityState: 'be.visible'
})
basePage.reloadWindow()
basePage.checkUrlText(Constants.commonConstantsData.commonLinks.page2, true)
return;
}
basePage.checkUrlText(Constants.hrefs.reactNestedRoutersApp.pageB, false)
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message,
visibilityState: 'be.visible'
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[4], Constants.elementsText.reactNestedRoutersApp.replaceValues[1]),
visibilityState: 'be.visible'
})
basePage.clickElementWithText({
selector: baseSelectors.tags.coreElements.link,
text: appsData[1].linkMessage.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[4], Constants.elementsText.reactNestedRoutersApp.replaceValues[1])
})
basePage.checkUrlText(Constants.hrefs.reactNestedRoutersApp.pageB, true)
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message,
isVisible: false,
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage,
isVisible: false,
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: property.message.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[5], Constants.elementsText.reactNestedRoutersApp.replaceValues[6]),
visibilityState: 'be.visible'
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.link,
text: property.linkMessage.replace(Constants.elementsText.reactNestedRoutersApp.replaceValues[4], Constants.elementsText.reactNestedRoutersApp.replaceValues[7]),
visibilityState: 'be.visible'
})
basePage.reloadWindow()
basePage.checkUrlText(Constants.hrefs.reactNestedRoutersApp.pageB, true)
});
});
});
});