use of io.blueocean.ath.Retry in project blueocean-plugin by jenkinsci.
the class GithubCreationTest method testCreatePipelineFull.
/**
* This test tests the github creation flow.
*
* Creates a github repo with a sample Jenkinsfile
*/
@Test
@Retry(3)
public void testCreatePipelineFull() throws IOException {
byte[] content = "stage('build') { echo 'yes' }".getBytes("UTF-8");
GHContentUpdateResponse updateResponse = ghRepository.createContent(content, "Jenkinsfile", "Jenkinsfile", "master");
ghRepository.createRef("refs/heads/branch1", updateResponse.getCommit().getSHA1());
logger.info("Created master and branch1 branches in " + repo);
ghRepository.createContent("hi there", "newfile", "newfile", "branch1");
creationPage.createPipeline(token, organization, repo);
}
use of io.blueocean.ath.Retry 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();
}
use of io.blueocean.ath.Retry in project blueocean-plugin by jenkinsci.
the class ParallelNavigationTest method parallelNavigationTest.
/**
* This checks that we can run a pipeline with 2 long running parallel branches.
* You should be able to click between one and the other and see it progressing.
*/
@Test
@Retry(3)
public void parallelNavigationTest() throws IOException, GitAPIException, InterruptedException {
// Create navTest
logger.info("Creating pipeline " + navTest);
URL navTestJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile");
Files.copy(new File(navTestJenkinsfile.getFile()), new File(git.gitDirectory, "Jenkinsfile"));
git.addAll();
git.commit("Initial commit for " + navTest);
logger.info("Committed Jenkinsfile for " + navTest);
navTestPipeline = mbpFactory.pipeline(navTest).createPipeline(git);
logger.info("Finished creating " + navTest);
logger.info("Beginning parallelNavigationTest()");
navTestPipeline.getRunDetailsPipelinePage().open(1);
// At first we see branch one
wait.until(By.xpath("//*[text()=\"firstBranch\"]"));
logger.info("Found first branch");
wait.until(By.xpath("//*[text()=\"first branch visible\"]"));
// and clicking on the unselected node will yield us the second branch
wait.click(By.xpath("//*[contains(@class, 'pipeline-node')][3]"));
wait.until(By.xpath("//*[text()=\"secondBranch\"]"));
wait.until(By.xpath("//*[text()=\"second branch visible\"]"));
logger.info("Found second branch");
}
Aggregations