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();
}
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"));
}
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();
}
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");
}
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);
}
Aggregations