forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscuss.page.js
100 lines (79 loc) · 2.18 KB
/
discuss.page.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
import { $ } from '@wdio/globals';
import Page from './page';
class DiscussPage extends Page {
constructor () {
super().title = 'Discuss - We Vote';
}
async load () {
await super.open('/news');
// await super.maximizeWindow();
// await super.rerender();
}
get signInTitle () {
return $('#pleaseSignInTitle');
}
get signInSubtitle () {
return $('#signInSubtitle');
}
get textTestAuthor () {
return $('#testimonialText');
}
get termsWrapper () {
return $('#terms_Wrapper');
}
get testImoniaAuthor () {
return $('#testimonial_Author');
}
get openTermsOfService () {
return $('#openTermsOfService');
}
get openPrivacyPolicy () {
return $('#openPrivacyPolicy');
}
get avatarCard () {
return $('#card_main_avatar');//
}
get emailAddressSidebarFriendsTextBox () {
return $('#EmailAddress-sidebar');
}
get voterEmailAddressVerificationButton () {
return $('#voterEmailAddressEntrySendCode');
}
get inviteFriendsNextsButton () {
return $('#friendsNextButton-sidebar');
}
get cancelEmailButton () {
return $('#cancelEmailButton');
}
get enterVoterEmailAddressTextBox () {
return $('#enterVoterEmailAddress');
}
get voterEmailAddressHelperText () {
return $('#enterVoterEmailAddress-helper-text');
}
get voterEmailAddressLabel () {
return $('#enterVoterEmailAddress-label');
}
async toggleEmailVerificationButton () {
await this.voterEmailAddressVerificationButton.findAndClick();
}
async tabToSelectElement(driver, targetElementId) {
// Max number of iterations to find target element.
// Prevents waiting for a timeout when the element is missing or unreachable.
const maxCount = 100;
let count = 0;
let activeElement;
let activeElementId;
do {
await driver.keys(['Tab']);
activeElement = await driver.getActiveElement();
activeElementId = await (await $(activeElement)).getProperty('id');
if (targetElementId === activeElementId) {
return $(activeElement);
}
++count;
} while (activeElementId !== targetElementId && count <= maxCount);
return null;
}
}
export default new DiscussPage();