Skip to content
Permalink
Browse files
Merge remote-tracking branch 'origin/master' into JENKINS-39761-perfo…
…rmance-bluerun
  • Loading branch information
imeredith committed Dec 7, 2016
2 parents a7c98cf + 7959871 commit e8551919acb1016a029b0cc9147c32cc6df7b352
Showing with 120 additions and 0 deletions.
  1. +101 −0 src/test/js/failingStages.js
  2. +19 −0 src/test/resources/test_scripts/stagesFailing.groovy
@@ -0,0 +1,101 @@
const JOB = 'stagesFail';
/** @module failingStages
* @memberof testcases
* @description Tests around a failing pipeline with stages, and re-running in place.
*/
module.exports = {
/**
* Create a simple pipeline, that will produce a failure
* @param browser
*/
'Step 01': function (browser) {
const pipelinesCreate = browser.page.pipelineCreate().navigate();
// we have used the noStages script as basis
pipelinesCreate.createPipeline(JOB, 'stagesFailing.groovy');
},

/**
* Build Pipeline Job
* @param browser
*/
'Step 02': function (browser) {
const pipelinePage = browser.page.jobUtils().forJob(JOB);
// 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');
});
},
/**
* Check whether the resultItemas are collapsing as expected.
* @param browser
*/
// now testing JENKINS-37666
'Step 03': 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);
// JENKINS-36700 in fail all code should be closed besides one
// however if the browser is too quick there can still be two open
this.assert.equal(codeCollection.value.length <= 2, true);
});


});

},

/**
* Check that the failed item shows up and has a replay icon
*/
'Step 04' : function(browser) {
var blueActivityPage = browser.page.bluePipelineActivity().forJob(JOB, 'jenkins');
blueActivityPage.waitForRunFailureVisible(JOB + '-1');
blueActivityPage.waitForElementVisible('.replay-button');
},

/**
* As it has failed, we can rerun the job, check that it runs, and then result is still failure.
*/
'Step 05' : function(browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(JOB, 'jenkins', 1);

//click the re run button
blueRunDetailPage.waitForElementVisible('.result-item.failure.expanded');
blueRunDetailPage.clickReRunButton();
blueRunDetailPage.waitForElementNotPresent('.result-item.failure.expanded');

//Ccheck that it runs and we could stop if if we want to
blueRunDetailPage.waitForElementVisible('.progress-spinner');
blueRunDetailPage.waitForElementPresent('.stop-button');

//check that we see a stage graph:
blueRunDetailPage.waitForElementVisible('.progress-spinner.running');
blueRunDetailPage.waitForElementVisible('.header.running')
blueRunDetailPage.waitForElementVisible('.pipeline-node-selected');
blueRunDetailPage.waitForElementVisible('.download-log-button');
blueRunDetailPage.waitForElementVisible('.pipeline-selection-highlight');
blueRunDetailPage.waitForElementVisible('.pipeline-connector');
blueRunDetailPage.waitForElementVisible('.pipeline-node-hittarget');

// this will show up when it has finished replaying
blueRunDetailPage.waitForElementVisible('.replay-button');
blueRunDetailPage.waitForElementVisible('.result-item.failure.expanded');

}
};
@@ -0,0 +1,19 @@
node {
stage('first') {
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'
}
stage('second') {
sh 'sleep 1; echo `date`;'
echo '10th'
sh 'sleep 1; echo `date`;'
echo 'and we are finished'
}
stage('final') {
sh 'echo end; error 1'
}
}

0 comments on commit e855191

Please sign in to comment.