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
Merge remote-tracking branch 'origin/master' into JENKINS-37666
  • Loading branch information
scherler committed Sep 5, 2016
2 parents edcbedd + d3d4e58 commit 56f4188
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 48 deletions.
16 changes: 16 additions & 0 deletions PULL_REQUEST_TEMPLATE
@@ -0,0 +1,16 @@
# Description

See [JENKINS-XXXXX](https://issues.jenkins-ci.org/browse/JENKINS-XXXXX).

# Submitter checklist
- [ ] Link to JIRA ticket in description, if appropriate.
- [ ] Change is code complete and matches issue description
- [ ] Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.
- [ ] Ran Acceptance Test Harness against PR changes.

# Reviewer checklist
- [ ] Run the changes and verified the change matches the issue description
- [ ] Reviewed the code
- [ ] Verified that the appropriate tests have been written or valid explanation given

@jenkinsci/code-reviewers @reviewbybees
2 changes: 1 addition & 1 deletion src/main/js/page_objects/blueocean/bluePipelineBranch.js
Expand Up @@ -2,7 +2,7 @@ var url = require('../../util/url');

module.exports = {
elements: {
runButton: 'div.actions div.run-pipeline',
runButton: 'div.actions a.run-button',
toasts: 'div.toaster div.toast span.text'
}
};
Expand Down
124 changes: 77 additions & 47 deletions src/test/js/edgeCases/folder.js
Expand Up @@ -3,20 +3,21 @@ const path = require("path");
const fse = require('fs-extra');
const async = require("async");

// base configuration for the path of the folders
const folders = ['firstFolder', '三百', 'ñba', '七'];
const anotherFolders = ['anotherFolder', '三百', 'ñba', '七'];
// our job should be named the same way in both folders
const jobName = 'Sohn';

// git repo details
const pathToRepo = path.resolve('./target/test-project-folder');
const soureRep = './src/test/resources/multibranch_1';

// helper to return the project name including a seperator or '/'
function getProjectName(nameArray, seperator) {
if (!seperator) {
seperator = '/';
}
return nameArray.join(seperator) + seperator + jobName;
}

// here we need to escape the real projectName to a urlEncoded string
const projectName = getProjectName(anotherFolders, '%2F');

Expand All @@ -26,6 +27,7 @@ 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)
Expand All @@ -34,30 +36,39 @@ module.exports = {
},

'Create folder and then a freestyle job - "firstFolder"': function (browser) {
// Initial folder create page
const folderCreate = browser.page.folderCreate().navigate();
// create nested folder for the project
folderCreate.createFolders(browser, folders);
// create the freestyle job in the folder
folderCreate.createFreestyle(browser, folders.join('/'), jobName, 'freestyle.sh');
},

// JENKINS-36618 part 1 - create same job but in another folder
'Create folder and then a multibranch job - "anotherFolder"': function (browser) {
// Initial folder create page
const folderCreate = browser.page.folderCreate().navigate();
// create nested folder for the project
folderCreate.createFolders(browser, anotherFolders);
// go to the multibranch creation page
const branchCreate = browser.page.multibranchCreate().forJob(anotherFolders.join('/'));
// Let us create a multibranch object in the nested folders
branchCreate.createBranch(jobName, pathToRepo, anotherFolders.slice().shift());
},

// JENKINS-36618 part 2 - verify
'Jobs can have the same name in different folders, they should show up in the gui': function (browser) {
const bluePipelinesPage = browser.page.bluePipelines().navigate();
// simply validate that the pipline listing is showing the basic things
bluePipelinesPage.assertBasicLayoutOkay();
// by now we should have 2 different jobs from prior steps
bluePipelinesPage.countJobToBeEqual(browser, jobName, 2);
},

'Build freestyle job': function (browser) {
const freestyleJob = browser.page.jobUtils()
.forJob(getProjectName(folders));

// start a build on the nested freestyle project
freestyleJob.buildStarted(function () {
// Reload the job page and check that there was a build done.
freestyleJob
Expand All @@ -68,6 +79,7 @@ module.exports = {
browser.url(function (response) {
browser.assert.equal(typeof response, "object");
browser.assert.equal(response.status, 0);
// if we have changed the url then we should have now firstFolder in the path
browser.assert.equal(response.value.indexOf('firstFolder') > -1, true);
})
},
Expand All @@ -78,24 +90,28 @@ module.exports = {
// JENKINS-36773 / JENKINS-37605 verify encoding and spacing of details
blueRunDetailPage.assertTitle('jenkins / ' + anotherFolders.join(' / ') + ' / feature/1');
// FIXME JENKINS-36619 -> somehow the close in AT is not working
//blueRunDetailPage.closeModal(browser);
// blueRunDetailPage.closeModal(browser);
// JENKINS-36613 Unable to load steps for multibranch pipelines with / in them
blueRunDetailPage.validateGraph();
blueRunDetailPage.validateSteps(browser);
blueRunDetailPage.validateGraph(); // test whether we have a pipeline graph
blueRunDetailPage.validateSteps(browser); // validate that steps are displayed
// There should be no authors
blueRunDetailPage.authorsIsNotSet(browser);
},

'Check whether the artifacts tab shows artifacts': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 1);
// go to the artifact page by clicking the tab
blueRunDetailPage.clickTab(browser, 'artifacts');
// we have added 2 files as artifact
blueRunDetailPage.validateNotEmptyArtifacts(browser, 2);
},

// JENKINS-36674 Tests are not being reported
'Check whether the test tab shows failing tests': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 1);
// Go to the test page by clicking the tab
blueRunDetailPage.clickTab(browser, 'tests');
// There should be failing tests
blueRunDetailPage.validateFailingTests();
},

