-
Notifications
You must be signed in to change notification settings - Fork 357
Expand file tree
/
Copy pathHowItWorks.browser.js
More file actions
186 lines (171 loc) · 7.43 KB
/
HowItWorks.browser.js
File metadata and controls
186 lines (171 loc) · 7.43 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
175
176
177
178
179
180
181
182
183
184
185
186
import {browser, driver, expect } from '@wdio/globals';
import ReadyPage from '../page_objects/ready.browser';
import HowItWorks from '../page_objects/howitworks.browser';
import testData from '../capabilities/testData.js';
describe('HowItWorks', () => {
const totalSlides = 5;
const enterOTP = async (code) => {
for (let i = 0; i < code.length; i++) {
await (await HowItWorks.enterDigit(i)).setValue(code[i]);
}
};
const navigateToSignIn = async () => {
await ReadyPage.load();
await HowItWorks.clickHowItWorksLink();
await HowItWorks.clickNextButtonFourTimes();
await HowItWorks.clickButton(await HowItWorks.getStartedButton);
await (await HowItWorks.signInSubtitle).waitForDisplayed();
};
const navigateToHowItWorks = async () => {
await ReadyPage.load();
await HowItWorks.clickHowItWorksLink();
};
// HowItWorks_001
it('verifyNextButton', async () => {
await navigateToHowItWorks();
for (let i = 1; i <= totalSlides; i++) {
await expect(await HowItWorks.checkTitleOfHowItWorksWindow(i)).toBeDisplayed();
if (i !== totalSlides) {
await HowItWorks.clickNextButton(i);
}
}
console.log("Next Button and titles of the page verified successfully")
});
// HowItWorks_002
it('verifyBackButton', async () => {
await navigateToHowItWorks();
await HowItWorks.clickNextButtonFourTimes();
await HowItWorks.clickBackButtonFourTimes();
await expect(await HowItWorks.checkTitleOfHowItWorksWindow(1)).toBeDisplayed();
console.log("Back button clicked successfully and user is on first page")
});
// HowItWorks_003
it('verifyGetStartedButton', async () => {
await navigateToSignIn();
await expect(await HowItWorks.signInSubtitle).toHaveText('Sign In or Join');
console.log("GetStarted Button Clicked Successfully, user on the signIn page")
});
// HowItWorks_004
it('verifyCancelSigninwithEmail', async () => {
await navigateToSignIn();
const emailTextBox = await HowItWorks.enterVoterEmailAddressTextBox;
await emailTextBox.setValue(testData.EMAIL_NEGATIVE_SCENARIO);
await HowItWorks.clickButton(await HowItWorks.cancelEmailButton);
await expect(await HowItWorks.signInSubtitle).toHaveText('Sign In or Join');
console.log("Email SignIn was Cancelled")
});
// HowItWorks_005
it('verifyCancelSigninWithMobile', async () => {
await navigateToSignIn();
const mobile = await HowItWorks.enterMobilePhoneNumber;
await mobile.setValue(testData.MOBILE_NUMBER);
await HowItWorks.clickButton(await HowItWorks.cancelMobilePhoneNumberButton);
await expect(await HowItWorks.signInSubtitle).toHaveText('Sign In or Join');
console.log("Mobile SignIn was Cancelled")
});
// HowItWorks_006
it('verifyCancelSigninWithApple', async () => {
await navigateToSignIn();
await HowItWorks.clickButton(await HowItWorks.enterSignInWithApple);
await driver.back(); // known Safari issue
await expect(await HowItWorks.getTitleSignUpPopUp).toHaveText('Sign In');
console.log("AppleID SignIn was Cancelled")
});
// HowItWorks_008
it('verifySigninUsingMobile', async () => {
await navigateToSignIn();
const mobile = await HowItWorks.enterMobilePhoneNumber;
await mobile.setValue(testData.MOBILE_NUMBER);
await HowItWorks.clickButton(await HowItWorks.enterSendVerificationCode);
await enterOTP(testData.MOBILE_VERIFICATION);
await HowItWorks.clickButton(await HowItWorks.enterPhoneVerifyButton);
await HowItWorks.clickButton(await HowItWorks.enterProfileAvatar);
await HowItWorks.clickButton(await HowItWorks.signOut);
console.log("Mobile sign-in successful");
});
// HowItWorks_009
it('verifySigninUsingEmail', async () => {
await navigateToSignIn();
const email = await HowItWorks.enterVoterEmailAddressTextBox;
await email.setValue(testData.EMAIL_VALID);
await HowItWorks.clickButton(await HowItWorks.enterSendEmailVerificationCode);
await enterOTP(testData.MOBILE_VERIFICATION);
await HowItWorks.clickButton(await HowItWorks.enterEmailVerifyButton);
await HowItWorks.clickButton(await HowItWorks.enterProfileAvatar);
await HowItWorks.clickButton(await HowItWorks.signOut);
console.log("Email sign-in successful");
});
// HowItWorks_012
it('verifyImagesAndContent', async () => {
await navigateToHowItWorks();
for (let i = 1; i <= totalSlides; i++) {
await expect(await HowItWorks.checkDescriptionOfHowItWorksWindow(i)).toBeDisplayed();
await HowItWorks.checkBrokenImagesUsingResponseCode();
if (i !== totalSlides) {
await HowItWorks.clickNextButton(i);
}
}
console.log("Images and content verified");
});
//HowItWorks_013
it('verifyInvalidMobileNumber' , async () =>{
await navigateToSignIn();
const mobile = await HowItWorks.enterMobilePhoneNumber;
await mobile.setValue(testData.INVALID_MOBILE_NUMBER);
await expect(await HowItWorks.phoneNumberHelperText)
.toHaveText('Enter a valid phone number');
console.log("Invalid mobile validation verified");
});
//HowItWorks_014
it('VerifyInvalidEmailAddress' , async () =>{
await navigateToSignIn();
const email = await HowItWorks.enterVoterEmailAddressTextBox;
await email.setValue(testData.INVALID_EMAIL_ADDRESS);
await expect(await HowItWorks.emailAddressHelperText)
.toHaveText('Enter valid email 6 to 254 characters long');
console.log("Invalid email validation verified");
});
// HowItWorks_016
it('verifyDeleteUnverifiedEmailAddress', async () => {
await ReadyPage.load();
await HowItWorks.clickHowItWorksLink();
await driver.pause(5000);
await HowItWorks.clickNextButtonFourTimes();
const getStarted = await HowItWorks.getStartedButton;
await HowItWorks.clickButton(getStarted)
await driver.pause(5000);
const mobilePhoneNumber = await HowItWorks.enterMobilePhoneNumber;
const emailTextBox = await HowItWorks.enterVoterEmailAddressTextBox;
await emailTextBox.addValue(testData.EMAIL_NEGATIVE_SCENARIO);
const sendCode = await HowItWorks.enterSendEmailVerificationCode;
await HowItWorks.clickButton(sendCode)
const backButton = await HowItWorks.backArrow;
await HowItWorks.clickButton(backButton)
const deleteButton = await HowItWorks.deleteIcon;
await driver.pause(5000);
await HowItWorks.clickButton(deleteButton);
await expect(HowItWorks.alertMessage).toHaveText('Your email address was deleted.');
console.log("Deleted unverified Email address")
});
// HowItWorks_015
it('verifyDeleteUnverifiedPhoneNumbers', async () => {
await ReadyPage.load();
await HowItWorks.clickHowItWorksLink();
await driver.pause(3000);
await HowItWorks.clickNextButtonFourTimes();
const getStarted = await HowItWorks.getStartedButton;
await HowItWorks.clickButton(getStarted)
await driver.pause(3000);
const mobilePhoneNumber = await HowItWorks.enterMobilePhoneNumber;
await mobilePhoneNumber.addValue(testData.UNVERIFIED_PHONE_NUMBER);
const sendCode = await HowItWorks.enterSendVerificationCode;
await HowItWorks.clickButton(sendCode)
const backButton = await HowItWorks.backArrowPhoneVerification;
await HowItWorks.clickButton(backButton)
const deleteButton = await HowItWorks.deleteIcon;
await driver.pause(3000);
await HowItWorks.clickButton(deleteButton);
await expect(HowItWorks.alertMessage).toHaveText('Your phone number was deleted.');
console.log("Deleted unverified phone numbers")
});
});