Search in sources :

Example 6 with MultiBranchPipeline

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));
}
Also used : MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) Test(org.junit.Test)

Example 7 with MultiBranchPipeline

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);
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage) MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) BranchPage(io.blueocean.ath.pages.blue.BranchPage) Test(org.junit.Test)

Example 8 with MultiBranchPipeline

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);
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage) MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) BranchPage(io.blueocean.ath.pages.blue.BranchPage) Test(org.junit.Test)

Example 9 with MultiBranchPipeline

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());
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage) MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) WebElement(org.openqa.selenium.WebElement) File(java.io.File) URL(java.net.URL) Test(org.junit.Test) BlueOceanAcceptanceTest(io.blueocean.ath.BlueOceanAcceptanceTest)

Example 10 with MultiBranchPipeline

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);
    }
}
Also used : JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Aggregations

MultiBranchPipeline (io.blueocean.ath.model.MultiBranchPipeline)11 Test (org.junit.Test)9 ActivityPage (io.blueocean.ath.pages.blue.ActivityPage)5 BlueOceanAcceptanceTest (io.blueocean.ath.BlueOceanAcceptanceTest)4 BranchPage (io.blueocean.ath.pages.blue.BranchPage)4 WebElement (org.openqa.selenium.WebElement)2 Retry (io.blueocean.ath.Retry)1 PullRequestsPage (io.blueocean.ath.pages.blue.PullRequestsPage)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 URL (java.net.URL)1 Ignore (org.junit.Ignore)1 GHContentUpdateResponse (org.kohsuke.github.GHContentUpdateResponse)1 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)1 Actions (org.openqa.selenium.interactions.Actions)1