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

Commit

Permalink
FIX Jenkins 38006 Fix condition which had been implemented wrong (#35)
Browse files Browse the repository at this point in the history
* [JENKINS-38006] first working version to test whethe we have scrolled to bottom

* [JENKINS-38006] move method to the page object

* [JENKINS-38006] Drop passing browser object to page methods. Add comments to bluePipelineRunDetail and the failing.js.
  • Loading branch information
scherler committed Sep 8, 2016
1 parent a242506 commit 3a3f8d8
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 134 deletions.
381 changes: 266 additions & 115 deletions src/main/js/page_objects/blueocean/bluePipelineRunDetail.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/test/js/edgeCases/folder.js
Expand Up @@ -90,27 +90,27 @@ module.exports = {
// JENKINS-36773 / JENKINS-37605 verify encoding and spacing of details
blueRunDetailPage.assertTitle('jenkins / ' + anotherFolders.join(' / ') + ' / feature/1');
// FIXME JENKINS-36619 -> somehow the close in AT is not working
// blueRunDetailPage.closeModal(browser);
// blueRunDetailPage.closeModal();
// JENKINS-36613 Unable to load steps for multibranch pipelines with / in them
blueRunDetailPage.validateGraph(); // test whether we have a pipeline graph
blueRunDetailPage.validateSteps(browser); // validate that steps are displayed
blueRunDetailPage.validateSteps(); // validate that steps are displayed
// There should be no authors
blueRunDetailPage.authorsIsNotSet(browser);
blueRunDetailPage.authorsIsNotSet();
},

'Check whether the artifacts tab shows artifacts': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 1);
// go to the artifact page by clicking the tab
blueRunDetailPage.clickTab(browser, 'artifacts');
blueRunDetailPage.clickTab('artifacts');
// we have added 2 files as artifact
blueRunDetailPage.validateNotEmptyArtifacts(browser, 2);
blueRunDetailPage.validateNotEmptyArtifacts(2);
},

