use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_delete_removed_views.
/**
* Verifies whether a previously generated view will be deleted if it
* is not referenced anymore.
*/
@Test
public void should_delete_removed_views() {
FreeStyleJob seedJob = executeRemovedViewAction(JobDslRemovedViewAction.DELETE);
Build build = seedJob.scheduleBuild().shouldSucceed();
Pattern expected = Pattern.compile("Unreferenced views:(\\s*)GeneratedView[{]name='Old_View'}(\\s*)Removed views:(\\s*)GeneratedView[{]name='Old_View'}");
assertThat(build.getConsole(), containsRegexp(expected));
ListView oldView = getView("Old_View");
assertThat(oldView, pageObjectDoesNotExist());
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method calculate_changelog.
@Test
public void calculate_changelog() {
final URL changesUrl;
final String TEST_COMMIT_MESSAGE = "Second commit";
Build b;
GitRepo repo = buildGitRepo();
repo.createBranch("testBranch");
repo.changeAndCommitFoo(TEST_COMMIT_MESSAGE);
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME).calculateChangelog("origin", "testBranch");
job.save();
b = job.startBuild();
b.shouldSucceed();
changesUrl = b.url("changes");
assertThat(b.getConsole(), Matchers.containsRegexp("Using 'Changelog to branch' strategy.", Pattern.MULTILINE));
assertThat(visit(changesUrl).getPageSource(), Matchers.containsRegexp(TEST_COMMIT_MESSAGE, Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method create_tag_for_build.
@Test
public void create_tag_for_build() {
GitRepo repo = buildGitRepo();
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME).customNameAndMail("fake", "fake@mail.com").createTagForBuild();
job.addShellStep("git tag -n1");
job.save();
Build b = job.startBuild();
b.shouldSucceed();
assertThat(b.getConsole(), Matchers.containsRegexp("jenkins-" + job.name + "-1 Jenkins Build #1", Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method commit_author_in_changelog_test.
@Test
public void commit_author_in_changelog_test() {
URL changesUrl;
final String TEST_COMMIT_MESSAGE = "Second commit";
final String BRANCH_NAME = "testBranch";
final String TEST_FILE = "foo_test_branch";
Build b;
GitRepo repo = buildGitRepo();
repo.createBranch(BRANCH_NAME);
repo.touch(TEST_FILE);
repo.git("add", TEST_FILE);
repo.git("commit", "-m", TEST_COMMIT_MESSAGE, "--author", "New-Author <other-email@example.org>");
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME).calculateChangelog("origin", BRANCH_NAME);
job.save();
b = job.startBuild();
b.shouldSucceed();
changesUrl = b.url("changes");
assertThat(visit(changesUrl).getPageSource(), Matchers.containsRegexp("/user/jenkins-ath/", Pattern.MULTILINE));
job.configure();
job.useScm(GitScm.class).commitAuthorInChangelog();
job.save();
b = job.startBuild();
b.shouldSucceed();
changesUrl = b.url("changes");
assertThat(visit(changesUrl).getPageSource(), Matchers.containsRegexp("/user/other-email/", Pattern.MULTILINE));
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class GitPluginTest method custom_scm_name.
@Test
public void custom_scm_name() {
final String SCM_NAME = "halligalli";
GitRepo repo = buildGitRepo();
repo.transferToDockerContainer(host, port);
job.useScm(GitScm.class).url(repoUrl).credentials(USERNAME).customScmName(SCM_NAME);
job.save();
Build b = job.startBuild();
b.shouldSucceed();
// Git plugin 4.0 switched from <b> to <strong>. Accept either bold or strong.
assertThat(visit(b.url("git")).getPageSource(), Matchers.containsRegexp("<[^>]+>SCM:?</[^>]+>:? " + SCM_NAME, Pattern.MULTILINE));
}
Aggregations