-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodelerElementDestinationRedirect.js
More file actions
174 lines (160 loc) · 7.92 KB
/
modelerElementDestinationRedirect.js
File metadata and controls
174 lines (160 loc) · 7.92 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import selectors from "#selectors/modelerElementDestinationRedirect";
import selectorsAB from "#selectors/abTesting";
import { NavigationHelper } from "#helpers/navigationHelper";
import {ABTesting} from "#pages/abTesting";
const navHelper = new NavigationHelper();
const abTesting = new ABTesting();
export class ModelerElementDestinationRedirect {
//Element Destination for TASKS
configureElementDestinationInTask(nameElement,optionConfig, iframeOption = 'a'){
abTesting.clickOnTask(nameElement, iframeOption);
abTesting.clickOnInspectorBtn(iframeOption);
this.selectOptionInTask(optionConfig,iframeOption);
abTesting.publishNewVersion('withoutAB', iframeOption);
}
/**
* This method selects an option in Element destination field in TASK control
* @param option: name of option (Example: Task Source,Task List,Process Launchpad,Welcome Screen,Custom Dashboard,External URL)
* @param iframe: (iframe A: 'a', iframe B: 'b')
*/
selectOptionInTask(optionConfig,iframeOption = 'a'){
const { option, dashboardName, url } = optionConfig
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).xpath(selectors.labelElementDestination).should('be.visible');
switch (option) {
case 'Task Source':
this.selectElementDestination('Task Source',iframeOption);
break;
case 'Task List':
this.selectElementDestination('Task List',iframeOption);
break;
case 'Process Launchpad':
this.selectElementDestination('Process Launchpad',iframeOption);
break;
case 'Welcome Screen':
this.selectElementDestination('Welcome Screen',iframeOption);
break;
case 'Custom Dashboard':
this.selectElementDestination('Custom Dashboard',iframeOption);
this.selectDashboardInModeler(dashboardName,iframeOption);
break;
case 'External URL':
this.selectElementDestination('External URL',iframeOption);
this.selectExternalURLInModeler(url,iframeOption);
break;
case 'Display Next Assigned Task':
this.selectElementDestination('Display Next Assigned Task', iframeOption);
break;
default:
break;
}
}
selectDashboardInModeler(dashboardName,iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).xpath(selectors.labelDashboard).should('be.visible');
cy.iframe(iframeSelector).find(selectors.dashboardInput).click({force:true});
cy.iframe(iframeSelector).find(selectors.dashboardInput).type(dashboardName,{delay:60}).should('have.value',dashboardName);
cy.iframe(iframeSelector).xpath(selectors.wrapperDashboard)
.should('have.attr', 'aria-label')
.and('contain', dashboardName+ '. ');
cy.iframe(iframeSelector).find(selectors.dashboardInput).type('{enter}');
}
selectExternalURLInModeler(url,iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).xpath(selectors.labelURL).should('be.visible');
cy.iframe(iframeSelector).find(selectors.urlInput).should('be.visible');
cy.iframe(iframeSelector).find(selectors.urlInput).type(url,{delay:50}).should('have.value',url);
}
//Element Destination for END EVENT
configureElementDestinationInEndEvent(nameElement, optionConfig, iframeOption = 'a'){
abTesting.clickOnEndEvent(nameElement, iframeOption);
abTesting.clickOnInspectorBtn(iframeOption);
this.selectOptionInEndEvent(optionConfig,iframeOption);
abTesting.publishNewVersion('withoutAB', iframeOption);
}
/**
* This method selects an option in Element destination field END EVENT control
* @param option: name of option (Example: Summary Screen,Task List,Process Launchpad,Welcome Screen,Dashboard,External URL,Another Process)
* @param iframe: iframe (iframe A: 'a', iframe B: 'b')
*/
selectOptionInEndEvent(optionConfig,iframeOption = 'a'){
const { option, dashboardName, url,processName } = optionConfig
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).xpath(selectors.labelElementDestination).should('be.visible');
switch (option) {
case 'Summary Screen':
this.selectElementDestination('Summary Screen',iframeOption);
break;
case 'Task List':
this.selectElementDestination('Task List',iframeOption);
break;
case 'Process Launchpad':
this.selectElementDestination('Process Launchpad',iframeOption);
break;
case 'Welcome Screen':
this.selectElementDestination('Welcome Screen',iframeOption);
break;
case 'Custom Dashboard':
this.selectElementDestination('Custom Dashboard',iframeOption);
this.selectDashboardInModeler(dashboardName,iframeOption);
break;
case 'External URL':
this.selectElementDestination('External URL',iframeOption);
this.selectExternalURLInModeler(url,iframeOption);
break;
case 'Another Process':
this.selectElementDestination('Another Process',iframeOption);
this.selectAnotherProcessInModeler(processName,iframeOption)
break;
default:
break;
}
}
selectAnotherProcessInModeler(processName,iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).xpath(selectors.labelProcess).should('be.visible');
cy.iframe(iframeSelector).find(selectors.processInput).click({force:true});
cy.iframe(iframeSelector).find(selectors.processInput).type(processName,{delay:80}).should('have.value',processName);
cy.iframe(iframeSelector).xpath(selectors.wrapperProcess)
.should('have.attr', 'aria-label')
.and('contain', processName+ '. ');
cy.iframe(iframeSelector).find(selectors.processInput).type('{enter}');
}
selectElementDestination(option,iframeOption = 'a'){
switch (iframeOption) {
case 'a':
this.selectOption(option,selectorsAB.iframeA)
break;
case 'b':
this.selectOption(option,selectorsAB.iframeB)
break;
default:
break;
}
}
selectOption(option,iframe) {
cy.iframe(iframe)
.find(selectors.elementDestinationList)
.click();
cy.iframe(iframe).find(selectors.multiselectWrapper)
.contains(option)
.click({force:true});
}
clickOnElementDestination(iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
cy.iframe(iframeSelector).find(selectors.elementDestinationList).click();
}
/**
* This method verify options in element destination field
* @param expectedContentList
* for example:
* expectedContent = ["Task Source (Default)","Task List","Process Launchpad","Welcome Screen","Custom Dashboard","External URL"]
*/
validateOptionsInElementDestinationList(expectedContentList,iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectorsAB.iframeA : selectorsAB.iframeB
this.clickOnElementDestination(iframeOption);
cy.iframe(iframeSelector).xpath(selectors.optionsInElementDestination).each(element => {
expect(expectedContentList).to.contain(element.text());
});
}
}