Skip to content

Commit cbfc880

Browse files
committed
Fixing assumes in tests to work properly while running tests in remote mode
1 parent 9e9edee commit cbfc880

File tree

8 files changed

+29
-22
lines changed

8 files changed

+29
-22
lines changed

java/client/test/org/openqa/selenium/ContentEditableTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public void testTypingIntoAnIFrameWithContentEditableOrDesignModeSet() {
6161
public void testNonPrintableCharactersShouldWorkWithContentEditableOrDesignModeSet() {
6262
assumeFalse("FIXME: Fails in Firefox on Linux with synthesized events",
6363
isFirefox(driver) &&
64-
(getEffectivePlatform().is(Platform.LINUX) || getEffectivePlatform().is(Platform.MAC)));
64+
(getEffectivePlatform(driver).is(Platform.LINUX) ||
65+
getEffectivePlatform(driver).is(Platform.MAC)));
6566

6667
driver.get(pages.richTextPage);
6768

java/client/test/org/openqa/selenium/CorrectEventFiringTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ private static void assertEventNotFired(String eventName, WebDriver driver) {
563563

564564
private static boolean browserNeedsFocusOnThisOs(WebDriver driver) {
565565
// No browser yet demands focus on windows
566-
if (TestUtilities.getEffectivePlatform().is(Platform.WINDOWS))
566+
if (TestUtilities.getEffectivePlatform(driver).is(Platform.WINDOWS))
567567
return false;
568568

569569
if (Boolean.getBoolean("webdriver.focus.override")) {

java/client/test/org/openqa/selenium/I18nTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void testShouldBeAbleToReturnTheTextInAPage() {
129129
@NotYetImplemented(HTMLUNIT)
130130
public void testShouldBeAbleToActivateIMEEngine() throws InterruptedException {
131131
assumeTrue("IME is supported on Linux only.",
132-
TestUtilities.getEffectivePlatform().is(Platform.LINUX));
132+
TestUtilities.getEffectivePlatform(driver).is(Platform.LINUX));
133133

134134
driver.get(pages.formPage);
135135

@@ -179,7 +179,7 @@ public void testShouldBeAbleToActivateIMEEngine() throws InterruptedException {
179179
@Ignore(FIREFOX)
180180
public void testShouldBeAbleToInputJapanese() {
181181
assumeTrue("IME is supported on Linux only.",
182-
TestUtilities.getEffectivePlatform().is(Platform.LINUX));
182+
TestUtilities.getEffectivePlatform(driver).is(Platform.LINUX));
183183

184184
driver.get(pages.formPage);
185185

java/client/test/org/openqa/selenium/TypingTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private static void checkRecordedKeySequence(WebElement element, int expectedKey
247247
@Test
248248
public void testShouldReportKeyCodeOfArrowKeys() {
249249
assumeFalse(Browser.detect() == Browser.OPERA &&
250-
getEffectivePlatform().is(Platform.WINDOWS));
250+
getEffectivePlatform(driver).is(Platform.WINDOWS));
251251

252252
driver.get(pages.javascriptPage);
253253

@@ -273,7 +273,7 @@ public void testShouldReportKeyCodeOfArrowKeys() {
273273
@Test
274274
public void testShouldReportKeyCodeOfArrowKeysUpDownEvents() {
275275
assumeFalse(Browser.detect() == Browser.OPERA &&
276-
getEffectivePlatform().is(Platform.WINDOWS));
276+
getEffectivePlatform(driver).is(Platform.WINDOWS));
277277

278278
driver.get(pages.javascriptPage);
279279

@@ -381,7 +381,7 @@ public void testArrowKeysAndPageUpAndDown() {
381381
@Test
382382
public void testHomeAndEndAndPageUpAndPageDownKeys() {
383383
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
384-
getEffectivePlatform().is(Platform.MAC));
384+
getEffectivePlatform(driver).is(Platform.MAC));
385385

386386
driver.get(pages.javascriptPage);
387387

@@ -466,7 +466,7 @@ public void testShiftSelectionDeletes() {
466466
@NotYetImplemented(value = MARIONETTE, reason = "https://github.com/mozilla/geckodriver/issues/646")
467467
public void testChordControlHomeShiftEndDelete() {
468468
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
469-
getEffectivePlatform().is(Platform.MAC));
469+
getEffectivePlatform(driver).is(Platform.MAC));
470470

471471
driver.get(pages.javascriptPage);
472472

@@ -487,7 +487,7 @@ public void testChordControlHomeShiftEndDelete() {
487487
@NotYetImplemented(value = MARIONETTE, reason = "https://github.com/mozilla/geckodriver/issues/646")
488488
public void testChordReveseShiftHomeSelectionDeletes() {
489489
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
490-
getEffectivePlatform().is(Platform.MAC));
490+
getEffectivePlatform(driver).is(Platform.MAC));
491491

492492
driver.get(pages.javascriptPage);
493493

@@ -518,7 +518,7 @@ public void testChordReveseShiftHomeSelectionDeletes() {
518518
@NotYetImplemented(value = MARIONETTE, reason = "https://github.com/mozilla/geckodriver/issues/646")
519519
public void testChordControlCutAndPaste() {
520520
assumeFalse("FIXME: macs don't have HOME keys, would PGUP work?",
521-
getEffectivePlatform().is(Platform.MAC));
521+
getEffectivePlatform(driver).is(Platform.MAC));
522522

523523
driver.get(pages.javascriptPage);
524524

java/client/test/org/openqa/selenium/WindowSwitchingTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static org.openqa.selenium.WaitingConditions.windowHandleCountToBe;
2626
import static org.openqa.selenium.WaitingConditions.windowHandleCountToBeGreaterThan;
2727
import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;
28+
import static org.openqa.selenium.testing.TestUtilities.getEffectivePlatform;
2829
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
2930
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
3031
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
@@ -85,7 +86,7 @@ protected void finished(Description description) {
8586
@Test
8687
public void testShouldSwitchFocusToANewWindowWhenItIsOpenedAndNotStopFutureOperations() {
8788
assumeFalse(Browser.detect() == Browser.OPERA &&
88-
TestUtilities.getEffectivePlatform().is(Platform.WINDOWS));
89+
getEffectivePlatform(driver).is(Platform.WINDOWS));
8990

9091
driver.get(pages.xhtmlTestPage);
9192
Set<String> currentWindowHandles = driver.getWindowHandles();
@@ -195,7 +196,7 @@ public void testShouldBeAbleToIterateOverAllOpenWindows() {
195196
public void testClickingOnAButtonThatClosesAnOpenWindowDoesNotCauseTheBrowserToHang()
196197
throws Exception {
197198
assumeFalse(Browser.detect() == Browser.OPERA &&
198-
TestUtilities.getEffectivePlatform().is(Platform.WINDOWS));
199+
getEffectivePlatform(driver).is(Platform.WINDOWS));
199200

200201
driver.get(pages.xhtmlTestPage);
201202
Set<String> currentWindowHandles = driver.getWindowHandles();
@@ -207,7 +208,7 @@ public void testClickingOnAButtonThatClosesAnOpenWindowDoesNotCauseTheBrowserToH
207208
driver.switchTo().window("result");
208209

209210
// TODO Remove sleep when https://bugs.chromium.org/p/chromedriver/issues/detail?id=1044 is fixed.
210-
if (TestUtilities.isChrome(driver) && TestUtilities.getEffectivePlatform(driver).is(ANDROID)) {
211+
if (TestUtilities.isChrome(driver) && getEffectivePlatform(driver).is(ANDROID)) {
211212
Thread.sleep(1000);
212213
}
213214

@@ -226,7 +227,7 @@ public void testClickingOnAButtonThatClosesAnOpenWindowDoesNotCauseTheBrowserToH
226227
@Ignore(EDGE)
227228
public void testCanCallGetWindowHandlesAfterClosingAWindow() throws Exception {
228229
assumeFalse(Browser.detect() == Browser.OPERA &&
229-
TestUtilities.getEffectivePlatform().is(Platform.WINDOWS));
230+
getEffectivePlatform(driver).is(Platform.WINDOWS));
230231
boolean isNewIE = isInternetExplorer(driver) && !isIe6(driver);
231232

232233
driver.get(pages.xhtmlTestPage);
@@ -242,7 +243,7 @@ public void testCanCallGetWindowHandlesAfterClosingAWindow() throws Exception {
242243
assertThat(allWindowHandles).isEqualTo(currentWindowHandles.size() + 1);
243244

244245
// TODO Remove sleep when https://bugs.chromium.org/p/chromedriver/issues/detail?id=1044 is fixed.
245-
if (TestUtilities.isChrome(driver) && TestUtilities.getEffectivePlatform(driver).is(ANDROID)) {
246+
if (TestUtilities.isChrome(driver) && getEffectivePlatform(driver).is(ANDROID)) {
246247
Thread.sleep(1000);
247248
}
248249

java/client/test/org/openqa/selenium/interactions/BasicKeyboardInterfaceTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.assertj.core.api.Assertions.assertThat;
2121
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2222
import static org.junit.Assume.assumeFalse;
23+
import static org.openqa.selenium.testing.TestUtilities.getEffectivePlatform;
2324
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
2425
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
2526
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
@@ -251,7 +252,7 @@ public void testSelectionSelectBySymbol() {
251252
public void testSelectionSelectByWord() {
252253
assumeFalse(
253254
"MacOS has alternative keyboard",
254-
TestUtilities.getEffectivePlatform().is(Platform.MAC));
255+
getEffectivePlatform(driver).is(Platform.MAC));
255256

256257
driver.get(appServer.whereIs("single_text_input.html"));
257258

@@ -276,7 +277,7 @@ public void testSelectionSelectByWord() {
276277
public void testSelectionSelectAll() {
277278
assumeFalse(
278279
"MacOS has alternative keyboard",
279-
TestUtilities.getEffectivePlatform().is(Platform.MAC));
280+
getEffectivePlatform(driver).is(Platform.MAC));
280281

281282
driver.get(appServer.whereIs("single_text_input.html"));
282283

java/client/test/org/openqa/selenium/interactions/CombinedInputActionsTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public void testShiftClickingOnMultiSelectionList() {
113113
@Ignore(FIREFOX)
114114
@Ignore(value = MARIONETTE, travis = true)
115115
public void testControlClickingOnMultiSelectionList() {
116-
assumeFalse("FIXME: macs don't have CONTROL key", getEffectivePlatform().is(Platform.MAC));
116+
assumeFalse("FIXME: macs don't have CONTROL key",
117+
getEffectivePlatform(driver).is(Platform.MAC));
117118
driver.get(pages.formSelectionPage);
118119

119120
List<WebElement> options = driver.findElements(By.tagName("option"));
@@ -140,7 +141,8 @@ public void testControlClickingOnMultiSelectionList() {
140141
@Ignore(IE)
141142
@Ignore(value = MARIONETTE, travis = true)
142143
public void testControlClickingOnCustomMultiSelectionList() {
143-
assumeFalse("FIXME: macs don't have CONTROL key", getEffectivePlatform().is(Platform.MAC));
144+
assumeFalse("FIXME: macs don't have CONTROL key",
145+
getEffectivePlatform(driver).is(Platform.MAC));
144146
driver.get(pages.selectableItemsPage);
145147

146148
WebElement reportingElement = driver.findElement(By.id("infodiv"));
@@ -280,9 +282,11 @@ public void testMouseMovementWorksWhenNavigatingToAnotherPage() {
280282
@NotYetImplemented(EDGE)
281283
@NotYetImplemented(CHROME)
282284
public void testChordControlCutAndPaste() {
283-
assumeFalse("FIXME: macs don't have CONTROL key", getEffectivePlatform().is(Platform.MAC));
285+
assumeFalse("FIXME: macs don't have CONTROL key",
286+
getEffectivePlatform(driver).is(Platform.MAC));
284287
assumeFalse("Windows: native events library does not support storing modifiers state yet",
285-
isNativeEventsEnabled(driver) && getEffectivePlatform().is(Platform.WINDOWS) &&
288+
isNativeEventsEnabled(driver) &&
289+
getEffectivePlatform(driver).is(Platform.WINDOWS) &&
286290
isInternetExplorer(driver));
287291

288292
driver.get(pages.javascriptPage);

java/client/test/org/openqa/selenium/interactions/DragAndDropTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class DragAndDropTest extends JUnit4TestBase {
5050
@Test
5151
public void testDragAndDropRelative() {
5252
assumeFalse(Browser.detect() == Browser.OPERA &&
53-
TestUtilities.getEffectivePlatform().is(Platform.WINDOWS));
53+
TestUtilities.getEffectivePlatform(driver).is(Platform.WINDOWS));
5454

5555
driver.get(pages.dragAndDropPage);
5656
WebElement img = driver.findElement(By.id("test1"));

0 commit comments

Comments
 (0)