Search in sources :

Example 1 with ActivityPage

use of io.blueocean.ath.pages.blue.ActivityPage in project blueocean-plugin by jenkinsci.

the class GithubCreationTest method testCreatePullRequest.

/**
 * This test walks through a simple Pull Request flow..
 *
 * -Creates a github repo with a sample Jenkinsfile and follows
 *  the typical create flow
 * -Navigates back to the top level Dashboard page
 * -Creates a PR in the GH repo
 * -Triggers a rescan of the multibranch pipeline
 * -Opens the PR tab to verify that we actually have something there.
 */
@Test
@Retry(3)
public void testCreatePullRequest() throws IOException {
    String branchToCreate = "new-branch";
    String commitMessage = "Add new-file to our repo";
    MultiBranchPipeline pipeline = mbpFactory.pipeline(repo);
    byte[] firstJenkinsfile = "stage('first-build') { echo 'first-build' }".getBytes("UTF-8");
    GHContentUpdateResponse initialUpdateResponse = ghRepository.createContent(firstJenkinsfile, "firstJenkinsfile", "Jenkinsfile", "master");
    ghRepository.createRef(("refs/heads/" + branchToCreate), initialUpdateResponse.getCommit().getSHA1());
    logger.info("Created master and " + branchToCreate + " branches in " + repo);
    ghRepository.createContent("hi there", "newfile", "new-file", branchToCreate);
    creationPage.createPipeline(token, organization, repo);
    dashboardPage.open();
    ghRepository.createPullRequest(commitMessage, branchToCreate, "master", "My first pull request is very exciting.");
    // Fire the rescan.
    pipeline.rescanThisPipeline();
    dashboardPage.clickPipeline(repo);
    ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
    PullRequestsPage pullRequestsPage = activityPage.clickPullRequestsTab();
    pullRequestsPage.clickRunButton("1");
    pullRequestsPage.clickHistoryButton("1");
    // We'll be on the activity page now, pre-filtered to PR-1.
    // Go to the Pull Requests tab one last time.
    activityPage.clickPullRequestsTab();
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage) MultiBranchPipeline(io.blueocean.ath.model.MultiBranchPipeline) GHContentUpdateResponse(org.kohsuke.github.GHContentUpdateResponse) PullRequestsPage(io.blueocean.ath.pages.blue.PullRequestsPage) Retry(io.blueocean.ath.Retry)

Example 2 with ActivityPage

use of io.blueocean.ath.pages.blue.ActivityPage in project blueocean-plugin by jenkinsci.

the class NavigationTest method testBranchHistory.

/**
 * This test clicks on the history button on a branch, and makes sure that it navigates to the activity page
 * on the correct url.
 */
@Test
public void testBranchHistory() throws IOException, GitAPIException {
    git.writeJenkinsFile(loadJenkinsFile());
    git.addAll();
    git.commit("Added Jenkinsfile");
    git.createBranch("feature/1");
    git.createBranch("feature@2");
    MultiBranchPipeline pipeline = multiBranchPipelineFactory.pipeline(Folder.folders("a folder", "bfolder", "folder"), "NavigationTest_testNavigation");
    pipeline.createPipeline(git);
    dashboardPage.open();
    dashboardPage.clickPipeline(pipeline.getName());
    ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
    BranchPage branchPage = activityPage.clickBranchTab();
    branchPage.clickHistoryButton("feature/1");
    activityPage.open();
    activityPage.getRunRowForBranch("feature@2").click();
    pipeline.getRunDetailsPipelinePage().checkUrl("feature%402", 1);
    pipeline.getRunDetailsPipelinePage().checkBasicDomElements();
}
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) BlueOceanAcceptanceTest(io.blueocean.ath.BlueOceanAcceptanceTest)

Example 3 with ActivityPage

use of io.blueocean.ath.pages.blue.ActivityPage in project blueocean-plugin by jenkinsci.

the class FavoritesNavigationTest method checkActivity.

/**
 * Check that navigating to run details via favorites card works
 * @param pipeline
 */
private ActivityPage checkActivity(AbstractPipeline pipeline) {
    dashboardPage.clickFavoriteCardActivityLink(pipeline.getFullName());
    ActivityPage activityPage = activityPageFactory.withPipeline(pipeline);
    activityPage.checkBasicDomElements();
    activityPage.checkFavoriteStatus(true);
    return activityPage;
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage)

Example 4 with ActivityPage

use of io.blueocean.ath.pages.blue.ActivityPage in project blueocean-plugin by jenkinsci.

the class UpstreamLinkTest method upstreamLinkTest.

@Test
public void upstreamLinkTest() throws IOException {
    String jenkinsFile = loadJenkinsFile();
    FreestyleJob upstreamJob = freestyleJobFactory.pipeline("upstreamJob").create("echo blah");
    ClassicPipeline downstreamJob = pipelineFactory.pipeline("downstreamJob").createPipeline(jenkinsFile).build();
    sseClient.untilEvents(downstreamJob.buildsFinished);
    sseClient.clear();
    upstreamJob.build();
    sseClient.untilEvents(upstreamJob.buildsFinished);
    sseClient.untilEvents(downstreamJob.buildsFinished);
    sseClient.clear();
    ActivityPage activityPage = downstreamJob.getActivityPage().open();
    find("//*[contains(text(),'Started by upstream pipeline')]").isVisible();
    downstreamJob.getRunDetailsPipelinePage().open(2);
    find("//*[contains(text(),'Started by upstream pipeline')]").isVisible();
}
Also used : ActivityPage(io.blueocean.ath.pages.blue.ActivityPage) FreestyleJob(io.blueocean.ath.model.FreestyleJob) ClassicPipeline(io.blueocean.ath.model.ClassicPipeline) Test(org.junit.Test) BlueOceanAcceptanceTest(io.blueocean.ath.BlueOceanAcceptanceTest)

Example 5 with ActivityPage

use of io.blueocean.ath.pages.blue.ActivityPage 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)

Aggregations

ActivityPage (io.blueocean.ath.pages.blue.ActivityPage)7 MultiBranchPipeline (io.blueocean.ath.model.MultiBranchPipeline)5 Test (org.junit.Test)5 BlueOceanAcceptanceTest (io.blueocean.ath.BlueOceanAcceptanceTest)3 BranchPage (io.blueocean.ath.pages.blue.BranchPage)3 Retry (io.blueocean.ath.Retry)1 ClassicPipeline (io.blueocean.ath.model.ClassicPipeline)1 FreestyleJob (io.blueocean.ath.model.FreestyleJob)1 PullRequestsPage (io.blueocean.ath.pages.blue.PullRequestsPage)1 File (java.io.File)1 URL (java.net.URL)1 GHContentUpdateResponse (org.kohsuke.github.GHContentUpdateResponse)1 WebElement (org.openqa.selenium.WebElement)1