Skip to content
Permalink
Browse files

[JENKINS-37427] Check to make sure we are linking to classic Jenkins (#…

  • Loading branch information
imeredith committed Jan 16, 2017
1 parent 8bcd097 commit da4e667f405150d02f9d8883934e7e06864bc5ab
Showing with 72 additions and 0 deletions.
  1. +52 −0 src/main/js/page_objects/classic_jenkins/matrixCreate.js
  2. +20 −0 src/test/js/matrix.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');
},
}];
@@ -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.
You can’t perform that action at this time.