Skip to content
Permalink
Browse files
[JENKINS-38928] Add a test doing apply then save in a job
  • Loading branch information
Vlatombe committed Oct 27, 2016
1 parent 247a837 commit 4721f1d188c6315b60c5ca9fac6e7495abe54fef
@@ -95,4 +95,10 @@ public void save() {
clickButton("Save");
assertThat(driver, not(hasContent("This page expects a form submission")));
}

public void apply() {
clickButton("Apply");
elasticSleep(1000);
assertThat(driver, hasContent("Saved"));
}
}
@@ -0,0 +1,32 @@
package core;

import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest;
import org.jenkinsci.test.acceptance.po.FreeStyleJob;
import org.jenkinsci.test.acceptance.po.ShellBuildStep;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;

import static org.jenkinsci.test.acceptance.Matchers.pageObjectExists;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

public class FreestyleJobTest extends AbstractJUnitTest {

@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();

j.visit("config.xml");

assertTrue("job config.xml should contain the step \"echo 1\"",driver.getPageSource().contains("echo 1"));
}
}

0 comments on commit 4721f1d

Please sign in to comment.