Skip to content

Commit

Permalink
Merge pull request #322 from vmi/develop
Browse files Browse the repository at this point in the history
Merge development features 2020-08-15
  • Loading branch information
vmi authored Aug 15, 2020
2 parents 21538a8 + 9964481 commit f99630f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cache:
- $HOME/.m2
install:
- gd_url=https://github.com/mozilla/geckodriver/releases/download
- gd_ver=v0.21.0
- gd_ver=v0.27.0
- ( mkdir -pv bin; cd bin ; curl -L "${gd_url}/${gd_ver}/geckodriver-${gd_ver}-linux64.tar.gz" | gunzip | tar xf - ; chmod +x geckodriver )
- mvn -B -V dependency:resolve
before_script:
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de
<target.version>1.8</target.version>
<skipTests>true</skipTests>
<selenium.version>3.141.59</selenium.version>
<htmlunit.version>2.40.0</htmlunit.version>
<htmlunit.version>2.43.0</htmlunit.version>
<htmlunit-core-js.version>${htmlunit.version}</htmlunit-core-js.version>
<neko-htmlunit.version>${htmlunit.version}</neko-htmlunit.version>
<htmlunit-driver.version>${htmlunit.version}</htmlunit-driver.version>
<htmlunit-driver.version>2.43.1</htmlunit-driver.version>
<slf4j.version>1.7.30</slf4j.version>
<maven.version.rules>file://${basedir}/version-rules.xml</maven.version.rules>
<shade.java.srcdir>src/shade/java</shade.java.srcdir>
Expand Down Expand Up @@ -393,12 +393,12 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.10.7</version>
<version>1.10.8</version>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -537,7 +537,7 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.49.Final</version>
<version>4.1.51.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -569,17 +569,17 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.8</version>
<version>1.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<version>2.7</version>
</dependency>
<dependency>
<groupId>args4j</groupId>
Expand Down Expand Up @@ -669,7 +669,7 @@ It supports test-case and test-suite which are Selenium IDE's native format.</de
<dependency>
<groupId>com.assertthat</groupId>
<artifactId>selenium-shutterbug</artifactId>
<version>0.9.3</version>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/jp/vmi/selenium/selenese/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.assertthat.selenium_shutterbug.core.Capture;
import com.assertthat.selenium_shutterbug.core.Shutterbug;
import com.assertthat.selenium_shutterbug.utils.web.ScrollStrategy;
import com.google.common.base.Strings;

import jp.vmi.html.result.HtmlResult;
Expand Down Expand Up @@ -72,7 +72,7 @@ public class Runner implements Context, ScreenshotHandler, HighlightHandler, JUn

private static final DateTimeFormatter FILE_DATE_TIME = DateTimeFormatter.ofPattern("yyyyMMdd_HHmmssSSS");

private static PrintStream DEFAULT_PRINT_STREAM = new PrintStream(new NullOutputStream());
private static PrintStream DEFAULT_PRINT_STREAM = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM);

private PrintStream ps;
private WebDriver driver = null;
Expand Down Expand Up @@ -226,13 +226,6 @@ protected String takeScreenshot(File file, boolean entirePage) throws Unsupporte
if (tss == null)
throw new UnsupportedOperationException("webdriver does not support capturing screenshot.");
file = file.getAbsoluteFile();
try {
// cf. http://prospire-developers.blogspot.jp/2013/12/selenium-webdriver-tips.html (Japanese)
driver.switchTo().defaultContent();
} catch (Exception e) {
// some times switching to default context throws exceptions like:
// Method threw 'org.openqa.selenium.UnhandledAlertException' exception.
}
File tmp;
try {
File dir = file.getParentFile();
Expand All @@ -248,7 +241,7 @@ protected String takeScreenshot(File file, boolean entirePage) throws Unsupporte

Map<?, ?> initialCoord = (Map<?, ?>) je.executeScript(getScrollCoord);

Shutterbug.shootPage((WebDriver) tss, ScrollStrategy.WHOLE_PAGE, screenshotScrollTimeout)
Shutterbug.shootPage((WebDriver) tss, Capture.FULL_SCROLL, screenshotScrollTimeout)
.withName(FilenameUtils.removeExtension(tmp.getName()))
.save(dir.getPath());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.Test;
import org.junit.rules.ExternalResource;
import org.junit.rules.TemporaryFolder;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.InvalidArgumentException;

import static org.openqa.selenium.firefox.FirefoxDriver.SystemProperty.*;

Expand Down Expand Up @@ -52,14 +52,14 @@ protected void after() {
* Test of not finding Firefox binary.
*
* @throws IOException exception.
* @throws IllegalArgumentException exception.
* @throws InvalidArgumentException exception.
*/
@Test(expected = IllegalStateException.class)
public void firefoxNotFoundIn_webdriver_firefox_bin() throws IOException, IllegalArgumentException {
@Test(expected = InvalidArgumentException.class)
public void firefoxNotFoundIn_webdriver_firefox_bin() throws IOException, InvalidArgumentException {
try {
new FirefoxDriverFactory().newInstance(new DriverOptions());
} catch (SessionNotCreatedException e) {
throw new IllegalStateException(e);
} catch (IllegalStateException e) {
throw new InvalidArgumentException(e.getMessage(), e);
}
}
}

0 comments on commit f99630f

Please sign in to comment.