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

Commit

Permalink
Feature/jenkins 38597 create from git ath (#114)
Browse files Browse the repository at this point in the history
* [JENKINS-38597] first draft of simple test for Git Creation flow

* [JENKINS-38597] add selectors to page object

* [JENKINS-38597] cleanup

* [JENKINS-38597] make more resilient to timing issues by waiting for success, rather than running
  • Loading branch information
cliffmeyers committed Feb 10, 2017
1 parent 5505c9b commit 3469b9c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/js/page_objects/blueocean/bluePipelineCreate.js
@@ -0,0 +1,29 @@
/**
* @module blueCreate
* @memberof page_objects
* @description Represents the "create pipeline" page
*
* @example
* var blueCreatePage = browser.page.bluePipelineCreate().navigate();
* */
const url = require('../../util/url');

module.exports = {
url: function() {
return this.api.launchUrl + url.createPipeline();
},
elements: {
gitCreationButton: '.scm-provider-list .git-creation',
repositoryUrlText: '.text-repository-url input',
newCredentialTypeSystemSSh: '.credentials-type-picker .RadioButtonGroup-item:nth-child(3)',
createButton: '.git-step-connect .button-create-pipeline',
openPipelineButton: '.git-step-completed .button-open-pipeline',
}
};

module.exports.commands = [{
assertCompleted: function() {
this.waitForElementVisible('.git-step-completed');
this.waitForElementVisible('@openPipelineButton');
}
}];
7 changes: 7 additions & 0 deletions src/main/js/util/url.js
Expand Up @@ -93,4 +93,11 @@ module.exports = {
});
return self;
},
/**
* get the url to create a pipeline
* @returns {string}
*/
createPipeline: function() {
return '/blue/create-pipeline/';
},
};
42 changes: 42 additions & 0 deletions src/test/js/creation/git/localRepo.js
@@ -0,0 +1,42 @@
/**
* @module localRepo
* @memberof git
* @description
*
* Tests: test that creating a pipeline from a local Git repo works
*/
const git = require("../../../../main/js/api/git");
const path = require("path");

const jobName = 'test-project-folder';
const pathToRepo = path.resolve('./target/' + jobName);
const sourceRep = './src/test/resources/multibranch_2';


module.exports = {
before: function(browser, done) {
browser.waitForJobDeleted(jobName, function () {
git.createRepo(sourceRep, pathToRepo)
.then(function () {
git.createBranch('feature/alpha', pathToRepo)
.then(done);
});
});
},

'Step 01 - Create Pipeline': function (browser) {
const create = browser.page.bluePipelineCreate().navigate();
create.waitForElementVisible('.scm-provider-list');
create.click('@gitCreationButton');
create.waitForElementVisible('.git-step-connect');
create.setValue('@repositoryUrlText', pathToRepo);
create.click('@newCredentialTypeSystemSSh');
create.click('@createButton');
create.assertCompleted();
},
'Step 02 - Check Activity Tab': function (browser) {
const activity = browser.page.bluePipelineActivity().forJob(jobName, 'jenkins');
activity.assertBasicLayoutOkay();
activity.waitForRunSuccessVisible(jobName + '-1');
}
};

0 comments on commit 3469b9c

Please sign in to comment.