Navigation Menu

Skip to content

Commit

Permalink
[JENKINS-38928] Add a test doing apply then save in a job
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Oct 27, 2016
1 parent 247a837 commit 4721f1d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Expand Up @@ -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"));
}
}
32 changes: 32 additions & 0 deletions src/test/java/core/FreestyleJobTest.java
@@ -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.