Skip to content

Commit

Permalink
Stabilize FormValidationTest
Browse files Browse the repository at this point in the history
Current API is flawed for asserting form validation.
Matchers should be able to retrieve state from selenium, without knowing
what you are looking for you don't know what should be on the page.

Added a hacky sleep to stabilize test suite rather than adjusting the
API
  • Loading branch information
timja committed Jul 6, 2022
1 parent e6d2b94 commit 650531a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/java/core/FormValidationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
*/
package core;

import hudson.util.VersionNumber;
import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest;
import org.jenkinsci.test.acceptance.po.FormValidation;
import org.jenkinsci.test.acceptance.po.JenkinsConfig;
import org.jenkinsci.test.acceptance.po.ListView;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -64,6 +63,8 @@ private void jsValidation() {
assertThat(formValidation, silent());

c.numExecutors.set(-16);
c.numExecutors.resolve().sendKeys(Keys.TAB);
c.numExecutors.sleep(100L);
formValidation = c.numExecutors.getFormValidation();

String errorMessage = "Not a non-negative integer";
Expand Down

0 comments on commit 650531a

Please sign in to comment.