Skip to content

Commit

Permalink
[java] Making progress with bazel. Now it can run ClickTest in FIrefo…
Browse files Browse the repository at this point in the history
…x. This required to move around test base classes to break package coupling.
  • Loading branch information
barancev committed Nov 24, 2018
1 parent 2a1c012 commit 5c9328c
Show file tree
Hide file tree
Showing 47 changed files with 194 additions and 252 deletions.
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/os/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ java_library(
visibility = [
'//java/client/src/org/openqa/selenium:selenium',
'//java/client/test/org/openqa/selenium:tests',
'//java/client/test/org/openqa/selenium/build:build',
'//java/client/test/org/openqa/selenium/testing/drivers:drivers',
],
)
Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/os/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ java_library(
srcs = glob(["*.java"]),
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/build:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.openqa.selenium.BuckBuild;
import org.openqa.selenium.build.BuckBuild;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WrapsDriver;
import org.openqa.selenium.environment.GlobalTestEnvironment;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.testing.DevMode;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.DevMode;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.drivers.Browser;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.thoughtworks.selenium.testing;

import org.openqa.selenium.environment.webserver.JettyAppServer;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.seleniumhq.jetty9.servlet.ServletContextHandler;

import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package com.thoughtworks.selenium.testing;

import org.openqa.selenium.BuckBuild;
import org.openqa.selenium.build.BuckBuild;
import org.openqa.selenium.environment.TestEnvironment;
import org.openqa.selenium.environment.webserver.AppServer;
import org.openqa.selenium.environment.webserver.Page;
Expand Down
5 changes: 1 addition & 4 deletions java/client/test/org/openqa/selenium/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ java_library(name = 'large-tests',

java_library(name = 'helpers',
srcs = [
'BuckBuild.java',
'Build.java',
'Pages.java',
'ParallelTestRunner.java',
'StubDriver.java',
'WaitingConditions.java',
Expand All @@ -44,7 +41,6 @@ java_library(name = 'helpers',
'//java/client/src/org/openqa/selenium:selenium',
'//java/client/src/org/openqa/selenium/support/ui:wait',
'//java/client/test/org/openqa/selenium/environment:environment',
'//java/client/test/org/openqa/selenium/testing:helpers',
'//third_party/java/guava:guava',
'//third_party/java/junit:junit',
],
Expand Down Expand Up @@ -83,6 +79,7 @@ java_library(name = 'tests',
'//java/client/src/org/openqa/selenium/remote:remote',
'//java/client/src/org/openqa/selenium/support:support',
'//java/client/src/org/openqa/selenium/support/ui:wait',
'//java/client/test/org/openqa/selenium/build:build',
'//java/client/test/org/openqa/selenium/testing:test-base',
'//java/client/test/org/openqa/selenium/testing/drivers:drivers',
'//third_party/java/guava:guava',
Expand Down
45 changes: 31 additions & 14 deletions java/client/test/org/openqa/selenium/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@ SMALL_TESTS = [
# "ProxyTest.java", # needs more dependencies
]

gen_java_tests(
size = "small",
srcs = SMALL_TESTS,
deps = [
"//java/client/src/org/openqa/selenium",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
#gen_java_tests(
# size = "small",
# srcs = SMALL_TESTS,
# deps = [
# "//java/client/src/org/openqa/selenium",
# "//third_party/java/assertj",
# "//third_party/java/guava",
# "//third_party/java/junit",
# "//third_party/java/mockito:mockito-core",
# ],
#)

java_library(
name = "selenium",
srcs = [
"BuckBuild.java",
"Build.java",
"Pages.java",
"ParallelTestRunner.java",
"StubDriver.java",
"WaitingConditions.java",
Expand All @@ -49,3 +46,23 @@ java_library(
"//third_party/java/junit",
],
)

gen_java_tests(
size = "large",
tags = [ "firefox" ],
srcs = glob([ "ClickTest.java" ], exclude = SMALL_TESTS),
jvm_flags = [
"-Dselenium.browser=ff",
],
deps = [
":selenium",
"//java/client/src/org/openqa/selenium/firefox",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/support",
"//java/client/test/org/openqa/selenium/testing",
"//java/client/test/org/openqa/selenium/testing/drivers",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.testing.NotYetImplemented;
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/ReferrerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static org.openqa.selenium.testing.Driver.IE;
import static org.openqa.selenium.testing.Driver.MARIONETTE;
import static org.openqa.selenium.testing.Driver.SAFARI;
import static org.openqa.selenium.testing.InProject.locate;
import static org.openqa.selenium.build.InProject.locate;

import com.google.common.base.Joiner;
import com.google.common.base.Objects;
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/SmallTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.openqa.selenium.net.NetworkUtilsTest;
import org.openqa.selenium.net.UrlCheckerTest;
import org.openqa.selenium.os.CommandLineTest;
import org.openqa.selenium.testing.drivers.IgnoreComparatorUnitTest;
import org.openqa.selenium.testing.IgnoreComparatorUnitTest;

@RunWith(Suite.class)
@Suite.SuiteClasses({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import com.google.common.io.Resources;

import org.openqa.selenium.Build;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.Build;
import org.openqa.selenium.build.InProject;

import java.io.IOException;
import java.net.URL;
Expand Down
14 changes: 14 additions & 0 deletions java/client/test/org/openqa/selenium/build/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
java_library(
name = "build",
srcs = glob(["*.java"]),
visibility = [
"//java/client/test/...",
"//java/server/test/...",
],
deps = [
"//java/client/src/org/openqa/selenium:selenium",
"//java/client/src/org/openqa/selenium/os:os",
"//third_party/java/guava:guava",
"//third_party/java/junit:junit",
],
)
14 changes: 14 additions & 0 deletions java/client/test/org/openqa/selenium/build/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
java_library(
name = "build",
srcs = glob(["*.java"]),
visibility = [
"//java/client/test:__subpackages__",
"//java/server/test:__subpackages__",
],
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/os",
"//third_party/java/guava",
"//third_party/java/junit",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium;
package org.openqa.selenium.build;

import static com.google.common.base.StandardSystemProperty.LINE_SEPARATOR;
import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.Platform.WINDOWS;
import static org.openqa.selenium.testing.DevMode.isInDevMode;
import static org.openqa.selenium.build.DevMode.isInDevMode;

import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.os.CommandLine;
import org.openqa.selenium.testing.InProject;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.openqa.selenium;
package org.openqa.selenium.build;

import static org.junit.Assert.fail;
import static org.openqa.selenium.Platform.WINDOWS;
import static org.openqa.selenium.testing.DevMode.isInDevMode;
import static org.openqa.selenium.build.DevMode.isInDevMode;

import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.Platform;

import java.io.BufferedReader;
import java.io.InputStreamReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.testing;
package org.openqa.selenium.build;

public class DevMode {
public static boolean isInDevMode() {
return isInDevMode("/org/openqa/selenium/remote/isDisplayed.js");
return false;//isInDevMode("/org/openqa/selenium/remote/isDisplayed.js");
}

public static boolean isInDevMode(String nameOfRequiredResource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.testing;
package org.openqa.selenium.build;

import com.google.common.base.Preconditions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.NeedsLocalEnvironment;

Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/environment/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ java_library(name = 'environment',
deps = [
'//java/client/src/org/openqa/selenium:selenium',
'//java/client/src/org/openqa/selenium/remote:remote',
'//java/client/test/org/openqa/selenium/testing:helpers',
'//java/client/test/org/openqa/selenium/build:build',
'//third_party/java/guava:guava',
'//third_party/java/jetty:jetty',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ java_library(
],
deps = [
"//java/client/src/org/openqa/selenium/remote",
"//java/client/test/org/openqa/selenium/testing",
"//java/client/test/org/openqa/selenium/build",
"//third_party/java/guava",
"//third_party/java/jetty",
"//third_party/java/servlet:javax.servlet-api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static com.google.common.net.MediaType.JSON_UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Collections.singletonMap;
import static org.openqa.selenium.testing.InProject.locate;
import static org.openqa.selenium.build.InProject.locate;

import com.google.common.collect.ImmutableList;

Expand All @@ -34,7 +34,7 @@
import org.openqa.selenium.remote.http.HttpMethod;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.seleniumhq.jetty9.http.HttpVersion;
import org.seleniumhq.jetty9.http.MimeTypes;
import org.seleniumhq.jetty9.server.Connector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static java.util.stream.Collectors.toList;
import static org.openqa.selenium.remote.http.HttpMethod.GET;
import static org.openqa.selenium.remote.http.HttpMethod.POST;
import static org.openqa.selenium.testing.InProject.locate;
import static org.openqa.selenium.build.InProject.locate;

import com.google.common.collect.ImmutableMap;

Expand Down Expand Up @@ -56,7 +56,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
Expand Down
2 changes: 2 additions & 0 deletions java/client/test/org/openqa/selenium/firefox/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ java_library(name = 'tests',
'//java/client/src/org/openqa/selenium/firefox/xpi:firefox-xpi',
'//java/client/src/org/openqa/selenium/remote:remote',
'//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/build:build',
'//java/client/test/org/openqa/selenium/testing:test-base',
'//java/client/test/org/openqa/selenium/testing/drivers:drivers',
'//third_party/java/guava:guava',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.Test;
import org.openqa.selenium.io.FileHandler;
import org.openqa.selenium.io.Zip;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.drivers.SynthesizedFirefoxDriver;

import java.io.BufferedReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.JUnit4TestBase;

import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.openqa.selenium.environment.InProcessTestEnvironment;
import org.openqa.selenium.environment.TestEnvironment;
import org.openqa.selenium.environment.webserver.AppServer;
import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.drivers.WebDriverBuilder;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;

import org.openqa.selenium.testing.InProject;
import org.openqa.selenium.build.InProject;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Pages;
import org.openqa.selenium.testing.Pages;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
Expand Down
Loading

0 comments on commit 5c9328c

Please sign in to comment.