diff --git a/backend/build.gradle b/backend/build.gradle index 54028c5b7..40ace20d1 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -152,7 +152,7 @@ dependencies { //JSON schema validator compile 'org.sharegov:mjson:1.4.1' - integrationTestCompile 'com.saucelabs:sebuilder-interpreter:3.0.0-SNAPSHOT' + integrationTestCompile 'com.saucelabs:sebuilder-interpreter:1.0.6' } def generatedSrcDir = new File(buildDir, 'generated/src/main/java') @@ -181,6 +181,7 @@ sourceSets { task integrationTest(type: Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath + systemProperties = ['webdriver.gecko.driver': 'C:\\Users\\jj-unicon\\Downloads\\geckodriver-v0.21.0-win64\\geckodriver.exe'] } task generateSources { diff --git a/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java b/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java new file mode 100644 index 000000000..a7ddb5217 --- /dev/null +++ b/backend/src/integration/groovy/com/sebuilder/interpreter/webdriverfactory/Firefox.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012 Sauce Labs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.sebuilder.interpreter.webdriverfactory; + +import java.io.File; +import java.util.HashMap; +import org.openqa.selenium.firefox.FirefoxBinary; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxOptions; +import org.openqa.selenium.firefox.FirefoxProfile; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; + +public class Firefox implements WebDriverFactory { + /** + * @param config Key/value pairs treated as required capabilities, with the exception of: + * + * @return A FirefoxDriver. + */ + @Override + public RemoteWebDriver make(HashMap config) { + FirefoxBinary fb = config.containsKey("binary") + ? new FirefoxBinary(new File(config.get("binary"))) + : new FirefoxBinary(); + FirefoxProfile fp = config.containsKey("profile") + ? new FirefoxProfile(new File(config.get("profile"))) + : new FirefoxProfile(); + HashMap caps = new HashMap(config); + caps.remove("binary"); + caps.remove("profile"); + FirefoxOptions options = new FirefoxOptions(new DesiredCapabilities(caps)); + options.setProfile(fp); + options.setBinary(fb); + return new FirefoxDriver(options); + } +}