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

Commit

Permalink
[JENKINS-36660] Extending multibranch AT implementing creation of job
Browse files Browse the repository at this point in the history
  • Loading branch information
scherler committed Aug 23, 2016
1 parent 97f2d75 commit 14873ea
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
54 changes: 54 additions & 0 deletions src/main/js/page_objects/classic_jenkins/multibranchCreate.js
@@ -0,0 +1,54 @@
// Pipeline create (new item) page object (http://nightwatchjs.org/guide#page-objects)
const suffix = 'newJob';

module.exports = {
url: function () {
return this.api.launchUrl + '/view/All/' + suffix;
},
elements: {
nameInput: '#name',
multibranchType: 'li.org_jenkinsci_plugins_workflow_multibranch_WorkflowMultiBranchProject',
submit: '#ok-button',
save: 'span.yui-button[name="Submit"]',
button: {
selector: '//button[@path="/hetero-list-add[sources]"]',
locateStrategy: 'xpath',
},
scriptHook: {
selector: '//input[@path="/sources/source/remote"]',
locateStrategy: 'xpath',
},
gitA: {
selector: '//a[text()="Git"]',
locateStrategy: 'xpath',
}
}
};

// Nightwatch commands.
// http://nightwatchjs.org/guide#writing-commands
module.exports.commands = [{

createBranch: function (browser, folderName, path) {
var self = this;

self.waitForJobDeleted(folderName);

self.setValue('@nameInput', folderName);

self.waitForElementPresent('@multibranchType');
self.click('@multibranchType');
self.waitForElementPresent('@submit');
self.click('@submit');
self.waitForElementPresent('@button');
self.click('@button');
self.waitForElementPresent('@gitA');
self.click('@gitA');
self.waitForElementPresent('@scriptHook');
self.setValue('@scriptHook', path);

self.waitForElementPresent('@save')
.click('@save');

},
}];
4 changes: 3 additions & 1 deletion src/test/js/multibranch.js
Expand Up @@ -9,13 +9,15 @@ module.exports = {
beforeEach: function (browser, done) {
git.createRepo('./src/test/resources/multibranch_1', pathToRepo)
.then(function() {
git.createBranch('feature-1', pathToRepo)
git.createBranch('feature/1', pathToRepo)
.then(done);
});
},

'Create Multbranch Job': function (browser) {
console.log('*** test!!');
const folderCreate = browser.page.multibranchCreate().navigate();
folderCreate.createBranch(browser, 'multiBranch', pathToRepo);
browser.end();
}
};

0 comments on commit 14873ea

Please sign in to comment.