Skip to content

Commit 975fff9

Browse files
committed
[java] Removing LEGACY_FIREFOX_XPI from tests
This is the first step before removing the XpiDriverService
1 parent 1729615 commit 975fff9

25 files changed

Lines changed: 164 additions & 246 deletions

java/test/com/thoughtworks/selenium/InternalSelenseTestBase.java

Lines changed: 84 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
import org.junit.rules.TestWatcher;
3838
import org.junit.runner.Description;
3939
import org.junit.runners.model.Statement;
40-
import org.openqa.selenium.build.BazelBuild;
4140
import org.openqa.selenium.Capabilities;
4241
import org.openqa.selenium.JavascriptExecutor;
4342
import org.openqa.selenium.MutableCapabilities;
4443
import org.openqa.selenium.WebDriver;
4544
import org.openqa.selenium.WrapsDriver;
45+
import org.openqa.selenium.build.BazelBuild;
46+
import org.openqa.selenium.build.InProject;
4647
import org.openqa.selenium.chrome.ChromeOptions;
4748
import org.openqa.selenium.edge.EdgeOptions;
4849
import org.openqa.selenium.environment.GlobalTestEnvironment;
@@ -51,7 +52,6 @@
5152
import org.openqa.selenium.ie.InternetExplorerOptions;
5253
import org.openqa.selenium.opera.OperaOptions;
5354
import org.openqa.selenium.remote.DesiredCapabilities;
54-
import org.openqa.selenium.build.InProject;
5555
import org.openqa.selenium.safari.SafariOptions;
5656
import org.openqa.selenium.testing.drivers.Browser;
5757
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
@@ -84,53 +84,6 @@ public class InternalSelenseTestBase extends SeleneseTestBase {
8484
"type");
8585

