forked from module-federation/module-federation-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckAngular14ReactApp.cy.ts
117 lines (111 loc) · 5.51 KB
/
checkAngular14ReactApp.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
import { Constants } from './../../cypress/fixtures/constants';
import { baseSelectors, commonSelectors } from './../../cypress/common/selectors';
import { BaseMethods } from "../../cypress/common/base";
const basePage: BaseMethods = new BaseMethods()
describe('Angular 14 React', () => {
context('Check Angular-React Application', () => {
beforeEach(() => {
basePage.openLocalhost({
number: 4201
})
})
it('Check App build and running', () => {
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.headers.h2,
text: Constants.elementsText.angularReactShellApp.header
})
basePage.checkElementVisibility({
selector: commonSelectors.formField.replace('{fieldName}', Constants.selectorParts.formFieldNames.nameField)
})
basePage.checkElementVisibility({
selector: commonSelectors.formField.replace('{fieldName}', Constants.selectorParts.formFieldNames.emailField)
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.button,
text: Constants.elementsText.angularReactShellApp.userActions.create
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.headers.h2,
text: Constants.elementsText.angularReactShellApp.subHeader
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: Constants.elementsText.angularReactShellApp.paragraph
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: Constants.elementsText.angularReactShellApp.emptyTableState
})
})
it('Add user to the table', () => {
basePage.addUser(
Constants.commonConstantsData.commonAngularAppsData.messages.testName.first,
Constants.commonConstantsData.commonAngularAppsData.messages.email.first,
)
basePage.checkElementVisibility({
selector: baseSelectors.tags.tableElements.table,
})
basePage.checkElementVisibility({
parentSelector: baseSelectors.tags.tableElements.table,
selector: baseSelectors.tags.tableElements.dataCell,
})
basePage.checkElementQuantity({
selector: baseSelectors.tags.tableElements.dataCell,
quantity: 3
})
basePage.checkElementContainText({
parentSelector: baseSelectors.tags.tableElements.table,
selector: baseSelectors.tags.tableElements.dataCell,
text: Constants.commonConstantsData.commonAngularAppsData.messages.testName.first,
index: Constants.commonConstantsData.commonIndexes.zero,
})
basePage.checkElementContainText({
parentSelector: baseSelectors.tags.tableElements.table,
selector: baseSelectors.tags.tableElements.dataCell,
text: Constants.commonConstantsData.commonAngularAppsData.messages.email.first,
index: Constants.commonConstantsData.commonIndexes.one,
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.button,
text: Constants.elementsText.angularReactShellApp.userActions.remove
})
})
it('Remove user from the table', () => {
basePage.addUser(
Constants.commonConstantsData.commonAngularAppsData.messages.testName.first,
Constants.commonConstantsData.commonAngularAppsData.messages.email.first,
)
basePage.clickElementWithText({
selector: baseSelectors.tags.coreElements.button,
text: Constants.elementsText.angularReactShellApp.userActions.remove
})
basePage.checkElementWithTextPresence({
selector: baseSelectors.tags.coreElements.div,
text: Constants.elementsText.angularReactShellApp.emptyTableState
})
})
it('Check fields validation', () => {
basePage.clickElementBySelector({
selector: commonSelectors.formField.replace('{fieldName}', Constants.selectorParts.formFieldNames.nameField)
})
basePage.clickElementBySelector({
selector: commonSelectors.formField.replace('{fieldName}', Constants.selectorParts.formFieldNames.emailField)
})
basePage.clickElementBySelector({
selector: baseSelectors.tags.coreElements.button,
isForce: true
})
basePage.checkElementVisibility({
selector:commonSelectors.commonAngularAppsSelectors.alertMessage,
})
basePage.checkElementWithTextPresence({
selector: commonSelectors.commonAngularAppsSelectors.alertMessage,
text: Constants.commonConstantsData.commonAngularAppsData.messages.requiresMessages.name,
})
basePage.checkElementWithTextPresence({
selector: commonSelectors.commonAngularAppsSelectors.alertMessage,
text: Constants.commonConstantsData.commonAngularAppsData.messages.requiresMessages.email,
})
})
})
})