use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class FavoritesAddRemoveTest method testMultibranch.
@Test
public void testMultibranch() throws IOException, GitAPIException {
git.writeJenkinsFile(resources.loadJenkinsFile());
git.addAll();
git.commit("First");
git.createBranch("feature/1");
String jobName = "addremove-multibranch";
MultiBranchPipeline pipeline = multibranchFactory.pipeline(FOLDER, jobName).createPipeline(git);
String fullName = pipeline.getFullName();
dashboardPage.open();
dashboardPage.togglePipelineListFavorite(jobName);
dashboardPage.checkFavoriteCardCount(1);
dashboardPage.getFavoriteCard(fullName).findElement(By.cssSelector(".branchText[title=master]"));
dashboardPage.togglePipelineListFavorite(jobName);
dashboardPage.checkFavoriteCardCount(0);
Assert.assertTrue("should not be favorited", !dashboardPage.isPipelineListItemFavorited(jobName));
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class GithubEditorTest method testEditor.
/**
* This test covers e2e usage of the editor.
*
* Creates a blank github repo, and then uses editor to create a simple pipeline.
*/
@Test
public void testEditor() throws IOException {
creationPage.createPipeline(token, organization, repo, true);
MultiBranchPipeline pipeline = mbpFactory.pipeline(repo);
editorPage.simplePipeline();
ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
driver.navigate().refresh();
sseClient.untilEvents(pipeline.buildsFinished);
sseClient.clear();
BranchPage branchPage = activityPage.clickBranchTab();
branchPage.openEditor("master");
editorPage.saveBranch("new - branch");
activityPage.checkUrl();
activityPage.getRunRowForBranch("new-branch");
sseClient.untilEvents(pipeline.buildsFinished);
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class GithubEditorTest method testEditorParallel.
/**
* This test covers e2e usage of the editor. Does so with a parallel pipeline.
*
* Creates a blank github repo, and then uses editor to create a parallel pipeline.
*/
@Test
public void testEditorParallel() throws IOException {
creationPage.createPipeline(token, organization, repo, true);
MultiBranchPipeline pipeline = mbpFactory.pipeline(repo);
editorPage.parallelPipeline("branch-with-parallels", 3);
ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
driver.navigate().refresh();
sseClient.untilEvents(pipeline.buildsFinished);
sseClient.clear();
BranchPage branchPage = activityPage.clickBranchTab();
branchPage.openEditor("branch-with-parallels");
editorPage.saveBranch("new - branch");
activityPage.checkUrl();
activityPage.getRunRowForBranch("branch-with-parallels");
sseClient.untilEvents(pipeline.buildsFinished);
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class CommitMessagesTest method commitMessagesTest.
/**
* This tests the commit messages are being picked up from git and displayed on the run in activity.
*/
@Test
public void commitMessagesTest() throws IOException, GitAPIException {
final String pipelineName = "CommitMessagesTest_commitMessagesTest";
final String branchName = "master";
URL jenkinsFile = getResourceURL("Jenkinsfile");
Files.copy(new File(jenkinsFile.getFile()), new File(git.gitDirectory, "Jenkinsfile"));
git.addAll();
git.commit("initial commit");
logger.info("Commited Jenkinsfile");
MultiBranchPipeline pipeline = mbpFactory.pipeline(pipelineName).createPipeline(git);
sseClientRule.untilEvents(pipeline.buildsFinished);
sseClientRule.clear();
JGitTestUtil.writeTrashFile(git.client.getRepository(), "trash", "hi");
git.addAll();
git.commit("2nd commit");
logger.info("Commited a second time");
pipeline.buildBranch(branchName);
sseClientRule.untilEvents(pipeline.buildsFinished);
ActivityPage activityPage = pipeline.getActivityPage().open();
activityPage.checkForCommitMessage("2nd commit");
// Do some assertions on the run data
WebElement row = activityPage.getRunRowForBranch(branchName);
List<WebElement> cells = row.findElements(activityPage.getSelectorForRowCells());
assertEquals("Number of cells in row", 8, cells.size());
assertEquals("Branch label cell text", branchName, cells.get(3).getText());
assertNotEquals("Run duration cell text", "-", cells.get(5).getText().trim());
activityPage.assertIsDuration(cells.get(5).getText());
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class FavoritesCardsTest method testMultibranch.
@Test
public void testMultibranch() throws IOException, GitAPIException, InterruptedException {
String branchOther = "feature/1";
git.writeJenkinsFile(resources.loadJenkinsFile());
git.addAll();
git.commit("First");
git.createBranch(branchOther);
String jobName = "navigation-multibranch";
MultiBranchPipeline pipeline = multibranchFactory.pipeline(FOLDER, jobName).createPipeline(git);
String fullNameMaster = pipeline.getFullName();
String fullNameOther = pipeline.getFullName(branchOther);
dashboardPage.open();
dashboardPage.togglePipelineListFavorite(jobName);
dashboardPage.getFavoriteCard(fullNameMaster);
dashboardPage.clickFavoriteCardActivityLink(fullNameMaster);
activityPageFactory.withPipeline(pipeline).clickBranchTab().toggleFavoriteStatus(branchOther);
dashboardPage.open();
List<String> cardFullnames = ImmutableList.of(fullNameMaster, fullNameOther);
int count = 2;
dashboardPage.checkFavoriteCardStatus(fullNameMaster, SUCCESS);
dashboardPage.checkFavoriteCardStatus(fullNameOther, SUCCESS);
// Check that favorite actions are hidden until pointer is hovering the row
JavascriptExecutor js = (JavascriptExecutor) driver;
Object backgroundColor = js.executeScript("return getComputedStyle(document.querySelectorAll('.actions-container')[0], ':after').getPropertyValue('background-color')");
// check that background color of overlay is NOT transparent when pointer is NOT hovering the favorite row
Assert.assertNotEquals(backgroundColor, "rgba(0, 0, 0, 0)");
logger.info("move pointer over favorite card actions");
Actions action = new Actions(driver);
WebElement we = wait.until(By.xpath("//*[@class=\"pipeline-card success-bg-lite\"]"));
action.moveToElement(we).perform();
// check that background color of overlay is transparent when pointer is hovering the favorite row
wait.until(hoverBackgroundColor());
for (String fullName : cardFullnames) {
logger.info(String.format("running tests against favorited branch: %s", fullName));
count--;
dashboardPage.clickFavoriteCardRunButton(fullName);
dashboardPage.checkFavoriteCardStatus(fullName, RUNNING, SUCCESS);
dashboardPage.clickFavoriteCardReplayButton(fullName);
dashboardPage.checkFavoriteCardStatus(fullName, RUNNING, SUCCESS);
dashboardPage.removeFavoriteCard(fullName);
dashboardPage.checkFavoriteCardCount(count);
dashboardPage.checkIsPipelineListItemFavorited(jobName, false);
}
}
Aggregations