Making GhostDriver test "quiet-er" (and parallel)

Also, trying to get the exit status of those tests reported, in case they fail.

Related to #11952.
1.x
Ivan De Marino 2014-02-05 23:08:41 +00:00
parent 1797c146f1
commit ba5998f74e
8 changed files with 30 additions and 44 deletions

1
.gitignore vendored
View File

@ -57,3 +57,4 @@ tools/dump_syms.app/
bin/
*.class
build/
.gradle/

View File

@ -9,7 +9,7 @@ install:
- sudo apt-get -yq install build-essential chrpath libssl-dev libfontconfig1-dev #< Build Dependencies
before_script:
- chmod +x ./build.sh
- chmod +x ./test-ghostdriver.sh
- chmod +x ./test/run-tests-ghostdriver.sh
script:
- ./build.sh --confirm --silent #< Build
- ./test-ghostdriver.sh #< Test (GhostDriver / PhantomJSDriver)
- ./test/run-tests-ghostdriver.sh #< Test (GhostDriver / PhantomJSDriver)

View File

@ -1,10 +1,7 @@
2014-02-04 23:18:11
2014-02-12 23:42:59
commit c85f27f06cf23d8ef783c6c9afe54b2975f59249 (HEAD, refs/heads/master)
commit 2af7099a9f5cf683ff565617be38b70318c9203f (HEAD, refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/master)
Author: Ivan De Marino <detronizator@gmail.com>
Date: Tue Feb 4 22:27:45 2014 +0000
Date: Wed Feb 12 23:42:43 2014 +0000
Moving "test fixtures" into "fixtures" directory.
Also, removing Python tests: never used and extremely limited.
The Selenium PhantomJSDriver maintainer for Python has its own tests.
Removing flaky (and pointless) test

View File

@ -35,8 +35,9 @@ tasks.withType(JavaExec) {
}
test {
// Listening to test execution events
beforeTest { descriptor ->
logger.lifecycle("Running " + descriptor)
maxParallelForks = 3
afterTest { descriptor, result ->
logger.quiet(result.toString() + " for " + descriptor + " in " + descriptor.getParent())
}
}

View File

@ -38,7 +38,6 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@ -241,24 +240,4 @@ public class ElementMethodsTest extends BaseTestWithServer {
assertTrue(d.getTitle().contains(inputString));
}
@Test
public void shouldUsePageTimeoutToWaitForPageLoadOnInput_negativeCase() throws InterruptedException {
WebDriver d = getDriver();
String inputString = "clicking";
d.get("http://www.duckduckgo.com");
WebElement textInput = d.findElement(By.cssSelector("#search_form_input_homepage"));
assertFalse(d.getTitle().contains(inputString));
textInput.click();
assertFalse(d.getTitle().contains(inputString));
// Set Implicit Timeout to 0: this will force Driver to NOT wait
d.manage().timeouts().pageLoadTimeout(0, TimeUnit.MILLISECONDS);
// This input will ALSO submit the search form, causing a Page Load
textInput.sendKeys(inputString + "\n");
assertFalse(d.getTitle().contains(inputString));
}
}

View File

@ -89,6 +89,7 @@ public class ScriptExecutionTest extends BaseTest {
assertEquals("abc", stringResult);
}
@Ignore("Known issue #140 - see https://github.com/detro/ghostdriver/issues/140)")
@Test
public void shouldBeAbleToExecuteMultipleAsyncScriptsSequentiallyWithNavigation() {
// NOTE: This test is supposed to fail!

View File

@ -7,35 +7,38 @@ import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.logging.Logger;
public class GetFixtureHttpRequestCallback implements HttpRequestCallback {
private static final String FIXTURE_PATH = "fixtures";
private static final Logger LOG = Logger.getLogger(GetFixtureHttpRequestCallback.class.getName());
private static final String FIXTURE_PATH = "../fixtures";
@Override
public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
String path = req.getPathInfo();
// Construct path to the file
Path filePath = FileSystems.getDefault().getPath(FIXTURE_PATH, req.getPathInfo());
if (null != path) {
// If the file exists
if (filePath.toFile().exists()) {
try {
// Construct path to the file
Path filePath = FileSystems.getDefault().getPath(FIXTURE_PATH, path);
// Set Content Type
res.setContentType(filePathToMimeType(filePath.toString()));
// Read and write to response
Files.copy(filePath, res.getOutputStream());
return;
} catch (RuntimeException re) {
// Not Found. Handled below.
} catch (NoSuchFileException nsfe) {
// Not Found. Handled below.
LOG.warning(nsfe.getClass().getName());
} catch (IOException ioe) {
// Not Found. Handled below.
LOG.warning(ioe.getClass().getName());
} catch (RuntimeException re) {
LOG.warning(re.getClass().getName());
}
}
System.out.println("Fixture NOT FOUND");
LOG.warning("Fixture NOT FOUND: "+filePath);
res.sendError(404); //< Not Found
}

View File

@ -7,7 +7,11 @@ pushd ./test/ghostdriver-test/java
chmod +x ./gradlew
# Run tests
./gradlew test
./gradlew test -q
# Grab exit status
TEST_EXIT_STATUS=$?
# Return to starting directory
popd
exit $TEST_EXIT_STATUS