Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
[JENKINS-36615] Add test for clicking on run button then on the emerg…
Browse files Browse the repository at this point in the history
…ing toast the open (#41)
  • Loading branch information
scherler committed Sep 16, 2016
1 parent 1a1a468 commit 8d50b41
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/main/js/page_objects/blueocean/bluePipelineActivity.js
Expand Up @@ -6,13 +6,21 @@
* const blueActivityPage = browser.page.bluePipelineActivity().forJob('my-pipeline', 'jenkins');
* */
const url = require('../../util/url');
const pageHelper = require('../../util/pageHelper');
//oh man, I miss es6 import :(
const sanityCheck = pageHelper.sanityCheck;

module.exports = {
elements: {
pipelinesNav: '.global-header nav a[href="/blue/pipelines"]',
emptyStateShoes: '.empty-state .empty-state-icon.shoes',
activityTable: '.activity-table',
activityTableEntries: 'table.activity-table tbody tr',
runButton: 'a.run-button',
toastOpenButton: {
selector: '//a[@class="action" and position()=1]',
locateStrategy: 'xpath',
},
}
};
module.exports.commands = [{
Expand Down Expand Up @@ -82,5 +90,24 @@ module.exports.commands = [{
browser.elements('css selector', 'table.activity-table tbody tr', function (codeCollection) {
this.assert.equal(codeCollection.value.length, expected);
});
},
/**
* On Activity Page click the run button, then click the open in toast
* and then validate that we are on the detail page
* @returns {Object} self - nightwatch page object
*/
clickRunButtonAndOpenDetail: function () {
var self = this;
const browser = this.api;
// first press the runButton
self.waitForElementVisible('@runButton');
self.click('@runButton');
// now press the toast "open" link
self.waitForElementVisible('@toastOpenButton');
self.click('@toastOpenButton', function (response) {
sanityCheck(self, response);
});
return self;
}
}];
}];
q
14 changes: 14 additions & 0 deletions src/test/js/smoke.js
Expand Up @@ -69,5 +69,19 @@ module.exports = {
var blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('my-pipeline', 'jenkins', 1);

blueRunDetailPage.assertBasicLayoutOkay();
},

/**
* On Activity Page click the run button, then click the open in toast
* and then validate that we are on the detail page.
* Regression test @see {@link https://issues.jenkins-ci.org/browse/JENKINS-38240|JENKINS-38240}
* @param browser
*/
'Step 05': function (browser) {
var blueActivityPage = browser.page.bluePipelineActivity().forJob('my-pipeline', 'jenkins');
blueActivityPage.clickRunButtonAndOpenDetail();
// Check the run itself
browser.page.bluePipelineRunDetail().assertBasicLayoutOkay();
}

};

0 comments on commit 8d50b41

Please sign in to comment.