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

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug/jenkins 43217 run details modal madness (#133)
* [JENKINS-43217] rewrite waitForLocationChange -> waitForLocationContains so it doesn't require the URL to actually change, as it could be brittle due to timing issues; rework "closeModal" page object command to just wait for the RunDetails-content element to go away; refactor the "runDetailsDeepLink" test to "runDetailsFallbackNavigation" and adjust to new API

* [JENKINS-43217] add a test case that ensures that navigating within run details and closing redirects back to the right URL

* [JENKINS-43217] make the steps more discrete

* [JENKINS-43217] better description for last step
  • Loading branch information
cliffmeyers committed Apr 6, 2017
1 parent c76bc7c commit 0354987
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/js/page_objects/blueocean/bluePipelineRunDetail.js
Expand Up @@ -153,9 +153,8 @@ module.exports.commands = [{
* Close the modal view
* @returns {Object} self - nightwatch page object
*/
closeModal: function (urlFragment) {
closeModal: function () {
const self = this;
const browser = self.api;
self.waitForElementVisible('@closeButton');
self.click('@closeButton');
self.waitForElementNotPresent('.RunDetails-content');
Expand Down
60 changes: 60 additions & 0 deletions src/test/js/runDetailsModal/runDetailsBackwardsNavigation.js
@@ -0,0 +1,60 @@
const path = require("path");
const jobName = 'runDetailsBackwardNavigation';
const pathToRepo = path.resolve('./target/' + jobName);
const soureRep = './src/test/resources/multibranch_2';
const git = require("../../../main/js/api/git");

var activity, branches, runDetails;

/**
* @module runDetailsBackwardNavigation
* @memberof runDetailsModal
* @description
*
* Tests: test whether navigating within run details and closing it returns to the correct page.
*
* REGRESSION covered: JENKINS-43217
*
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-43217|JENKINS-43217}
* Closing pipeline results "modal" after clicking on a stage sets the url incorrectly to the previous URL, not activity
*/
module.exports = {
before: function(browser, done) {
// we creating a git repo in target based on the src repo (see above)
git.createRepo(soureRep, pathToRepo)
.then(function () {
git.createBranch('feature/1', pathToRepo)
.then(done);
});
},
'Step 01 - Create Multibranch Job': function (browser) {
var multibranchCreate = browser.page.multibranchCreate().navigate();
multibranchCreate.createBranch(jobName, pathToRepo);
},
'Step 02 - navigate to Activity tab via URL': function (browser) {
activity = browser.page.bluePipelineActivity().forJob(jobName, 'jenkins');
activity.waitForElementVisible('.Header-pageTabs .branches');
},
'Step 03 - click to Branches tab': function(browser) {
activity.click('.Header-pageTabs .branches');
branches = browser.page.bluePipelineBranch();
branches.waitForElementVisible('tr[id^="master"]');
},
'Step 04 - click to Run Details': function(browser) {
branches.click('tr[id^="master"]');
runDetails = browser.page.bluePipelineRunDetail();
runDetails.waitForElementVisible('.RunDetailsHeader');
},
'Step 05 - click around Run Details tabs': function() {
runDetails.clickTab('changes');
runDetails.waitForLocationContains('/changes');
runDetails.clickTab('artifacts');
runDetails.waitForLocationContains('/artifacts');
runDetails.clickTab('tests');
runDetails.waitForLocationContains('/tests');
},
'Step 06 - close modal and confirm returned to Branches tab': function () {
runDetails.closeModal();
runDetails.waitForLocationContains('/branches');
}
};

0 comments on commit 0354987

Please sign in to comment.