Search in sources :

Example 1 with Since

use of org.jenkinsci.test.acceptance.junit.Since in project acceptance-test-harness by jenkinsci.

the class TSRCreateSlaveTest method newSlave.

@Test
@Since("1.560")
public void newSlave() {
    // this test requires a newer version of credentials plugin that has inline "Add" button
    // I'm not sure exactly which version it is, but 1.532 LTS doesn't have it, and 1.555 has it,
    // so it's somewhere in between
    // TODO: this should be converted to "@WithPlugin("ssh-credentials") with specific version tag,
    // not the core version
    // Just to make sure the dumb slave is set up properly, we should seed it
    // with a FS root and executors
    final DumbSlave s = jenkins.slaves.create(DumbSlave.class);
    {
        SshSlaveLauncher l = s.setLauncher(SshSlaveLauncher.class);
        String username = "user1";
        String privateKey = "1212122112";
        String description = "Ssh key";
        l.host.set("127.0.0.1");
        // make sure this exists
        l.credentialsId.resolve();
        try {
            l.credentialsId.select(String.format("%s (%s)", username, description));
            fail();
        } catch (NoSuchElementException e) {
        // ignore
        }
        SshCredentialDialog f = l.addCredential();
        {
            SshPrivateKeyCredential sc = f.select(SshPrivateKeyCredential.class);
            sc.description.set(description);
            sc.username.set(username);
            sc.selectEnterDirectly().privateKey.set(privateKey);
        }
        f.add();
        l.credentialsId.select(String.format("%s (%s)", username, description));
    }
    s.save();
}
Also used : SshSlaveLauncher(org.jenkinsci.test.acceptance.plugins.ssh_slaves.SshSlaveLauncher) SshPrivateKeyCredential(org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshPrivateKeyCredential) SshCredentialDialog(org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshCredentialDialog) Matchers.containsString(org.hamcrest.Matchers.containsString) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) NoSuchElementException(org.openqa.selenium.NoSuchElementException) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) Since(org.jenkinsci.test.acceptance.junit.Since)

Example 2 with Since

use of org.jenkinsci.test.acceptance.junit.Since in project acceptance-test-harness by jenkinsci.

the class MailWatcherPluginTest method notify_master_on_jenkins_restart.

@Test
@Issue("JENKINS-20538")
@Since("1.571")
@WithPlugins("mail-watcher-plugin@1.7")
@Ignore("Flaky test, passes sometimes on CI")
public void notify_master_on_jenkins_restart() throws Exception {
    assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
    jenkins.configure();
    {
        OnlineStatusNotification notification = new OnlineStatusNotification(jenkins);
        notification.onOnline("on@online.com");
        notification.onOffline("on@offline.com");
    }
    jenkins.save();
    jenkins.restart();
    mailhog.assertMail(regex("Computer master marked offline"), "on@offline.com", regex("Jenkins is restarting"));
    mailhog.assertMail(regex("Computer master marked online"), "on@online.com");
}
Also used : OnlineStatusNotification(org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest) Since(org.jenkinsci.test.acceptance.junit.Since) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 3 with Since

use of org.jenkinsci.test.acceptance.junit.Since in project acceptance-test-harness by jenkinsci.

the class MavenPluginTest method preserve_backslash_in_property.

@Test
@Issue("JENKINS-10539")
@Since("1.527")
public void preserve_backslash_in_property() {
    installSomeMaven(jenkins);
    FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class);
    job.configure();
    job.addParameter(StringParameter.class).setName("CMD");
    job.addParameter(StringParameter.class).setName("PROPERTY");
    MavenBuildStep step = job.addBuildStep(MavenBuildStep.class);
    step.targets.set(GENERATE + " -Dcmdline.property=$CMD");
    step.properties("property.property=$PROPERTY", true);
    job.save();
    Map<String, String> params = new HashMap<>();
    params.put("CMD", "\"C:\\\\System\"");
    params.put("PROPERTY", "C:\\Windows");
    job.startBuild(params).shouldSucceed().shouldContainsConsoleOutput("cmdline.property=C:\\\\System").shouldContainsConsoleOutput("property.property=C:\\\\Windows");
}
Also used : StringParameter(org.jenkinsci.test.acceptance.po.StringParameter) HashMap(java.util.HashMap) MavenBuildStep(org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest) Since(org.jenkinsci.test.acceptance.junit.Since)

Example 4 with Since

use of org.jenkinsci.test.acceptance.junit.Since in project acceptance-test-harness by jenkinsci.

the class InstallWizardTest method wizardInstallCustomPluginsTest.

