forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhowitworks.js
270 lines (219 loc) · 5.97 KB
/
howitworks.js
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
import { $ } from '@wdio/globals';
import Page from './page';
import { driver, expect } from '@wdio/globals';
class HowItWorks extends Page {
get howItWorksTitle1() {
return $('#claimYourCampaignProfile')
}
get howItWorksTitle2() {
return $('#importEndorsements')
}
get howItWorksTitle3() {
return $('#addMoreCustomizations')
}
get howItWorksTitle4() {
return $('#launchToYourPeople')
}
get howItWorksTitle5() {
return $('#socialLift')
}
get howItWorksDescription1() {
return $('#claimYourCampaignProfileDescription');
}
get howItWorksDescription2() {
return $('#importEndorsementsDescription');
}
get howItWorksDescription3() {
return $('#addMoreCustomizationsDescription');
}
get howItWorksDescription4() {
return $('#launchToYourPeopleDescription');
}
get howItWorksDescription5() {
return $('#socialLiftDescription');
}
get howItWorksImage () {
return $('div>img').getAttribute('src')
}
get howItWorksLink () {
return $('#footerLinkHowItWorks');
}
get findFirstNextButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep1Next');
}
get findSecondNextButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep2Next');
}
get findThirdNextButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep3Next');
}
get findFourthNextButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep4Next');
}
get findFirstBackButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep2Back');
}
get findSecondBackButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep3Back');
}
get findThirdBackButtonHowItWorksWindow () {
return $('#annotatedSlideShowStep4Back');
}
get findFourthBackButtonHowItWorksWindow () {
return $('#howItWorksBackDesktopButton');
}
get getTitleSignUpPopUp () {
return $('#signIn');
}
get signInSubtitle () {
return $('#pleaseSignInTitle');
}
get getStartedButton () {
return $('#howItWorksGetStartedDesktopButton');
}
get enterVoterEmailAddressTextBox () {
return $('#enterVoterEmailAddress');
}
get cancelEmailButton () {
return $('#cancelEmailButton');
}
get cancelMobilePhoneNumberButton(){
return $('#cancelVoterPhoneSendSMS')
}
get enterMobilePhoneNumber() {
return $('#enterVoterPhone');
}
get enterSignInWithApple() {
return $('#appleLogo');
}
get enterSignInWithTwitter () {
return $('.csbvaL');//deprecated case page object
}
get cancelTwitterSignin(){
return $('#cancel')
}
get enterSendVerificationCode() {
return $('#desktopSmsSendCode')
}
get enterSendEmailVerificationCode() {
return $('#voterEmailAddressEntrySendCode')
}
get enterVerifyButton(){
return $('#emailVerifyButton')
}
get enterProfileAvatar(){
return $('#profileAvatarHeaderBar')
}
get signOut() {
return $('#signOut_Settings')
}
get phoneNumberHelperText(){
return $('#enterVoterPhone-helper-text')
}
get emailAddressHelperText() {
return $('#enterVoterEmailAddress-helper-text')
}
get backArrow() {
return $('#emailVerificationBackButton')
}
get deleteIcon() {
return $('svg[data-testid = "DeleteIcon"]')
}
get alertMessage() {
return $('.MuiAlert-message')
}
async enterDigit(num){
if (num === 0) {
return $('#digit1')
}else if (num === 1) {
return $('#digit2')
} else if (num === 2) {
return $('#digit3')
} else if (num === 3) {
return $('#digit4')
} else if (num == 4) {
return $('#digit5')
} else{
return $('#digit6')
}
}
async clickButton(element){
await element.findAndClick()
}
async clickHowItWorksLink () {
await this.howItWorksLink .click();
}
async clickNextButtonFourTimes () {
for (let i = 1; i <= 4; i++) {
if (i == 1) {
await this.findFirstNextButtonHowItWorksWindow.click();
}else if (i ==2){
await this.findSecondNextButtonHowItWorksWindow.click();
}else if (i ==3){
await this.findThirdNextButtonHowItWorksWindow.click();
}else {
await this.findFourthNextButtonHowItWorksWindow.click();
}
}
}
async clickNextButton (i) {
if (i == 1) {
await this.findFirstNextButtonHowItWorksWindow.click();
}else if (i ==2){
await this.findSecondNextButtonHowItWorksWindow.click();
}else if (i ==3){
await this.findThirdNextButtonHowItWorksWindow.click();
}else {
await this.findFourthNextButtonHowItWorksWindow.click();
}
}
async checkDescriptionOfHowItWorksWindow (num) {
if (num === 1) {
return this.howItWorksDescription1;
}else if (num === 2) {
return this.howItWorksDescription2;
} else if (num === 3) {
return this.howItWorksDescription3;
} else if (num === 4) {
return this.howItWorksDescription4;
} else {
return howItWorksDescription5;
}
}
async checkBrokenImagesUsingResponseCode() {
const imageSrc = await this.howItWorksImage
const response = await fetch(imageSrc);
if (response.status == 200){
console.log("Image loaded");
} else{
console.log('Image is not loaded');
}
}
async clickBackButtonFourTimes () {
for (let i = 1; i <= 4; i++) {
if (i == 1) {
await this.findFourthBackButtonHowItWorksWindow.click();
}else if (i ==2){
await this.findThirdBackButtonHowItWorksWindow.click();
}else if (i ==3){
await this.findSecondBackButtonHowItWorksWindow.click();
}else {
await this.findFirstBackButtonHowItWorksWindow.click();
}
}
}
async checkTitleOfHowItWorksWindow (num) {
if (num === 1) {
return this.howItWorksTitle1;
}else if (num === 2) {
return this.howItWorksTitle2;
} else if (num === 3) {
return this.howItWorksTitle3;
} else if (num === 4) {
return this.howItWorksTitle4;
} else {
return this.howItWorksTitle5;
}
}
}
export default new HowItWorks();