Skip to content

Commit

Permalink
Splitting a long test scenario into shorter ones
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Mar 1, 2013
1 parent b28ccfc commit b548049
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions java/client/test/com/thoughtworks/selenium/corebased/TestOpen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,27 @@

import org.junit.Test;

import java.util.regex.Pattern;

public class TestOpen extends InternalSelenseTestBase {
@Test
public void testOpen() throws Exception {
selenium.open("../tests/html/test_open.html");
verifyTrue(selenium.getLocation().matches("^[\\s\\S]*/tests/html/test_open\\.html$"));
// Should really split these verifications into their own test file.
verifyTrue(Pattern.compile(".*/tests/html/[Tt]est_open.html").matcher(selenium.getLocation())
.find());
verifyFalse(selenium.getLocation().matches("^[\\s\\S]*/foo\\.html$"));
verifyTrue(selenium.isTextPresent("glob:This is a test of the open command."));
}

@Test
public void testIsTextPresentCanDoExactAndRegexChecks() {
selenium.open("../tests/html/test_open.html");
verifyTrue(selenium.isTextPresent("This is a test of the open command."));
verifyTrue(selenium.isTextPresent("glob:This is a test of the open command."));
verifyTrue(selenium.isTextPresent("exact:This is a test of"));
verifyTrue(selenium.isTextPresent("regexp:This is a test of"));
verifyTrue(selenium.isTextPresent("regexp:T*his is a test of"));
verifyFalse(selenium.isTextPresent("exact:XXXXThis is a test of"));
verifyFalse(selenium.isTextPresent("regexp:ThXXXXXXXXXis is a test of"));
}

@Test
public void testCanOpenSlowLoadingPage() {
selenium.open("../tests/html/test_page.slow.html");
verifyTrue(selenium.getLocation().matches("^[\\s\\S]*/tests/html/test_page\\.slow\\.html$"));
verifyEquals(selenium.getTitle(), "Slow Loading Page");
Expand All @@ -48,4 +51,5 @@ public void testOpen() throws Exception {
selenium.open("../tests/html/test_open.html");
selenium.open("../tests/html/test_open.html");
}

}

0 comments on commit b548049

Please sign in to comment.