private void assertHasModule(MavenModuleSet job, String name) { assertThat(job.module(name), pageObjectExists()); MavenBuild build = job.getLastBuild(); assertThat(build.module(name), pageObjectExists()); job.visit("modules"); find(by.xpath("//a[@href='%s/']", name)).click(); assertThat(driver.getCurrentUrl(), equalTo(job.module(name).url.toExternalForm())); build.open(); find(by.xpath("//a[@href='%s/']", name)).click(); assertThat(driver.getCurrentUrl(), equalTo(build.module(name).url.toExternalForm())); }
@Test public void set_global_maven_options() { installSomeMaven(jenkins); jenkins.configure(); new MavenProjectConfig(jenkins.getConfigPage()).opts.set("-verbose"); jenkins.save(); MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class); job.configure(); job.copyDir(resource("/maven_plugin/multimodule/")); job.goals.set("clean"); job.save(); job.startBuild().shouldSucceed().shouldContainsConsoleOutput("\\[Loaded java.lang.Object"); }
@Test @Bug({"JENKINS-20209", "JENKINS-21045"}) public void send_mail() throws Exception { jenkins.configure(); mailer.setupDefaults(); jenkins.save(); MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class); job.configure(); Mailer mailer = job.addBuildSettings(Mailer.class); mailer.recipients.set("*****@*****.**"); job.save(); job.startBuild().shouldFail(); mail.assertMail( Pattern.compile("Build failed in Jenkins: .* #1"), "*****@*****.**", Pattern.compile(job.name)); }
@Test public void build_multimodule() { installSomeMaven(jenkins); MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class); job.configure(); job.copyDir(resource("/maven_plugin/multimodule/")); job.goals.set("package"); job.save(); job.startBuild() .shouldSucceed() .shouldContainsConsoleOutput("Building root 1.0") .shouldContainsConsoleOutput("Building module_a 2.0") .shouldContainsConsoleOutput("Building module_b 3.0"); assertHasModule(job, "gid$root"); assertHasModule(job, "gid$module_a"); assertHasModule(job, "gid$module_b"); }
@Test public void set_maven_options() { installSomeMaven(jenkins); MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class); job.configure(); job.copyDir(resource("/maven_plugin/multimodule/")); job.goals.set("clean"); job.options("-verbose"); job.save(); job.startBuild().waitUntilFinished().shouldContainsConsoleOutput("\\[Loaded java.lang.Object"); }