// JENKINS-36674 Tests are not being reported
'Check whether the test tab shows failing tests': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'feature%2F1', 1);
// Go to the test page by clicking the tab
blueRunDetailPage.clickTab(browser, 'tests');
blueRunDetailPage.clickTab('tests');
// There should be failing tests
blueRunDetailPage.validateFailingTests();
},
Expand Down Expand Up @@ -156,11 +156,11 @@ module.exports = {
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 2);
// click on the changes tab
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.clickTab('changes');
// we should have one commits now
blueRunDetailPage.validateNotEmptyChanges(browser);
blueRunDetailPage.validateNotEmptyChanges();
// the author title should be shown
blueRunDetailPage.authorsIsNotCondensed(browser);
blueRunDetailPage.authorsIsNotCondensed();
// Wait for the job to end
blueRunDetailPage.waitForJobRunEnded(getProjectName(anotherFolders) + '/master');
});
Expand Down Expand Up @@ -222,13 +222,13 @@ module.exports = {
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 3);
// click on the changes tab
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.clickTab('changes');
// we should have a couple of commits now
blueRunDetailPage.validateNotEmptyChanges(browser);
blueRunDetailPage.validateNotEmptyChanges();
// make sure the windows is small
browser.resizeWindow(1000, 600);
// test now whether the authors are not listed but condendes
blueRunDetailPage.authorsIsCondensed(browser);
blueRunDetailPage.authorsIsCondensed();
// make the browser big again
browser.resizeWindow(1680, 1050);
// Wait for the job to end
Expand Down
4 changes: 3 additions & 1 deletion src/test/js/failing.js
Expand Up @@ -35,7 +35,9 @@ module.exports = {
browser.elements('css selector', 'code', function (codeCollection) {
this.assert.equal(typeof codeCollection, "object");
this.assert.equal(codeCollection.status, 0);
this.assert.equal(codeCollection.value.length, 1);
// JENKINS-36700 in fail all code should be closed besides one
// however if the browser is too quick there can still be two open
this.assert.equal(codeCollection.value.length <= 2, true);
});

});
Expand Down
2 changes: 1 addition & 1 deletion src/test/js/log-karaoke/freestyle.js
Expand Up @@ -34,7 +34,7 @@ module.exports = {
'Check whether a log which exceed 150kb contains a link to full log and if clicked it disappear': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('hijo', 'jenkins', 1);
// request full log
blueRunDetailPage.clickFullLog(browser);
blueRunDetailPage.clickFullLog();
},

};
46 changes: 46 additions & 0 deletions src/test/js/log-karaoke/freestylePing.js
@@ -0,0 +1,46 @@
/*
* REGRESSION TEST: logs not tailing with freestyle
*
* We will use a simple script which pings 10 times a certain url.
* To provoke that the browser has to scroll we will resize the browser and then test the scrollHeight of the
* parent container. If that is bigger then 0, that means that we have scrolled and the karaoke works as expected.
*/
// The name of the job
const jobName = 'pingTest';
module.exports = {
'Create freestyle Job "ping"': function (browser) {
// simple script to ping 10 times a certain url
const freestyleCreate = browser.page.freestyleCreate().navigate();
freestyleCreate.createFreestyle(jobName, 'freestylePing.sh');
},

'Build freestyle Job': function (browser) {
// build the job
const freestylePage = browser.page.jobUtils().forJob(jobName);
freestylePage.buildStarted(function () {
// Reload the job page and check that there was a build done.
freestylePage
.forRun(1)
.waitForElementVisible('@executer');
})
},

'Check Job Blue Ocean run detail page - karaoke': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(jobName, 'jenkins', 1);

// first resize the browser so we get quickly a level where we will have to scroll
browser.resizeWindow(600, 600);
// wait until the job has finished
blueRunDetailPage.waitForJobRunEnded(jobName)
.waitForElementVisible('code')
.fullLogButtonNotPresent()
.expect.element('code').text.to.contain('Finished: SUCCESS');
// make sure we have scrolled
blueRunDetailPage.validateScrollToBottom();
// make the browser big again
browser.resizeWindow(1680, 1050);

},


};
8 changes: 4 additions & 4 deletions src/test/js/log-karaoke/noStages.js
Expand Up @@ -109,7 +109,7 @@ module.exports = {
blueRunDetailPage.waitForElementVisible(lastLogConsoleSelector);
blueRunDetailPage.click(lastLogConsoleSelector);
// request full log
blueRunDetailPage.clickFullLog(browser);
blueRunDetailPage.clickFullLog();
});
},

Expand All @@ -123,19 +123,19 @@ module.exports = {

'Check whether the test tab shows an empty state hint': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('noStages', 'jenkins', 1);
blueRunDetailPage.clickTab(browser, 'tests');
blueRunDetailPage.clickTab('tests');
blueRunDetailPage.validateEmpty();
},

'Check whether the changes tab shows an empty state hint': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('noStages', 'jenkins', 1);
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.clickTab('changes');
blueRunDetailPage.validateEmpty();
},

'Check whether the artifacts tab shows an empty state hint': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('noStages', 'jenkins', 1);
blueRunDetailPage.clickTab(browser, 'artifacts');
blueRunDetailPage.clickTab('artifacts');
blueRunDetailPage.validateEmpty();
}
};
2 changes: 1 addition & 1 deletion src/test/js/log-karaoke/stages.js
Expand Up @@ -80,7 +80,7 @@ module.exports = {

'Check whether the artifacts tab shows artifacts': function (browser) {
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun('stages', 'jenkins', 1);
blueRunDetailPage.clickTab(browser, 'artifacts');
blueRunDetailPage.clickTab('artifacts');
blueRunDetailPage.validateNotEmptyArtifacts();
}
};
2 changes: 2 additions & 0 deletions src/test/resources/test_scripts/freestylePing.sh
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
ping spiegel.de -c 10

0 comments on commit 3a3f8d8

Please sign in to comment.