Search in sources :

Example 6 with WithPlugins

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

the class SAMLPluginTest method authenticationOKFromURL.

@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOKFromURL() 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);
    realm.setUrl(createIdPMetadataURL(samlServer));
    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 7 with WithPlugins

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

the class SAMLPluginTest method authenticationFail.

@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationFail() 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);
    configureEncrytion(realm);
    configureAuthorization(sc);
    // SAML service login page
    waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
    // SAML server login
    find(by.id("username")).sendKeys("user1");
    find(by.id("password")).sendKeys("WrOnGpAsSwOrD");
    find(by.button("Login")).click();
    // wait for the login to propagate
    waitFor().withTimeout(5, TimeUnit.SECONDS).until(() -> hasContent("Either no user with the given username could be found, or the password you gave was wrong").matchesSafely(driver));
    assertThat(jenkins.getCurrentUrl(), containsString("simplesaml/module.php/core/loginuserpass.php"));
}
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 8 with WithPlugins

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

the class SAMLPluginTest method authenticationOK.

@Test
@WithDocker
@WithPlugins({ "saml", "matrix-auth" })
public void authenticationOK() 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_REDIRECT_BINDING_URI);
    configureEncrytion(realm);
    configureAuthorization(sc);
    // SAML service login page
    waitFor().withTimeout(10, TimeUnit.SECONDS).until(() -> hasContent("Enter your username and password"));
    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 9 with WithPlugins

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

the class WarningsPluginTest method should_resolve_workspace_files.

/**
 * Verifies that Jenkins scans the workspace for all available files to resolve relative paths
 * of files with warnings when the option 'resolve-relative-paths' is enabled.
 */
@Test
@Issue("JENKINS-32150")
@WithPlugins("analysis-core@1.76")
public void should_resolve_workspace_files() {
    FreeStyleJob job = createFreeStyleJob(RESOURCES + "jenkins-32150", settings -> {
        settings.addWorkspaceScanner(CLANG_ID, "**/compile-log.txt");
        settings.setCanResolveRelativePaths(true);
    });
    Build build = buildSuccessfulJob(job);
    assertThatActionExists(job, build, "LLVM/Clang Warnings");
    build.open();
    int count = 10;
    assertThat(driver, hasContent("LLVM/Clang Warnings: " + count));
    WarningsAction action = new WarningsAction(build, "LLVM/Clang", "Clang (LLVM based)");
    assertThatWarningsCountInSummaryIs(action, count);
    assertThatNewWarningsCountInSummaryIs(action, count);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(count));
    assertThat(action.getNumberOfNewWarnings(), is(count));
    assertThat(action.getNumberOfFixedWarnings(), is(0));
    assertThat(action.getNumberOfWarningsWithHighPriority(), is(0));
    assertThat(action.getNumberOfWarningsWithNormalPriority(), is(count));
    assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
    assertThatFilesTabIsCorrectlyFilled(action);
    assertThatWarningsTabIsCorrectlyFilled(action);
    verifySourceLine(action, "file-in-subdir.txt", 2, "02 EXAMPLE IN SUBDIR", "Some other warning");
    verifySourceLine(action, "file.txt", 6, "06 EXAMPLE", "Some warning SECOND");
    // Since multi-file-in-subdir.txt is contained twice in the workspace no source code is resolved
    verifySourceLine(action, "multi-file-in-subdir.txt", 3, "03 Is the file 'multi-file-in-subdir.txt' contained more than once in your workspace?", "Another warning");
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 10 with WithPlugins

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

the class WarningsPluginTest method should_parse_codenarc_on_agent.

@Test
@Issue("JENKINS-17787")
@WithPlugins({ "violations", "ssh-slaves" })
@WithDocker
@Ignore("Reproduces JENKINS-17787")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
public void should_parse_codenarc_on_agent() {
    DumbSlave dockerSlave = createDockerAgent();
    FreeStyleJob job = prepareDockerSlave(dockerSlave);
    assertThatCodeNarcActionExists(job);
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) 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