8686
private static Selenium INSTANCE;
87-
88-
@BeforeClass
89-
public static void buildJavascriptLibraries() throws IOException {
90-
if (!Files.exists(InProject.findProjectRoot().resolve("Rakefile"))) {
91-
// we're not in dev mode
92-
return;
93-
}
94-
95-
log.info("In dev mode. Copying required files in case we're using a WebDriver-backed Selenium");
96-
97-
BazelBuild bazel = new BazelBuild();
98-
99-
Path dir =
100-
InProject.locate("java/build/production/com/thoughtworks/selenium/webdriven");
101-
Files.createDirectories(dir);
102-
for (String target : ATOM_TARGETS) {
103-
bazel.build("//javascript/selenium-atoms:" + target);
104-
copy("javascript/selenium-atoms/" + target + ".js",
105-
"com/thoughtworks/selenium/webdriven/" + target + ".js");
106-
}
107-
bazel.build("//third_party/js/sizzle:sizzle");
108-
copy("third_party/js/sizzle/sizzle.js",
109-
"com/thoughtworks/selenium/webdriven/sizzle.js");
110-
}
111-
112-
private static void copy(String copyFrom, String copyTo) {
113-
try {
114-
Path source = InProject.locate("bazel-bin").resolve(copyFrom);
115-
Path dest = InProject.locate("java/build/test").resolve(copyTo);
116-
117-
if (Files.exists(dest)) {
118-
// Assume we're good.
119-
return;
120-
}
121-
122-
Files.createDirectories(dest.getParent());
123-
Files.copy(source, dest);
124-
} catch (IOException e) {
125-
throw new UncheckedIOException(e);
126-
}
127-
}
128-
129-
@BeforeClass
130-
public static void initializeServer() {
131-
GlobalTestEnvironment.getOrCreate(InProcessTestEnvironment::new);
132-
}
133-
13487
public TestWatcher traceMethodName = new TestWatcher() {
13588
@Override
13689
protected void starting(Description description) {
@@ -144,7 +97,6 @@ protected void finished(Description description) {
14497
log.info("<<< Finished " + description);
14598
}
14699
};
147-
148100
public ExternalResource initializeSelenium = new ExternalResource() {
149101
@Override
150102
protected void before() {
@@ -165,39 +117,6 @@ protected void before() {
165117
INSTANCE = selenium;
166118
}
167119
};
168-
169-
private Capabilities createCapabilities() {
170-
String property = System.getProperty("selenium.browser", "ff");
171-
172-
Browser browser = Browser.detect();
173-
switch (browser) {
174-
case CHROME:
175-
return new ChromeOptions();
176-
177-
case EDGE:
178-
return new EdgeOptions();
179-
180-
case IE:
181-
return new InternetExplorerOptions();
182-
183-
case LEGACY_FIREFOX_XPI:
184-
case FIREFOX:
185-
return new FirefoxOptions();
186-
187-
case LEGACY_OPERA:
188-
case OPERA:
189-
return new OperaOptions();
190-
191-
case SAFARI:
192-
return new SafariOptions();
193-
194-
default:
195-
fail("Attempt to use an unsupported browser: " + property);
196-
// we never get here, but keep null checks happy anyway
197-
return new DesiredCapabilities();
198-
}
199-
}
200-
201120
public ExternalResource addNecessaryJavascriptCommands = new ExternalResource() {
202121
@Override
203122
protected void before() {
@@ -220,7 +139,6 @@ protected void before() {
220139
}
221140
}
222141
};
223-
224142
public ExternalResource returnFocusToMainWindow = new ExternalResource() {
225143
@Override
226144
protected void before() {
@@ -232,7 +150,6 @@ protected void before() {
232150
selenium.windowFocus();
233151
}
234152
};
235-
236153
public TestWatcher filter = new TestWatcher() {
237154
@Override
238155
public Statement apply(Statement base, Description description) {
@@ -245,7 +162,6 @@ public Statement apply(Statement base, Description description) {
245162
return super.apply(base, description);
246163
}
247164
};
248-
249165
@Rule
250166
public TestRule chain =
251167
RuleChain.outerRule(filter)
@@ -254,13 +170,50 @@ public Statement apply(Statement base, Description description) {
254170
.around(addNecessaryJavascriptCommands)
255171
.around(traceMethodName);
256172

257-
@After
258-
public void checkVerifications() {
259-
checkForVerificationErrors();
173+
@BeforeClass
174+
public static void buildJavascriptLibraries() throws IOException {
175+
if (!Files.exists(InProject.findProjectRoot().resolve("Rakefile"))) {
176+
// we're not in dev mode
177+
return;
178+
}
179+
180+
log.info("In dev mode. Copying required files in case we're using a WebDriver-backed Selenium");
181+
182+
BazelBuild bazel = new BazelBuild();
183+
184+
Path dir =
185+
InProject.locate("java/build/production/com/thoughtworks/selenium/webdriven");
186+
Files.createDirectories(dir);
187+
for (String target : ATOM_TARGETS) {
188+
bazel.build("//javascript/selenium-atoms:" + target);
189+
copy("javascript/selenium-atoms/" + target + ".js",
190+
"com/thoughtworks/selenium/webdriven/" + target + ".js");
191+
}
192+
bazel.build("//third_party/js/sizzle:sizzle");
193+
copy("third_party/js/sizzle/sizzle.js",
194+
"com/thoughtworks/selenium/webdriven/sizzle.js");
260195
}
261196

262-
private String whereIs(String location) {
263-
return GlobalTestEnvironment.get().getAppServer().whereIs(location);
197+
private static void copy(String copyFrom, String copyTo) {
198+
try {
199+
Path source = InProject.locate("bazel-bin").resolve(copyFrom);
200+
Path dest = InProject.locate("java/build/test").resolve(copyTo);
201+
202+
if (Files.exists(dest)) {
203+
// Assume we're good.
204+
return;
205+
}
206+
207+
Files.createDirectories(dest.getParent());
208+
Files.copy(source, dest);
209+
} catch (IOException e) {
210+
throw new UncheckedIOException(e);
211+
}
212+
}
213+
214+
@BeforeClass
215+
public static void initializeServer() {
216+
GlobalTestEnvironment.getOrCreate(InProcessTestEnvironment::new);
264217
}
265218

266219
@AfterClass
@@ -275,4 +228,44 @@ public static void destroyDriver() {
275228
INSTANCE = null;
276229
}
277230
}
231+
232+
private Capabilities createCapabilities() {
233+
String property = System.getProperty("selenium.browser", "ff");
234+
235+
Browser browser = Browser.detect();
236+
switch (browser) {
237+
case CHROME:
238+
return new ChromeOptions();
239+
240+
case EDGE:
241+
return new EdgeOptions();
242+
243+
case IE:
244+
return new InternetExplorerOptions();
245+
246+
case FIREFOX:
247+
return new FirefoxOptions();
248+
249+
case LEGACY_OPERA:
250+
case OPERA:
251+
return new OperaOptions();
252+
253+
case SAFARI:
254+
return new SafariOptions();
255+
256+
default:
257+
fail("Attempt to use an unsupported browser: " + property);
258+
// we never get here, but keep null checks happy anyway
259+
return new DesiredCapabilities();
260+
}
261+
}
262+
263+
@After
264+
public void checkVerifications() {
265+
checkForVerificationErrors();
266+
}
267+
268+
private String whereIs(String location) {
269+
return GlobalTestEnvironment.get().getAppServer().whereIs(location);
270+
}
278271
}

java/test/org/openqa/selenium/AlertsTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
2929
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
3030
import static org.openqa.selenium.testing.drivers.Browser.IE;
31-
import static org.openqa.selenium.testing.drivers.Browser.LEGACY_FIREFOX_XPI;
3231
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
3332

3433
import org.junit.After;
@@ -397,7 +396,6 @@ public void testShouldHandleAlertOnPageLoadUsingGet() {
397396
@Test
398397
@Ignore(value = CHROME, reason = "Hangs")
399398
@Ignore(value = EDGE, reason = "Hangs")
400-
@Ignore(LEGACY_FIREFOX_XPI)
401399
@Ignore(value = IE, reason = "Fails in versions 6 and 7")
402400
@Ignore(SAFARI)
403401
@NoDriverAfterTest
@@ -418,7 +416,6 @@ public void testShouldNotHandleAlertInAnotherWindow() {
418416
}
419417

420418
@Test
421-
@Ignore(value = LEGACY_FIREFOX_XPI, reason = "Non W3C conformant")
422419
@Ignore(value = HTMLUNIT, reason = "Non W3C conformant")
423420
@Ignore(value = CHROME, reason = "Non W3C conformant")
424421
@Ignore(value = EDGE, reason = "Non W3C conformant")

java/test/org/openqa/selenium/ClearTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2222
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
2323
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
24-
import static org.openqa.selenium.testing.drivers.Browser.LEGACY_FIREFOX_XPI;
24+
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
2525
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
2626
import static org.openqa.selenium.testing.drivers.Browser.IE;
27-
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
2827
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
2928

3029
import org.junit.Test;
@@ -139,7 +138,6 @@ public void shouldBeAbleToClearRangeInput() {
139138
@Test
140139
@NotYetImplemented(CHROME)
141140
@NotYetImplemented(EDGE)
142-
@NotYetImplemented(LEGACY_FIREFOX_XPI)
143141
@NotYetImplemented(FIREFOX)
144142
@NotYetImplemented(IE)
145143
@NotYetImplemented(SAFARI)

java/test/org/openqa/selenium/ClickScrollingTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
2424
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
2525
import static org.openqa.selenium.testing.drivers.Browser.ALL;
26-
import static org.openqa.selenium.testing.drivers.Browser.LEGACY_FIREFOX_XPI;
26+
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
2727
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
2828
import static org.openqa.selenium.testing.drivers.Browser.IE;
29-
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
3029
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
3130

3231
import org.junit.Test;
@@ -111,7 +110,6 @@ public void testShouldBeAbleToClickOnAnElementHiddenByYOverflow() {
111110

112111
@Test
113112
@Ignore(value = IE, issue = "716")
114-
@Ignore(value = LEGACY_FIREFOX_XPI, issue = "716")
115113
public void testShouldBeAbleToClickOnAnElementPartiallyHiddenByOverflow() {
116114
driver.get(appServer.whereIs("scrolling_tests/page_with_partially_hidden_element.html"));
117115

@@ -132,7 +130,6 @@ public void testShouldNotScrollOverflowElementsWhichAreVisible() {
132130

133131
@Test
134132
@NotYetImplemented(IE)
135-
@NotYetImplemented(LEGACY_FIREFOX_XPI)
136133
public void testShouldNotScrollIfAlreadyScrolledAndElementIsInView() {
137134
driver.get(appServer.whereIs("scroll3.html"));
138135
driver.findElement(By.id("button2")).click();

java/test/org/openqa/selenium/ClickTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
import static org.openqa.selenium.testing.drivers.Browser.ALL;
2626
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
2727
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
28-
import static org.openqa.selenium.testing.drivers.Browser.LEGACY_FIREFOX_XPI;
29-
import static org.openqa.selenium.testing.drivers.Browser.IE;
3028
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
29+
import static org.openqa.selenium.testing.drivers.Browser.IE;
3130
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
3231

3332
import org.junit.Before;
@@ -255,7 +254,6 @@ public void testCanClickAnImageMapArea() {
255254
}
256255

257256
@Test
258-
@Ignore(LEGACY_FIREFOX_XPI)
259257
@NotYetImplemented(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1422272")
260258
@NotYetImplemented(SAFARI)
261259
public void testShouldBeAbleToClickOnAnElementGreaterThanTwoViewports() {

0 commit comments

Comments
 (0)