This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-40740] Ath tests to cover missing run data (#106)
* [JENKINS-40740] Ath tets to cover missing run data * More descriptive labels
- Loading branch information
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/js/custom_commands/waitForElementVisibleThenClick.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
'Step 01 - Create job': (browser) => { | ||
var multibranchCreate = browser.page.multibranchCreate().navigate(); | ||
|
||
multibranchCreate.createBranch(jobName); | ||
multibranchCreate.createBranch(jobName, pathToRepo); | ||
}, | ||
|
||
'Step 02 - 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'); | ||
'Step 03 - 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"]') | ||
} | ||
} |