forked from fossasia/open-event-wsgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrackPage.js
More file actions
42 lines (33 loc) · 1.46 KB
/
trackPage.js
File metadata and controls
42 lines (33 loc) · 1.46 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
var BasePage = require('./basePage.js');
var By = require('selenium-webdriver').By;
var until = require('selenium-webdriver').until;
var TrackPage = Object.create(BasePage);
TrackPage.getNoOfVisibleSessionElems = function() {
var self = this;
return self.findAll(By.className('room-filter')).then(self.getElemsDisplayStatus).then(function(displayArr) {
return self.countOnesInArray(displayArr);
});
};
TrackPage.checkIsolatedBookmark = function() {
// Sample sessions having ids of 3014 and 3015 being checked for the bookmark feature
var sessionIdsArr = ['3014', '3015'];
var self = this;
// Bookmark the sessions, scrolls down the page and then count the number of visible session elements
return self.toggleSessionBookmark(sessionIdsArr).then(self.toggleStarredButton.bind(self)).then(function() {
return self.driver.executeScript('window.scrollTo(0, 400)').then(self.getNoOfVisibleSessionElems.bind(self));
});
};
TrackPage.toggleSessionElem = function() {
var self = this;
// Checking the toggle behaviour of session having id 3014
var promise = new Promise(function(resolve) {
self.find(By.id('title-3014')).then(self.click).then(self.driver.sleep(1000)).then(function() {
var promiseArr = [];
promiseArr.push(self.find(By.id('desc-3014')).isDisplayed());
promiseArr.push(self.find(By.id('desc2-3014')).isDisplayed());
resolve(Promise.all(promiseArr));
});
});
return promise;
};
module.exports = TrackPage;