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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into JENKINS-37954
Browse files Browse the repository at this point in the history
  • Loading branch information
scherler committed Sep 6, 2016
2 parents ef93f89 + 44b78aa commit 5e890e4
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -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",
Expand Down
44 changes: 44 additions & 0 deletions src/main/js/page_objects/blueocean/bluePipelineRunDetail.js
Expand Up @@ -21,6 +21,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',
},
}
};

Expand Down Expand Up @@ -222,5 +230,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;
}

}];
43 changes: 43 additions & 0 deletions src/test/js/failing.js
@@ -0,0 +1,43 @@
const JOB = 'noStagesFail';
module.exports = {
// create a simple pipeline, that will produce a failure
'Create Pipeline Job "noStagesFail"': function (browser) {
const pipelinesCreate = browser.page.pipelineCreate().navigate();
// we have used the noStages script as basis
pipelinesCreate.createPipeline(JOB, 'noStagesFailing.groovy');
},

'Build Pipeline Job': function (browser) {
const pipelinePage = browser.page.jobUtils().forJob('noStagesFail');
// start to build the pipeline
pipelinePage.buildStarted(function() {
// Reload the job page and check that there is a build started.
pipelinePage
.waitForElementVisible('div#pipeline-box')
.forRun(1)
.waitForElementVisible('@executer');
});
},
// now tesinting JENKINS-37666
'Check whether the resultItemas are collapsing as expected.': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(JOB, 'jenkins', 1);
// we want to analyse the result after the job has finished
browser.waitForJobRunEnded(JOB, function() {
// the failure should collapse
blueRunDetailPage.clickFirstResultItemFailure(false);
// test whether the expand works
blueRunDetailPage.clickFirstResultItem();
// now click again so the result collapse again
blueRunDetailPage.clickFirstResultItem(false);
// now click the node again and see whether only one code is visible
blueRunDetailPage.clickFirstResultItem();
// we now need to get all visible code blocks, but there should be no more then one
browser.elements('css selector', 'code', function (codeCollection) {
this.assert.equal(typeof codeCollection, "object");
this.assert.equal(codeCollection.status, 0);
this.assert.equal(codeCollection.value.length, 1);
});

});
}
};
7 changes: 1 addition & 6 deletions src/test/js/log-karaoke/stages.js
Expand Up @@ -41,12 +41,7 @@ module.exports = {
})
;
// test whether the expand works
nodeDetail.waitForElementVisible('div.result-item')
.click('div.result-item')
.waitForElementVisible('code')
.getText('code', function (result) {
this.assert.notEqual(null, result.value);
});
nodeDetail.clickFirstResultItem();
// test whether the stage we seeing is highlighted
nodeDetail.waitForElementVisible('g.pipeline-node-selected');
// test whether log lines are navigatable
Expand Down
13 changes: 13 additions & 0 deletions src/test/resources/test_scripts/noStagesFailing.groovy
@@ -0,0 +1,13 @@
node {
echo 'first step'
sh 'sleep 1; echo `date` first;'
echo 'first step end'
echo 'Second coming up'
sh 'sleep 1; echo `date` second;'
echo '9th'
sh 'sleep 1; echo `date`;'
echo '10th'
sh 'sleep 1; echo `date`;'
echo 'and we are finished'
sh 'echo end; error 1'
}

0 comments on commit 5e890e4

Please sign in to comment.