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

Commit

Permalink
[JENKINS-40740] Ath tets to cover missing run data
Browse files Browse the repository at this point in the history
  • Loading branch information
imeredith committed Jan 23, 2017
1 parent f6e099c commit ec10c43
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/main/js/custom_commands/waitForElementVisibleThenClick.js
@@ -0,0 +1,8 @@
/**
* Wait for an element to be visible then click it.
*/
exports.command = function (element) {
this.waitForElementVisible(element);
this.click(element);
return this;
};
47 changes: 42 additions & 5 deletions src/test/js/multibranch/noRunsActivityPage.js
@@ -1,24 +1,61 @@
const jobName = 'noRunsActivityPage';
const tmp = require('tmp');

const repo = tmp.dirSync();
const pathToRepo = repo.name;
const path = require("path");
const sourceRep = './src/test/resources/multibranch/test_results';
const git = require("../../../main/js/api/git");


/** @module failing
* @memberof testcases
* @description TEST: basic tests around the failing pipeline. Test whether the result is not collapsed.
*/
module.exports = {
// ** creating a git repo */
before: (browser, done) => {
// we creating a git repo in target based on the src repo (see above)
git.createRepo(sourceRep, pathToRepo).then(done);
},
/**
* Create Multibranch Pipeline Job "noRunsActivityPage" with no branches.
* @param browser
*/
'Step 01': function (browser) {
'Create job': (browser) => {
var multibranchCreate = browser.page.multibranchCreate().navigate();

multibranchCreate.createBranch(jobName);
multibranchCreate.createBranch(jobName, pathToRepo);
},

'Delete runs': (browser) => {
browser.useXpath()
// Navidate back to main job screen
.waitForElementVisibleThenClick('//*[@id="breadcrumbs"]/li[3]/a')
// Navigate to master branch.
.waitForElementVisibleThenClick('//*[@id="job_master"]/td[3]/a')
// Wait until run is done. TODO make this better.
.pause(5000)
.refresh()
// Click on run 1
.waitForElementVisibleThenClick('//*[@id="buildHistory"]/div[2]/table/tbody/tr[2]/td/div[1]/a')
// Click delete
.waitForElementVisibleThenClick('//a[@href="/job/noRunsActivityPage/job/master/1/confirmDelete"]')
// Click confirm.
.waitForElementVisibleThenClick('//*[@id="yui-gen1-button"]');
},
/**
* Make sure that we show the empty state.
*/
'Step 02': function (browser) {
var blueActivityPage = browser.page.bluePipelineActivity().forJob(jobName, 'jenkins');
'Check empty states': (browser) => {
var blueActivityPage = browser.page.bluePipelineActivity().forJob(jobName, 'jenkins');

blueActivityPage.waitForElementVisible('@emptyStateShoes');
blueActivityPage.waitForElementVisible('@emptyStateShoes');

//Make sure branch shows branch.
browser.useXpath()
// for some reacon clickTab isnt working, doing it with xpath instead =/
.click('//a[@class="branches"]')
.waitForElementVisible('//td[text()="master"]')
}
}

0 comments on commit ec10c43

Please sign in to comment.