-
Notifications
You must be signed in to change notification settings - Fork 526
/
bluePipelines.js
52 lines (48 loc) · 1.76 KB
/
bluePipelines.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
/** @module bluePipelines
* @memberof page_objects
* @description Represents the listing of all pipelines in blueocean
*
* @example
* var bluePipelinesPage = browser.page.bluePipelines().navigate();
* */
const url = require('../../util/url');
const pipelinesUrl = url.viewAllPipelines();
function pipelineRowSelector(pipeline) {
return `.pipelines-table .JTable-row[data-pipeline='${pipeline}']`;
}
module.exports = {
url: function () {
return this.api.launchUrl + pipelinesUrl;
},
elements: {
pipelinesNav: '.Header-topNav nav a[href="'+pipelinesUrl+'"]',
newPipelineButton: '.btn-new-pipeline',
pipelinesTable: '.pipelines-table',
}
};
// Nightwatch commands.
// http://nightwatchjs.org/guide#writing-commands
// Seems like we could use a Nightwatch assertions for some of these, but then that would be global.
// Prefer it this way, local to the page.
module.exports.commands = [{
/**
* Different test on general elements that should be visible on the page
* @returns {Object} self - nightwatch page object
*/
assertBasicLayoutOkay: function() {
this.waitForElementVisible('@pipelinesNav');
this.waitForElementVisible('@pipelinesTable');
this.waitForElementVisible('.Site-footer');
},
assertJob: function(jobName) {
this.waitForElementVisible(pipelineRowSelector(jobName));
},
countJobToBeEqual: function(browser, jobName, count) {
browser.elements('css selector', pipelineRowSelector(jobName), function (codeCollection) {
this.assert.equal(codeCollection.value.length, count);
});
},
navigateLanguage: function(language) {
return this.navigate(this.api.launchUrl + pipelinesUrl + '?language=' + language);
}
}];