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

Commit

Permalink
[JENKINS-37427] Check to make sure we are linking to classic Jenkins (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
imeredith committed Jan 16, 2017
1 parent 8bcd097 commit da4e667
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/main/js/page_objects/classic_jenkins/matrixCreate.js
@@ -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');
},
}];
20 changes: 20 additions & 0 deletions src/test/js/matrix.js
@@ -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}/")]`)
}
}

0 comments on commit da4e667

Please sign in to comment.