Search in sources :

Example 66 with WithPlugins

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

the class GradlePluginTest method run_gradle_pipeline_build_task_links.

/**
 * Runs a pipeline gradle build and verifies that the task links are existent
 */
@Test
@WithPlugins("workflow-aggregator")
@Ignore("JENKINS-45206")
public void run_gradle_pipeline_build_task_links() {
    final Build build = setUpAndRunPipelineBuild(JENKINS_FILE_MULTIPLE_TASKS, GRADLE_SCRIPT);
    final WebElement firstTaskLink = build.find(By.partialLinkText(FIRST.getName()));
    final WebElement secondTaskLink = build.find(By.partialLinkText(SECOND.getName()));
    assertThat(firstTaskLink.getAttribute("href"), containsString("#gradle-task-0"));
    assertThat(secondTaskLink.getAttribute("href"), containsString("#gradle-task-1"));
    assertThat(build.getConsole(), containsString(FIRST.getPrintln()));
    assertThat(build.getConsole(), containsString(SECOND.getPrintln()));
}
Also used : WebElement(org.openqa.selenium.WebElement) Ignore(org.junit.Ignore) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 67 with WithPlugins

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

the class OpenstackCloudPluginTest method scheduleMatrixWithoutLabel.

@Test
@Issue("JENKINS-29998")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
@WithPlugins("matrix-project")
public void scheduleMatrixWithoutLabel() {
    configureCloudInit("cloud-init");
    configureProvisioning("SSH", "label");
    jenkins.configure();
    jenkins.getConfigPage().numExecutors.set(0);
    jenkins.save();
    MatrixProject job = jenkins.jobs.create(MatrixProject.class);
    job.configure();
    job.save();
    MatrixBuild pb = job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed().as(MatrixBuild.class);
    assertThat(pb.getNode(), equalTo((Node) jenkins));
    MatrixRun cb = pb.getConfiguration("default");
    assertThat(cb.getNode(), not(equalTo((Node) jenkins)));
}
Also used : Node(org.jenkinsci.test.acceptance.po.Node) MatrixRun(org.jenkinsci.test.acceptance.po.MatrixRun) MatrixProject(org.jenkinsci.test.acceptance.po.MatrixProject) MatrixBuild(org.jenkinsci.test.acceptance.po.MatrixBuild) Issue(org.jvnet.hudson.test.Issue) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) TestActivation(org.jenkinsci.test.acceptance.junit.TestActivation)

Example 68 with WithPlugins

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

the class SAMLPluginTest method authenticationOKPostBinding.

@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOKPostBinding() throws IOException, InterruptedException {
    // navigate to root
    jenkins.open();
    String rootUrl = jenkins.getCurrentUrl();
    SAMLContainer samlServer = startSimpleSAML(rootUrl);
    GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
    sc.open();
    // Authentication
    SamlSecurityRealm realm = configureBasicSettings(sc);
    String idpMetadata = readIdPMetadataFromURL(samlServer);
    realm.setXml(idpMetadata);
    realm.setBinding(SAML2_POST_BINDING_URI);
    configureEncrytion(realm);
    configureAuthorization(sc);
    // SAML service login page
    waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
    // SAML server login
    makeLoginWithUser1();
}
Also used : SAMLContainer(org.jenkinsci.test.acceptance.docker.fixtures.SAMLContainer) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig) SamlSecurityRealm(org.jenkinsci.test.acceptance.plugins.saml.SamlSecurityRealm) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Example 69 with WithPlugins

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

the class WarningsPluginTest method should_send_mail_with_expanded_tokens.

/**
 * Checks that the plug-in sends a mail after a build has been failed. The content of the mail contains several
 * tokens that should be expanded in the mail with the correct values.
 */
// TODO: check if we can remove this test since a similar one in parent
@Test
@Issue("25501")
@WithPlugins("email-ext")
public void should_send_mail_with_expanded_tokens() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.tokens.AbstractTokenMacro", Sets.newHashSet("hudson.plugins.warnings.tokens.WarningsResultTokenMacro"));
    setUpMailer();
    FreeStyleJob job = createFreeStyleJob(settings -> {
        settings.addWorkspaceScanner(JAVA_TITLE, "**/*");
        settings.addWorkspaceScanner(MS_BUILD_ID, "**/*");
    });
    buildSuccessfulJob(job);
    editJob(job, WarningsBuildSettings.class, settings -> {
        settings.addWorkspaceScanner(JAVA_DOC_ID, "**/*");
        settings.setExcludePattern(".*Catalyst.*");
        settings.setBuildFailedTotalAll("0");
    });
    configureEmailNotification(job, "Warnings: ${WARNINGS_RESULT}", "Warnings: ${WARNINGS_COUNT}-${WARNINGS_FIXED}-${WARNINGS_NEW}");
    buildFailingJob(job);
    verifyReceivedMail("Warnings: FAILURE", "Warnings: 142-12-8");
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 70 with WithPlugins

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

the class WarningsPluginTest method detailsTabContentWithOneWarningTest.

@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void detailsTabContentWithOneWarningTest() throws ExecutionException, InterruptedException {
    WarningsAction action = createAndBuildCompileJobOnAgent(resource("/warnings_plugin/WarningMain2.java"), "javac -Xlint:all WarningMain2.java");
    SortedMap<String, String> details = action.getDetailsTabContents();
    assertThat("Assert the proper detail count.", details.entrySet(), hasSize(1));
    assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain2.java:9");
}
Also used : WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

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