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.
[JENKINS-37427] Check to make sure we are linking to classic Jenkins (#…
…99)
- Loading branch information
Showing
2 changed files
with
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** @module matrixCreate | ||
* @memberof page_objects | ||
* @description Represents the matrix creation page of classic jenkins. | ||
* | ||
* */ | ||
|
||
module.exports = { | ||
url: function () { | ||
return this.api.launchUrl + '/view/All/newJob'; | ||
}, | ||
elements: { | ||
nameInput: '#name', | ||
matrixType: 'li.hudson_matrix_MatrixProject', | ||
submit: '#newFormSubmitButtonForATH', | ||
jobIndexPageHeader: 'h1.matrix-project-headline' | ||
} | ||
}; | ||
|
||
module.exports.commands = [{ | ||
/** | ||
* Returns the create matrix page for a certain job and creates the matrix job | ||
* @param jobName {String} name of the job to configure | ||
* @param {Function} [oncreated] - callback to be invoke when finished, will expect a traditional node callback function | ||
*/ | ||
createMatrix: function(jobName, oncreated) { | ||
var self = this; | ||
|
||
self.waitForJobDeleted(jobName); | ||
|
||
self.setValue('@nameInput', jobName); | ||
self.waitForElementPresent('@submit'); | ||
self.click('@matrixType'); | ||
self.click('@submit'); | ||
|
||
if (!oncreated) { | ||
// If no oncreated function was supplied then we manufacture | ||
// a dummy. This ensures that this function does not return | ||
// immediately. | ||
oncreated = function() {}; | ||
} | ||
|
||
// Reusing the freeStyle config code atm since we arent actaully doing anything specific. | ||
self.api.page.freestyleConfig() | ||
.moveClassicBottomStickyButtons() | ||
// .setFreestyleScript(script) | ||
.click('@save'); | ||
|
||
// Wait for the signal that the config page has saved | ||
// and we're back on the job index page. | ||
self.waitForElementPresent('@jobIndexPageHeader'); | ||
}, | ||
}]; |
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,20 @@ | ||
const jobName = 'matrixJob'; | ||
/** @module matrix | ||
* @memberof matrix | ||
* @description Tests that matrix jobs link to classic jenkins. | ||
*/ | ||
module.exports = { | ||
/** Create matrix Job */ | ||
'Create job': (browser) => { | ||
const matrixCreate = browser.page.matrixCreate().navigate(); | ||
matrixCreate.createMatrix(jobName); | ||
}, | ||
|
||
'Check matrix link': (browser) => { | ||
const pipelinePage = browser.page.bluePipelines().navigate(); | ||
|
||
pipelinePage.waitForElementVisible('.pipelineRedirectLink'); | ||
|
||
browser.useXpath().waitForElementVisible(`//*/a[@class="pipelineRedirectLink" and contains(@href, "/job/${jobName}/")]`) | ||
} | ||
} |