Search in sources :

Example 41 with WithPlugins

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

the class JobConfigHistoryPluginTest method track_change_in_matrix_project.

@Test
@Issue("JENKINS-24410")
@WithPlugins("matrix-project")
public void track_change_in_matrix_project() {
    MatrixProject job = jenkins.jobs.create(MatrixProject.class);
    JobConfigHistory history = job.action(JobConfigHistory.class);
    List<Change> original = history.getChanges();
    job.configure();
    job.runSequentially.check();
    job.save();
    List<Change> newOnes = history.getChanges();
    assertThat("New changes saved", newOnes.size(), greaterThan(original.size()));
}
Also used : JobConfigHistory(org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory) Change(org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory.Change) MatrixProject(org.jenkinsci.test.acceptance.po.MatrixProject) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 42 with WithPlugins

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

the class XvncPluginTest method workflow.

@WithPlugins({ "xvnc@1.22", "workflow-aggregator@1.8" })
@Issue("JENKINS-26477")
@Test
public void workflow() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node('xvnc') {wrap([$class: 'Xvnc', takeScreenshot: true, useXauthority: true]) {sh 'xmessage hello &'}}");
    job.sandbox.check();
    job.save();
    Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), containsString("+ xmessage hello"));
    assertThat(build, runXvnc());
    assertThat(build, tookScreenshot());
    // TODO should this be moved into tookScreenshot?
    build.getArtifact("screenshot.jpg").assertThatExists(true);
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 43 with WithPlugins

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

the class AuthorizeProjectTest method testProjectRunByUser.

@Test
@WithPlugins("mock-security-realm")
public void testProjectRunByUser() {
    jenkins.login().doSuccessfulLogin(USER2);
    final FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class);
    job.save();
    Build b = job.startBuild().shouldSucceed();
    String consoleOutput = b.getConsole();
    Assert.assertThat(consoleOutput, containsString(STARTED_BY_USER2));
    Assert.assertThat(consoleOutput, not(containsString(RUNNING_ANONYMOUS)));
    this.authorizeUserToLaunchProject(USER1);
    b = job.startBuild().shouldSucceed();
    consoleOutput = b.getConsole();
    Assert.assertThat(consoleOutput, containsString(STARTED_BY_USER2));
    // Running as anonymous is displayed due to permissions but the plugin performs its job
    Assert.assertThat(consoleOutput, containsString(RUNNING_ANONYMOUS));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Matchers.containsString(org.hamcrest.Matchers.containsString) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 44 with WithPlugins

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

the class ExtraColumnsPluginTest method should_show_console_link_in_folder.

/**
 * Sets up a job within a folder. Starts a succeeding build. Adds the last console column to a new view
 * and verifies that clicking the link to the last console opens the console log.
 */
@Test
@WithPlugins("cloudbees-folder")
public void should_show_console_link_in_folder() {
    Folder folder = jenkins.jobs.create(Folder.class, createRandomName());
    folder.save();
    folder.open();
    FreeStyleJob job = folder.getJobs().create();
    job.startBuild().waitUntilFinished().shouldSucceed();
    ListView.createWithColumn(folder, LastConsoleColumn.class);
    List<WebElement> links = all(by.link("Last/current build console output"));
    assertThat(links, iterableWithSize(1));
    links.get(0).click();
    assertThat(driver, hasContent("Console Output"));
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) WebElement(org.openqa.selenium.WebElement) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 45 with WithPlugins

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

the class CredentialsTest method createSshKeys.

@Test
@WithPlugins("ssh-credentials")
public void createSshKeys() throws Exception {
    CredentialsPage cp = new CredentialsPage(jenkins, ManagedCredentials.DEFAULT_DOMAIN);
    cp.open();
    SshPrivateKeyCredential sc = cp.add(SshPrivateKeyCredential.class);
    sc.username.set(CRED_USER);
    sc.selectEnterDirectly().privateKey.set(CRED_PWD);
    sc.description.set("ssh_creds");
    cp.create();
    // now verify
    final ManagedCredentials c = new ManagedCredentials(jenkins);
    String href = c.credentialById("ssh_creds");
    cp.setConfigUrl(href);
    verifyValueForCredential(cp, sc.username, CRED_USER);
    verifyValueForCredentialKey(sc, CRED_PWD, false);
}
Also used : SshPrivateKeyCredential(org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshPrivateKeyCredential) Matchers.containsString(org.hamcrest.Matchers.containsString) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)89 Test (org.junit.Test)89 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)71 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)53 Build (org.jenkinsci.test.acceptance.po.Build)39 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)31 Issue (org.jvnet.hudson.test.Issue)25 Job (org.jenkinsci.test.acceptance.po.Job)19 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)15 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)15 ListView (org.jenkinsci.test.acceptance.po.ListView)13 View (org.jenkinsci.test.acceptance.po.View)13 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)12 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)11 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)10 Matchers.containsString (org.hamcrest.Matchers.containsString)9 GlobalSecurityConfig (org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)9 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)8 Ignore (org.junit.Ignore)8 WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)5