forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaq.page.js
148 lines (119 loc) · 3.73 KB
/
faq.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
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
import { $, $$, driver } from '@wdio/globals';
import Page from './page';
class FAQPage extends Page {
constructor () {
super().title = 'FAQ - WeVote';
}
async load () {
await super.open('/more/faq');
await super.maximizeWindow();
await super.rerender();
}
get getFAQPageTitleElement () {
return $('.kkIyuQ');
}
get getTwitterIconElement () {
return $('#wevoteTwitter');
}
get getFacebookIconElement () {
return $('#wevoteFacebook');
}
get getInstagramIconElement () {
return $('#wevoteInstagram');
}
get getWeVoteElementFromInstagram () {
return $('//h2[contains(text(), "wevote")]');
}
get getEmailIconElement () {
return $('#eepurl');
}
get getGitHubIconElement () {
return $$('//a[@href = "https://github.com/WeVote"]');
}
get getBlogIconElement () {
return $('#wevoteBlog');
}
get getValueLinkElement () {
return $$('//a[@id = "helpSiteValues"]');
}
async clickValueLink () {
const selectorToGetValueElements = '//a[@id = "helpSiteValues"]';
const arrOfElements = [];
for (let i = 1; i <= $$(selectorToGetValueElements).length; i++) {
$(`(${selectorToGetValueElements})[${i}]`).click();
const windowHandles = driver.getWindowHandles();
driver.switchToWindow(windowHandles[1]);
const textFromElement = driver.getTitle();
arrOfElements.push(textFromElement);
driver.closeWindow();
driver.switchWindow('https://quality.wevote.us/more/faq');
}
return arrOfElements;
}
get getWeVoteEducationWebsiteElement () {
return $('#weVoteEducationWebsite');
}
get getWeVoteUSAWebsiteElement () {
return $('#weVoteUSAWebsite');
}
get getWeVoteVolunteerElements () {
return $$('//a[@href = "https://wevote.applytojob.com/apply"]');
}
async clickVolunteerOpeningsLinks () {
//const selectorToGetElements = '//a[@href = "https://wevote.applytojob.com/apply"]';
const selectorToGetElements = await this.getWeVoteVolunteerElements;
const arrOfElements = [];
for (let i = 1; i <= $$(selectorToGetElements).length; i++) {
$(`(${selectorToGetElements})[${i}]`).click();
driver.switchWindow('https://wevote.applytojob.com/apply');
const textFromElement = driver.getTitle();
arrOfElements.push(textFromElement);
// driver.switchWindow('https://quality.wevote.us/more/faq');
}
return arrOfElements;
}
get getAboutPageTitleElement () {
return $('#weVoteAboutUsPage');
}
get getWeVoteContactUsFormElement () {
return $('#weVoteContactUsPage');
}
get getWeVoteIPhoneLinkElement () {
return $('#weVoteIPhone');
}
get getWeVoteAndroidLinkElement () {
return $('#weVoteAndroid');
}
get getPleaseDonateElement () {
return $('[href="/donate"]');
}
get getVolunteerElement () {
return $('#idealistOpenPositions');
}
get getLetsGetStartedElement () {
return $('//a[contains(text(), "get started!")]');
}
async waitForURL(expectedURL){
driver.waitUntil(async()=>{
await driver.switchWindow(expectedURL);
const currenturl= await driver.getUrl();
return currenturl=== expectedURL;
},{
timeout: 10000,
timeoutMsg: 'Expected URL not found'
});
}
async clickGitHubIconAndLinks () {
const selectorToGetElements = '//a[@href = "https://github.com/WeVote"]';
const arrOfElements = [];
for (let i = 1; i <= $$(selectorToGetElements).length; i++) {
$(`(${selectorToGetElements})[${i}]`).click();
driver.switchWindow('https://github.com/WeVote');
const textFromElement = driver.getTitle();
arrOfElements.push(textFromElement);
driver.switchWindow('https://quality.wevote.us/more/faq');
}
return arrOfElements;
}
}
export default new FAQPage();