Skip to content

Commit

Permalink
Build the SafariDriver using Buck.
Browse files Browse the repository at this point in the history
Assumes a prebuilt safari extension.
  • Loading branch information
shs96c committed Jan 11, 2015
1 parent bb9df23 commit 54c0a29
Show file tree
Hide file tree
Showing 16 changed files with 234 additions and 31 deletions.
1 change: 1 addition & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
firefox = //java/client/src/org/openqa/selenium/firefox:firefox
htmlunit = //java/client/src/org/openqa/selenium/htmlunit:htmlunit
remote = //java/client/src/org/openqa/selenium/remote:remote
safari = //java/client/src/org/openqa/selenium/safari:safari

leg-rc = //java/client/src/com/thoughtworks/selenium:legacy-selenium-client
22 changes: 15 additions & 7 deletions java/client/src/org/openqa/selenium/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ java_library(
srcs = [
'internal/Base64Encoder.java',
],
visibility = [
'//java/client/src/org/openqa/selenium/chrome:chrome',
'//java/client/src/org/openqa/selenium/io:io',
'//java/client/src/org/openqa/selenium/opera:opera',
'//java/client/test/org/openqa/selenium:tests',
'//java/client/test/org/openqa/selenium/environment:environment',
],
visibility = ['PUBLIC'],
)

java_library(name = 'core',
Expand Down Expand Up @@ -127,3 +121,17 @@ java_library(name = 'primitives',
'//java/client/src/org/openqa/selenium/interactions:core',
],
)

java_binary(name = 'selenium-java',
deps = [
':webdriver-api',
'//java/client/src/org/openqa/selenium/htmlunit:htmlunit',
'//java/client/src/org/openqa/selenium/ie:ie',
'//java/client/src/org/openqa/selenium/chrome:chrome',
'//java/client/src/org/openqa/selenium/firefox:firefox',
'//java/client/src/org/openqa/selenium/lift:lift',
'//java/client/src/org/openqa/selenium/remote:remote',
'//java/client/src/org/openqa/selenium/safari:safari',
'//java/client/src/org/openqa/selenium/support:support',
],
)
13 changes: 13 additions & 0 deletions java/client/src/org/openqa/selenium/browserlaunchers/locators/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
java_library(name = 'locators',
srcs = glob(['*.java']),
deps = [
'//java/client/src/org/openqa/selenium/io:io',
'//java/client/src/org/openqa/selenium/os:os',
'//java/client/src/org/openqa/selenium/remote:capabilities',
'//java/client/src/org/openqa/selenium:platform',
'//third_party/java/guava-libraries:guava-libraries',
],
visibility = [
'//java/client/src/org/openqa/selenium/safari:safari',
],
)
2 changes: 2 additions & 0 deletions java/client/src/org/openqa/selenium/os/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ java_library(
'//third_party/java/jna:jna',
],
visibility = [
'//java/client/src/org/openqa/selenium/browserlaunchers/locators:locators',
'//java/client/src/org/openqa/selenium/firefox:firefox',
'//java/client/src/org/openqa/selenium/remote/service:service',
'//java/client/src/org/openqa/selenium/safari:safari',
'//java/client/test/org/openqa/selenium:tests',
'//java/client/test/org/openqa/selenium/testing/drivers:drivers',
],
Expand Down
31 changes: 31 additions & 0 deletions java/client/src/org/openqa/selenium/safari/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
java_library(name = 'safari',
srcs = glob(['*.java']),
resources = [
':client',
':extension',
],
deps = [
'//java/client/src/org/openqa/selenium:codecs',
'//java/client/src/org/openqa/selenium:webdriver-api',
'//java/client/src/org/openqa/selenium/io:io',
'//java/client/src/org/openqa/selenium/browserlaunchers/locators:locators',
'//java/client/src/org/openqa/selenium/net:net',
'//java/client/src/org/openqa/selenium/os:os',
'//java/client/src/org/openqa/selenium/remote:capabilities',
'//java/client/src/org/openqa/selenium/remote:remote',
'//third_party/java/guava-libraries:guava-libraries',
'//third_party/java/gson:gson',
'//third_party/java/netty:netty',
],
visibility = ['PUBLIC'],
)

