use of org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl in project acceptance-test-harness by jenkinsci.
the class MailService method assertMail.
/**
* Checks that the mail has arrived.
*/
public void assertMail(final Pattern subject, String recipient, Pattern body) throws MessagingException, IOException {
CapybaraPortingLayer hackish = new CapybaraPortingLayerImpl(World.get().getInjector());
MimeMessage msg = hackish.waitFor().withMessage("Email whose subject matches: %s", subject).pollingEvery(5, TimeUnit.SECONDS).until(new MailArrives(subject));
String actualRecipients = Joiner.on(' ').join(msg.getRecipients(TO));
assertThat("recipient", actualRecipients, is(recipient));
Object c = msg.getContent();
if (c instanceof MimeMultipart) {
MimeMultipart content = (MimeMultipart) c;
c = content.getBodyPart(0).getContent();
}
assertThat(c.toString(), containsRegexp(body));
}
use of org.jenkinsci.test.acceptance.po.CapybaraPortingLayerImpl in project acceptance-test-harness by jenkinsci.
the class PluginManagerTest method uninstall_plugin.
@Test
@WithPlugins("gerrit-trigger")
public void uninstall_plugin() throws InterruptedException, ExecutionException {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
jenkins.getPluginManager().visit("installed");
WebElement form = find(by.action("plugin/gerrit-trigger/uninstall"));
form.submit();
waitFor(form).until(CapybaraPortingLayerImpl::isStale);
clickButton("Yes");
jenkins.restart();
jenkins.getPluginManager().visit("installed");
assertThrows(NoSuchElementException.class, () -> find(by.url("plugin/gerrit-trigger")));
}
Aggregations