@Since("2.0")
@Test
public void wizardInstallCustomPluginsTest() throws IOException {
    jenkins.open();
    // Login step
    WizardLogin wizardLogin = new WizardLogin(jenkins);
    wizardLogin.doSuccessfulLogin(wizardLogin.getPassword(controller));
    // Customize Jenkins step
    WizardCustomizeJenkins wizardCustomize = new WizardCustomizeJenkins(jenkins);
    wizardCustomize.doSelectPluginsToInstall();
    wizardCustomize.deselectAll();
    wizardCustomize.searchPlugin("pipeline");
    wizardCustomize.selectPlugin("workflow-aggregator");
    wizardCustomize.startInstall();
    wizardCustomize.shouldFinishInstallSuccessfully();
    // Create user test
    WizardCreateAdminUser createAdmin = new WizardCreateAdminUser(jenkins);
    createAdmin.createAdminUser(USERNAME, PASSWORD, FULL_NAME, EMAIL);
    createAdmin.shouldCreateTheUserSuccessfully();
    if (jenkins.getVersion().isNewerThan(new VersionNumber("2.118"))) {
        createAdmin.confirmURLSettings();
    }
    createAdmin.wizardShouldFinishSuccessfully();
    // Check that the new user is logged in
    Login login = new Login(jenkins);
    Assert.assertThat(login, loggedInAs("adminuser"));
}
Also used : WizardCreateAdminUser(org.jenkinsci.test.acceptance.po.WizardCreateAdminUser) WizardLogin(org.jenkinsci.test.acceptance.po.WizardLogin) WizardCustomizeJenkins(org.jenkinsci.test.acceptance.po.WizardCustomizeJenkins) WizardLogin(org.jenkinsci.test.acceptance.po.WizardLogin) Login(org.jenkinsci.test.acceptance.po.Login) VersionNumber(hudson.util.VersionNumber) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) Since(org.jenkinsci.test.acceptance.junit.Since)

Example 5 with Since

use of org.jenkinsci.test.acceptance.junit.Since in project acceptance-test-harness by jenkinsci.

the class InstallWizardTest method wizardInstallSuggestedTest.

@Since("2.0")
@Test
public void wizardInstallSuggestedTest() throws IOException {
    jenkins.open();
    // Login step
    WizardLogin wizardLogin = new WizardLogin(jenkins);
    wizardLogin.doSuccessfulLogin(wizardLogin.getPassword(controller));
    // Customize Jenkins step
    WizardCustomizeJenkins wizardCustomize = new WizardCustomizeJenkins(jenkins);
    wizardCustomize.doInstallSuggested();
    wizardCustomize.shouldFinishInstallSuccessfully();
    // Create user test
    WizardCreateAdminUser createAdmin = new WizardCreateAdminUser(jenkins);
    createAdmin.createAdminUser(USERNAME, PASSWORD, FULL_NAME, EMAIL);
    createAdmin.shouldCreateTheUserSuccessfully();
    if (jenkins.getVersion().isNewerThan(new VersionNumber("2.118"))) {
        createAdmin.confirmURLSettings();
    }
    createAdmin.wizardShouldFinishSuccessfully();
    // Check that the new user is logged in
    Login login = new Login(jenkins);
    Assert.assertThat(login, loggedInAs("adminuser"));
}
Also used : WizardCreateAdminUser(org.jenkinsci.test.acceptance.po.WizardCreateAdminUser) WizardLogin(org.jenkinsci.test.acceptance.po.WizardLogin) WizardCustomizeJenkins(org.jenkinsci.test.acceptance.po.WizardCustomizeJenkins) WizardLogin(org.jenkinsci.test.acceptance.po.WizardLogin) Login(org.jenkinsci.test.acceptance.po.Login) VersionNumber(hudson.util.VersionNumber) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) Since(org.jenkinsci.test.acceptance.junit.Since)

Aggregations

Since (org.jenkinsci.test.acceptance.junit.Since)10 Test (org.junit.Test)10 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)9 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 Issue (org.jvnet.hudson.test.Issue)4 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)3 VersionNumber (hudson.util.VersionNumber)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 AnalysisAction (org.jenkinsci.test.acceptance.plugins.analysis_core.AnalysisAction)2 SshCredentialDialog (org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshCredentialDialog)2 SshPrivateKeyCredential (org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshPrivateKeyCredential)2 SshSlaveLauncher (org.jenkinsci.test.acceptance.plugins.ssh_slaves.SshSlaveLauncher)2 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)2 Login (org.jenkinsci.test.acceptance.po.Login)2 WizardCreateAdminUser (org.jenkinsci.test.acceptance.po.WizardCreateAdminUser)2 WizardCustomizeJenkins (org.jenkinsci.test.acceptance.po.WizardCustomizeJenkins)2 WizardLogin (org.jenkinsci.test.acceptance.po.WizardLogin)2 NoSuchElementException (org.openqa.selenium.NoSuchElementException)2 WebElement (org.openqa.selenium.WebElement)2 HashMap (java.util.HashMap)1