Skip to content
Permalink
Browse files

Merge remote-tracking branch 'origin/master' into JENKINS-37323

  • Loading branch information...
scherler committed Sep 7, 2016
2 parents d1ebf33 + 44b78aa commit d3b6e5710b61371256067ffd17aeafc061b748a3
@@ -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,14 +2,14 @@ Acceptance tests for Blue Ocean

# Prepare your system

## Install xmllint
## Install xmllint/libssl-dev

You need to install xmllint prior of running the server!
You need to install xmllint and libssl-dev prior of running the server!

In debian:

```
apt-get install libxml2-utils
apt-get install libxml2-utils libssl-dev
```

# Building
@@ -20,17 +20,17 @@
"homepage": "https://github.com/cloudbees/blueocean-acceptance-test#readme",
"devDependencies": {
"@jenkins-cd/sse-gateway": "0.0.7",
"events": "1.1.0",
"events": "1.1.1",
"eventsource": "0.2.1",
"fs-extra": "^0.30.0",
"gulp": "^3.9.1",
"gulp-shell": "^0.5.2",
"nightwatch": "0.9.1",
"phantomjs-prebuilt": "2.1.7",
"request": "2.72.0",
"nightwatch": "0.9.8",
"nodegit": "^0.14.1",
"phantomjs-prebuilt": "2.1.12",
"request": "2.74.0",
"util": "0.10.3",
"xmlhttprequest": "1.8.0",
"fs-extra": "^0.30.0",
"nodegit": "^0.13.2"
"xmlhttprequest": "1.8.0"
},
"dependencies": {
"async": "^2.0.1",
@@ -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'
}
};
@@ -20,6 +20,14 @@ module.exports = {
changes: 'table.changeset-table tr',
tests: 'div.new-failure-block div.result-item',
authors: 'a.authors',
firstResult: {
selector: '//div[contains(@class, "result-item") and position()=1]',
locateStrategy: 'xpath',
},
firstErrorResult: {
selector: '//div[contains(@class, "failure") and position()=1]',
locateStrategy: 'xpath',
},
}
};

@@ -216,5 +224,41 @@ module.exports.commands = [{
self.waitForElementVisible('@tests');
return self;
},
clickFirstResultItem: function (expand) {
var self = this;
if (expand === undefined ) {
expand = true;
}
self
.waitForElementVisible('@firstResult')
.click('@firstResult');

if (expand) {
self
.waitForElementVisible('code')
.getText('code', function (result) {
this.assert.notEqual(null, result.value);
});
}

return self;
},
clickFirstResultItemFailure: function (expand) {
var self = this;
if (expand === undefined) {
expand = true;
}
self
.waitForElementVisible('@firstErrorResult')
.click('@firstErrorResult')
if (expand) {
self.waitForElementVisible('code')
.getText('code', function (result) {
this.assert.notEqual(null, result.value);
});
}

return self;
}

}];
@@ -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');

@@ -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)
@@ -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
@@ -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);
})
},
@@ -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();
},

@@ -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) {
@@ -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';
@@ -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
@@ -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 d3b6e57

Please sign in to comment.
You can’t perform that action at this time.