This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX-JENKINS-39229_Regression_Initial_stage_run_does_not_show_graph] …
…add … (#79) * [JENKINS-39229_Regression_Initial_stage_run_does_not_show_graph] add test to cover edge case first run with no stage and then coming stage. * [JENKINS-39229_Regression_Initial_stage_run_does_not_show_graph] Fix description and shorten pipeline script.
- Loading branch information
Showing
5 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** @module waitForJobRunEnded | ||
* @memberof custom_commands | ||
* */ | ||
const util = require('util'); | ||
const events = require('events'); | ||
var sseClient = require('../api/sse'); | ||
|
||
function Cmd() { | ||
events.EventEmitter.call(this); | ||
} | ||
util.inherits(Cmd, events.EventEmitter); | ||
|
||
/** | ||
* @description Nightwatch command to wait for a stage event to be published. | ||
* @param {String} pipelineName - the name of the job we are waiting on | ||
* @param {Function} [onPipelineStageEvent] - callback to be invoke when finished, will pass the sse event to the callback | ||
* */ | ||
const waitForPipelineStageEvent = function (pipelineName, onPipelineStageEvent) { | ||
var self = this; | ||
|
||
console.log('Waiting for pipeline "' + pipelineName + '" stage event.'); | ||
sseClient.onPipelineStage(pipelineName, function(event) { | ||
console.log('Pipeline "' + pipelineName + '" stage event arrived.'); | ||
try { | ||
if (onPipelineStageEvent) { | ||
onPipelineStageEvent(event); | ||
} | ||
} finally { | ||
self.emit('complete'); | ||
} | ||
}); | ||
|
||
return this; | ||
}; | ||
Cmd.prototype.command = waitForPipelineStageEvent; | ||
|
||
module.exports = Cmd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** @module initialStage | ||
* @memberof edgeCases | ||
* @description | ||
* | ||
* Tests: test whether the stageGraph is rendered in the first run when the first step is not a stage | ||
* but afterward we will create stages | ||
* | ||
* REGRESSION covered: | ||
* | ||
* @see {@link https://issues.jenkins-ci.org/browse/JENKINS-39229|JENKINS-39229} Initial stage run does not show graph | ||
* | ||
* | ||
*/ | ||
const jobName = 'initialStage'; | ||
module.exports = { | ||
/** Create Pipeline Job "initialStage" */ | ||
'Step 01': function (browser) { | ||
const pipelinesCreate = browser.page.pipelineCreate().navigate(); | ||
pipelinesCreate.createPipeline(jobName, 'initialStage.groovy'); | ||
}, | ||
/** Build Pipeline Job*/ | ||
'Step 02': function (browser) { | ||
const pipelinePage = browser.page.jobUtils().forJob(jobName); | ||
pipelinePage.buildStarted(function () { | ||
// Reload the job page and check that there was a build done. | ||
pipelinePage | ||
.waitForElementVisible('div#pipeline-box') | ||
.forRun(1) | ||
.waitForElementVisible('@executer'); | ||
}); | ||
}, | ||
/** Check Job Blue Ocean Pipeline Activity Page has run */ | ||
'Step 03': function (browser) { | ||
const blueActivityPage = browser.page.bluePipelineActivity().forJob(jobName, 'jenkins'); | ||
// Check the run itself | ||
blueActivityPage.waitForRunRunningVisible('initialStage-1'); | ||
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(jobName, 'jenkins', 1); | ||
|
||
blueRunDetailPage.assertBasicLayoutOkay(); | ||
blueRunDetailPage.waitForPipelineStageEvent('initialStage', function () { | ||
blueRunDetailPage.validateGraph(); // test whether we have a pipeline graph | ||
blueRunDetailPage.waitForJobRunEnded(jobName); | ||
}); | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node { | ||
sh 'ping -c 5 www.spiegel.de' | ||
stage ('Build1') { | ||
sh 'ping -c 5 www.spiegel.de' | ||
} | ||
stage ('Build2') { | ||
sh 'ping -c 5 www.spiegel.de' | ||
} | ||
} |