forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.js
53 lines (43 loc) · 954 Bytes
/
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
import { driver, $ } from '@wdio/globals';
import { VOTER_DEVICE_ID as voterDeviceId } from '../config/browserstack.config';
export default class Page {
constructor () {
this.title = '';
}
get header () {
return $('#header-container');
}
get avatar () {
return $('#profileAvatarHeaderBar');
}
get footer () {
return $('#footer');
}
get isCordova () {
return driver.isMobile;
}
get isAndroid () {
return driver.isAndroid;
}
get isIOS () {
return driver.isIOS;
}
async open (path) {
await driver.url(path);
}
async getVoterDeviceId () {
const cookie = await driver.getCookies('voter_device_id');
if (cookie) {
const [{ value }] = cookie;
return value;
}
return null;
}
async signIn () {
if (voterDeviceId) {
const path = await driver.getUrl();
const query = `?cid=${voterDeviceId}`;
await this.open(path + query);
}
}
}