export_file(name = 'client',
src = '//javascript/safari-driver:client',
out = 'client.js',
)

export_file(name = 'extension',
src = '//javascript/safari-driver/prebuilt:extension',
out = 'SafariDriver.safariextz',
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import com.google.common.base.Joiner;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.UnhandledAlertException;
import org.openqa.selenium.WebElement;

import com.google.common.base.Joiner;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.testing.NeedsLocalEnvironment;

import java.util.concurrent.TimeUnit;

@NeedsLocalEnvironment(reason = "Requires local browser launching environment")
public class AlertTests extends SafariTestBase {
public class AlertsTest extends SafariTestBase {

@AfterClass
public static void quitDriver() {
Expand Down
34 changes: 34 additions & 0 deletions java/client/test/org/openqa/selenium/safari/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
java_test(name = 'safari',
srcs = [ 'SafariDriverTests.java' ],
vm_args = [
'-Dselenium.browser=safari',
],
deps = [
':tests',
'//java/client/src/org/openqa/selenium:platform',
'//java/client/test/org/openqa/selenium:large-tests',
'//java/client/test/org/openqa/selenium/testing:test-base',
'//third_party/java/junit:junit',
],
)

java_library(name = 'tests',
srcs = glob(['*Test.java']) + ['SafariTestBase.java'],
deps = [
'//java/client/src/org/openqa/selenium:webdriver-api',
'//java/client/src/org/openqa/selenium/remote:remote',
'//java/client/src/org/openqa/selenium/safari:safari',
'//java/client/src/org/openqa/selenium/support/ui:wait',
'//java/client/test/org/openqa/selenium:helpers',
'//java/client/test/org/openqa/selenium:tests',
'//java/client/test/org/openqa/selenium/environment:environment',
'//java/client/test/org/openqa/selenium/testing:annotations',
'//java/client/test/org/openqa/selenium/testing:helpers',
'//java/client/test/org/openqa/selenium/testing:test-base',
'//third_party/java/guava-libraries:guava-libraries',
'//third_party/java/hamcrest:hamcrest',
'//third_party/java/junit:junit',
'//third_party/java/mockito:mockito',
'//third_party/java/netty:netty',
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({
StandardSeleniumTests.class,
AlertTests.class,
AlertsTest.class,
CleanSessionTest.class,
CrossDomainTest.class,
SafariExtensionsTest.class,
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/testing/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ java_library(name = 'annotations',
'//java/client/src/org/openqa/selenium:platform',
],
visibility = [
'//java/client/test/org/openqa/selenium/testing/drivers/...',
'//java/client/test/...',
],
)

Expand Down
16 changes: 8 additions & 8 deletions javascript/atoms/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ js_library(name = 'action',
deps = [
':devices',
':dom',
':error-lib',
':errors',
':events',
'//third_party/closure:closure',
],
Expand Down Expand Up @@ -45,7 +45,7 @@ js_library(name = 'devices',
],
deps = [
':dom',
':error-lib',
':errors',
':events',
':locators',
'//third_party/closure:closure',
Expand Down Expand Up @@ -73,7 +73,7 @@ js_library(name = 'dom',
)


js_library(name = 'error-lib',
js_library(name = 'errors',
srcs = [
'error.js',
'response.js',
Expand All @@ -91,7 +91,7 @@ js_library(name = 'events',
deps = [
':bot',
':dom',
':error-lib',
':errors',
':json',
'//third_party/closure:closure',
],
Expand All @@ -105,7 +105,7 @@ js_library(name = 'html5',
srcs = glob(['html5/*.js']),
deps = [
':bot',
':error-lib',
':errors',
':json',
'//third_party/closure:closure',
],
Expand All @@ -122,7 +122,7 @@ js_library(name = 'inject',
],
deps = [
':bot',
':error-lib',
':errors',
':json',
'//third_party/closure:closure',
],
Expand Down Expand Up @@ -167,7 +167,7 @@ js_library(name = 'window',
],
deps = [
':bot',
':error-lib',
':errors',
':events',
':json',
':locators',
Expand All @@ -185,7 +185,7 @@ js_library(name = 'xpath',
],
deps = [
':bot',
':error-lib',
':errors',
'//third_party/closure:closure',
'//third_party/js/wgxpath:wgxpath',
],
Expand Down
14 changes: 7 additions & 7 deletions javascript/firefox-driver/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ js_binary(name = 'command-processor',
':timer',
':utils',
':webelement',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
'//javascript/atoms:json',
'//javascript/atoms:locators',
'//third_party/closure:closure',
Expand Down Expand Up @@ -305,7 +305,7 @@ js_binary(name = 'synthetic-mouse',
'//javascript/atoms:action',
'//javascript/atoms:devices',
'//javascript/atoms:dom',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
'//javascript/atoms:events',
'//javascript/atoms:window',
'//third_party/closure:closure',
Expand All @@ -328,7 +328,7 @@ js_binary(name = 'web-element-cache',
':firefox-utils',
':moz',
':utils',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
'//third_party/closure:closure',
],
)
Expand All @@ -344,7 +344,7 @@ js_library(name = 'dispatcher',
':request',
':response',
':utils',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
],
)

Expand Down Expand Up @@ -385,7 +385,7 @@ js_library(name = 'firefox-utils',
],
deps = [
':moz',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
'//javascript/atoms:json',
'//third_party/closure:closure',
],
Expand Down Expand Up @@ -439,7 +439,7 @@ js_library(name = 'modals',
':moz',
':timer',
':utils',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
],
)

Expand Down Expand Up @@ -562,7 +562,7 @@ js_library(name = 'webelement',
':web-loading-listener',
'//javascript/atoms:action',
'//javascript/atoms:dom',
'//javascript/atoms:error-lib',
'//javascript/atoms:errors',
'//javascript/webdriver/atoms:atoms-lib',
'//third_party/closure:closure',
],
Expand Down
79 changes: 79 additions & 0 deletions javascript/safari-driver/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
js_library(name = 'common',
srcs = [
'alert.js',
'console.js',
'logging.js',
'tab.js',
],
deps = [
'//javascript/atoms:errors',
'//javascript/safari-driver/message:message',
'//third_party/closure:closure',
],
)

js_library(name = 'command',
srcs = [
'command.js',
'dom.js',
],
deps = [
'//javascript/atoms:json',
'//javascript/webdriver:base',
],
visibility = [
'//javascript/safari-driver/...',
],
)

# Binary that may be used by a language binding to establish a connection
# with the driver when loaded in the browser.
js_binary(name = 'client',
srcs = [
'client.js',
'deps.js',
],
deps = [
':common',
'//javascript/safari-driver/message:message',
'//third_party/closure:closure',
],
externs = [
'externs/common.js',
'externs/webcontent.js',
],
flags = [
'--define=goog.userAgent.ASSUME_WEBKIT=true',
'--define=goog.userAgent.product.ASSUME_SAFARI=true',
'--define=safaridriver.message.FORCE_SYNCHRONOUS_PROXY_SEND=true',

'--jscomp_error=accessControls',
'--jscomp_error=ambiguousFunctionDecl',
'--jscomp_error=checkRegExp',
'--jscomp_error=checkVars',
'--jscomp_error=constantProperty',
'--jscomp_error=deprecated',
'--jscomp_error=duplicateMessage',
'--jscomp_error=es5Strict',
'--jscomp_error=externsValidation',
'--jscomp_error=fileoverviewTags',
'--jscomp_error=globalThis',
'--jscomp_error=invalidCasts',
'--jscomp_error=missingProperties',
'--jscomp_error=nonStandardJsDocs',
'--jscomp_error=strictModuleDepCheck',
'--jscomp_error=typeInvalidation',
'--jscomp_error=undefinedVars',
'--jscomp_error=unknownDefines',
'--jscomp_error=uselessCode',
'--jscomp_error=visibility',

'--jscomp_warning=checkTypes',

"--output_wrapper='%output%;window.onload = init;'",
'--third_party=false',
],
visibility = [
'//java/client/src/org/openqa/selenium/safari:client',
],
)
Loading

0 comments on commit 54c0a29

Please sign in to comment.