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

Commit

Permalink
Another test for JENKINS-39842 for @kzantow
Browse files Browse the repository at this point in the history
Using folder and job/branch names that are not confusing (special chars etc). BTW I'm leaving the original tests that were using weird chars because I think it's good to have tests that challenge the url encoding etc. Sure that can result in the presence of weird chars, but weird chars are a fact of life, so good to test against them.
  • Loading branch information
tfennelly committed Jan 6, 2017
1 parent 60f5e89 commit a5a3fd7
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/js/edgeCases/folder.js
Expand Up @@ -12,7 +12,7 @@
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-36613|JENKINS-36613} Unable to load steps for multibranch pipelines with / in them
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-36674|JENKINS-36674} Tests are not being reported
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-36615|JENKINS-36615} the multibranch project has the branch 'feature/1'
*
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-39842|JENKINS-39842} - Open Blue Ocean button should not try to load /activity for a folder
*
*/
const git = require("../../../main/js/api/git");
Expand Down Expand Up @@ -210,7 +210,7 @@ module.exports = {
* It should send the user to the top level blue ocean page (pipelines).
* @param browser
*/
'step 11': function(browser) {
'step 12': function(browser) {
var classicGeneral = browser.page.classicGeneral();

// Go to a folder along the path to the MBP, but one
Expand Down
107 changes: 107 additions & 0 deletions src/test/js/multibranch/folder.js
@@ -0,0 +1,107 @@
/** @module folder
* @memberof multibranch
* @description
*
* Tests: Tests specific to MBP in folders
*
* REGRESSION covered:
*
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-39842|JENKINS-39842} - Open Blue Ocean button should not try to load /activity for a folder
*
*/
const git = require("../../../main/js/api/git");
const path = require("path");
const pageHelper = require("../../../main/js/util/pageHelper");
const sanityCheck = pageHelper.sanityCheck;

// base configuration for the path of the folders
const projectFolderPath = ['aFolder', 'bFolder', 'cFolder'];
// our job should be named the same way in both folders
const jobName = 'MBPInFolderTree';
// git repo details
const pathToRepo = path.resolve('./target/test-project-folder');
const soureRep = './src/test/resources/multibranch_1';

module.exports = {
/**
* creating a git repo
*/
before: function (browser, done) {
browser.waitForJobDeleted('aFolder', function () {
// 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);
});
});
},
/**
* Create folder structure - "aFolder/bFolder/cFolder"
*/
'step 01': function (browser) {
// Initial folder create page
const folderCreate = browser.page.folderCreate().navigate();
// create nested folder for the project
folderCreate.createFolders(projectFolderPath);
},
/**
* Create multibranch job - "MBPInFolderTree"
*/
'step 02': function (browser) {
// go to the newItem page
browser.page.jobUtils().newItem();
// and then use the multibranchCreate page object to create
// a multibranch project
browser.page.multibranchCreate().createBranch(jobName, pathToRepo);
},
/**
* test open blueocean from classic - run details
* @param browser
*/
'step 03': function(browser) {
var classicRunPage = browser.page.classicRun();

classicRunPage.navigateToRun('aFolder/job/bFolder/job/cFolder/job/MBPInFolderTree/job/master');

// make sure the open blue ocean button works. In this case,
// it should bring the browser to the run details page for the first run.
browser.openBlueOcean();
browser.url(function (response) {
sanityCheck(browser, response);
response.value.endsWith('/blue/organizations/jenkins/aFolder%2FbFolder%2FcFolder%2FMBPInFolderTree/branches/');

// Make sure the page has all the bits and bobs
// See JENKINS-40137
const blueRunDetailPage = browser.page.bluePipelineRunDetail();
blueRunDetailPage.assertBasicLayoutOkay();
});
},
/**
* test open blueocean from classic - a normal folder page in classic jenkins.
* <p>
* It should send the user to the top level blue ocean page (pipelines).
* @param browser
*/
'step 04': function(browser) {
var classicGeneral = browser.page.classicGeneral();

// Go to a folder along the path to the MBP, but one
// of the parent folders i.e. not the MBP project folder.
classicGeneral.navigateToRun('job/aFolder/job/bFolder');

// make sure the open blue ocean button works. In this case,
// it should bring the browser to the main top-level pipelines page.
// See https://issues.jenkins-ci.org/browse/JENKINS-39842
browser.openBlueOcean();
browser.url(function (response) {
sanityCheck(browser, response);
response.value.endsWith('/blue/pipelines');

// Make sure the page has all the bits and bobs
// See JENKINS-40137
const bluePipelines = browser.page.bluePipelines();
bluePipelines.assertBasicLayoutOkay();
});
},
};

0 comments on commit a5a3fd7

Please sign in to comment.