Skip to content

Commit

Permalink
[SHIBUI-922]
Browse files Browse the repository at this point in the history
WIP shenanigans
  • Loading branch information
jj committed Nov 27, 2018
1 parent 98cf437 commit 34ea82a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
* <ul>
* <li>binary: path to Firefox binary to use</li>
* <li>profile: path to Firefox profile to use</li>
* </ul>
* @return A FirefoxDriver.
*/
@Override
public RemoteWebDriver make(HashMap<String, String> 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<String, String> caps = new HashMap<String, String>(config);
caps.remove("binary");
caps.remove("profile");
FirefoxOptions options = new FirefoxOptions(new DesiredCapabilities(caps));
options.setProfile(fp);
options.setBinary(fb);
return new FirefoxDriver(options);
}
}

0 comments on commit 34ea82a

Please sign in to comment.