use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_scan_console_log_of_slave_build.
@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_scan_console_log_of_slave_build() throws ExecutionException, InterruptedException {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource(RESOURCE_WARNING_MAIN_JAVA_PATH));
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(CMD_WARNING_MAIN_JAVA_CONSOLE);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = job.startBuild().shouldSucceed();
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 3);
String codeLine = action.getLinkedSourceFileText(AnalysisAction.Tab.DETAILS, "WarningMain.java", 10);
String[] codeLineArr = codeLine.trim().split("\\s+", 2);
assertThat("Warning should be at line", codeLineArr[0], is("10"));
assertThat("Assert failed comparing code line is", codeLineArr[1], is("text = (TextClass) text2;"));
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class MavenModuleSet method addShellStep.
@Override
public ShellBuildStep addShellStep(String shell) {
ShellBuildStep step = addPreBuildStep(ShellBuildStep.class);
step.command(shell);
return step;
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class CredentialsBindingTest method testTextBinding.
@Test
public void testTextBinding() {
CredentialsPage mc = new CredentialsPage(jenkins, ManagedCredentials.DEFAULT_DOMAIN);
mc.open();
StringCredentials cred = mc.add(StringCredentials.class);
cred.scope.select("GLOBAL");
cred.secret.set(SECRET_TEXT);
mc.create();
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.check("Use secret text(s) or file(s)");
ManagedCredentialsBinding mcb = new ManagedCredentialsBinding(job);
SecretStringCredentialsBinding cb = mcb.addCredentialBinding(SecretStringCredentialsBinding.class);
cb.variable.set("BINDED_SECRET");
ShellBuildStep shell = job.addBuildStep(ShellBuildStep.class);
shell.command("if [ \"$BINDED_SECRET\" = \"" + SECRET_TEXT + "\" ] \n then \n echo \"" + SECRET_OUTPUT + "\" \n fi");
job.save();
Build b = job.scheduleBuild();
b.shouldSucceed();
assertThat(b.getConsole(), containsString(SECRET_OUTPUT));
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class JobConfigHistoryPluginTest method show_difference_in_config_history.
@Test
public void show_difference_in_config_history() {
FreeStyleJob job = jenkins.jobs.create();
job.configure();
ShellBuildStep step = job.addShellStep(LS_COMMAND);
job.save();
job.configure();
step.command(LS_LH_COMMAND);
job.save();
JobConfigHistory action = job.action(JobConfigHistory.class);
action.open();
assertThat(driver, Matchers.hasContent(CREATED));
assertThat(driver, Matchers.hasContent("Changed"));
action.showLastChange();
assertThat(driver, Matchers.hasElement(by.xpath("//td[@class='diff_original' and contains(string(.), '" + String.format(COMMAND_NODE, LS_COMMAND) + "')]")));
assertThat(driver, Matchers.hasElement(by.xpath("//td[@class='diff_revised' and contains(string(.), '" + String.format(COMMAND_NODE, LS_LH_COMMAND) + "')]")));
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class FreestyleJobTest method apply_then_save.
@Test
@Issue("JENKINS-38928")
public void apply_then_save() {
FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class, "simple-job");
assertThat(j, pageObjectExists());
j.configure();
ShellBuildStep shell = j.addBuildStep(ShellBuildStep.class);
shell.command("echo 1");
j.apply();
j.save();
String src = getConfigXml(j);
assertThat(src, containsString("echo 1"));
}
Aggregations