Expand All @@ -106,6 +122,9 @@ module.exports = {
const committs = Array.from(new Array(magic), function (x, i) {
return i;
});
// now we have to index the branch, it is important that we create the page out of the asyncSeries
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
var recordedCommits = 0;
// creating commits from that array with a mapSeries -> not parallel
async.mapSeries(committs, function (file, callback) {
Expand All @@ -131,30 +150,48 @@ module.exports = {

}, function(err, results) {
// results is an array of names
recordedCommits = results.length;
console.log(results.length, 'commits recorded')
console.log('Now starting the indexing', results.length, 'commits recorded')
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 2);
// click on the changes tab
blueRunDetailPage.clickTab(browser, 'changes');
// we should have one commits now
blueRunDetailPage.validateNotEmptyChanges(browser);
// the author title should be shown
blueRunDetailPage.authorsIsNotCondensed(browser);
// Wait for the job to end
blueRunDetailPage.waitForJobRunEnded(getProjectName(anotherFolders) + '/master');
});
console.log('Now starting the indexing', recordedCommits)
// now we have to index the branch
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 2);
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.validateNotEmptyChanges(browser);
blueRunDetailPage.authorsIsNotCondensed(browser);
},

// JENKINS-36615 the multibranch project has the branch 'feature/1'
'Jobs can be started from branch tab. - RUN': function (browser) {
// first get the activity screen for the project
const blueActivityPage = browser.page.bluePipelineActivity().forJob(projectName, 'jenkins');
// validate that we have 3 activities from the previous tests
blueActivityPage.assertActivitiesToBeEqual(browser, 3);
// change to the branch page, clicking on the tab
blueActivityPage.clickTab(browser, 'branches');
// click on the first matching run button (small one)
browser.page.bluePipelineBranch().clickRunButton(browser);
// go to the detail page
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 2);
// Wait for the job to end
blueRunDetailPage.waitForJobRunEnded(getProjectName(anotherFolders) + '/feature%2F1');
},

'Check whether the changes tab shows changes - condensed': function (browser) {
// magic number
// magic number of how many commits we want to create
const magic = 15;
// creating an array
const committs = Array.from(new Array(magic), function (x, i) {
return i;
});
var recordedCommits = 0;
// now we have to index the branch, it is important that we create the page out of the asyncSeries
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
// creating commits from that array with a mapSeries -> not parallel
async.mapSeries(committs, function (file, callback) {
const filename = file + '.txt';
Expand All @@ -168,7 +205,7 @@ module.exports = {
return git.createCommit(pathToRepo, [filename])
.then(function (commitId) {
// if we reached here we have a commit
console.log('commitId', commitId)
console.log('commitId', commitId);
/* We are sure that all async functions have finished.
* Now we let async know about it by
* callback without error and the commitId
Expand All @@ -179,30 +216,23 @@ module.exports = {

}, function(err, results) {
// results is an array of names
recordedCommits = results.length;
console.log(results.length, 'commits recorded')
console.log('Now starting the indexing', results.length, 'commits recorded')
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 3);
// click on the changes tab
blueRunDetailPage.clickTab(browser, 'changes');
// we should have a couple of commits now
blueRunDetailPage.validateNotEmptyChanges(browser);
// make sure the windows is small
browser.resizeWindow(1000, 600);
// test now whether the authors are not listed but condendes
blueRunDetailPage.authorsIsCondensed(browser);
// make the browser big again
browser.resizeWindow(1680, 1050);
// Wait for the job to end
blueRunDetailPage.waitForJobRunEnded(getProjectName(anotherFolders) + '/master');
});
console.log('Now starting the indexing', recordedCommits)
// now we have to index the branch
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 3);
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.validateNotEmptyChanges(browser);
blueRunDetailPage.authorsIsCondensed(browser);
},

// JENKINS-36615 the multibranch project has the branch 'feature/1'
'Jobs can be started from branch tab. - RUN': function (browser) {
const blueActivityPage = browser.page.bluePipelineActivity().forJob(projectName, 'jenkins');
blueActivityPage.assertActivitiesToBeEqual(browser, 4);
blueActivityPage.clickTab(browser, 'branches');
browser.page.bluePipelineBranch().clickRunButton(browser);
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 2);
blueRunDetailPage.waitForJobRunEnded(getProjectName(anotherFolders) + '/feature%2F1');
},

};

0 comments on commit 56f4188

Please sign in to comment.