Permalink
Browse files

Adding test for submit

  • Loading branch information...
1 parent c0ddecf commit a55921876f646a8b0ad2c56ce2db781333ada87f @jimevans jimevans committed Oct 31, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/java/src/test/java/ghostdriver/ElementMethodsTest.java
@@ -31,6 +31,8 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.openqa.selenium.support.ui.ExpectedConditions;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -61,4 +63,22 @@ public void checkEnabledOnGoogleSearchBox() {
assertTrue(el.isEnabled());
}
+
+ @Test
+ public void SubmittingFormShouldFireOnSubmitForThatForm() {
+ WebDriver d = getDriver();
+
+ d.get("http://ci.seleniumhq.org:2310/common/javascriptPage.html");
+ WebElement formElement = d.findElement(By.id("submitListeningForm"));
+ formElement.submit();
+
+ WebDriverWait wait = new WebDriverWait(d, 30);
+ wait.until(ExpectedConditions.textToBePresentInElement(By.id("result"), "form-onsubmit"));
+
+ WebElement result = d.findElement(By.id("result"));
+ String text = result.getText();
+ boolean conditionMet = text.contains("form-onsubmit");
+
+ assertTrue(conditionMet);
+ }
}

0 comments on commit a559218

Please sign in to comment.