Skip to content

Commit 517c588

Browse files
committed
Moving IE specific test to IE test suite
1 parent 2033029 commit 517c588

File tree

2 files changed

+60
-57
lines changed

2 files changed

+60
-57
lines changed

java/client/test/org/openqa/selenium/ie/InternetExplorerDriverTest.java

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,26 @@
1717

1818
package org.openqa.selenium.ie;
1919

20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assume.assumeTrue;
22+
import static org.openqa.selenium.WaitingConditions.elementTextToEqual;
23+
import static org.openqa.selenium.ie.InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING;
24+
2025
import org.junit.Test;
26+
import org.openqa.selenium.By;
27+
import org.openqa.selenium.JavascriptExecutor;
28+
import org.openqa.selenium.NoDriverAfterTest;
29+
import org.openqa.selenium.WebDriver;
30+
import org.openqa.selenium.WebElement;
31+
import org.openqa.selenium.interactions.Actions;
32+
import org.openqa.selenium.remote.DesiredCapabilities;
2133
import org.openqa.selenium.testing.JUnit4TestBase;
34+
import org.openqa.selenium.testing.JavascriptEnabled;
2235
import org.openqa.selenium.testing.NeedsLocalEnvironment;
23-
import org.openqa.selenium.WebDriver;
36+
import org.openqa.selenium.testing.TestUtilities;
2437
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
2538

26-
import static org.junit.Assert.assertEquals;
39+
import java.awt.*;
2740

2841
@NeedsLocalEnvironment(reason = "Requires local browser launching environment")
2942
public class InternetExplorerDriverTest extends JUnit4TestBase {
@@ -51,6 +64,51 @@ public void canStartMultipleIeDriverInstances() {
5164
}
5265
}
5366

67+
@JavascriptEnabled
68+
@NoDriverAfterTest
69+
@NeedsLocalEnvironment
70+
@Test
71+
public void testPersistentHoverCanBeTurnedOff() throws Exception {
72+
assumeTrue(TestUtilities.isInternetExplorer(driver));
73+
// Destroy the previous driver to make sure the hovering thread is
74+
// stopped.
75+
driver.quit();
76+
77+
DesiredCapabilities caps = new DesiredCapabilities();
78+
caps.setCapability(ENABLE_PERSISTENT_HOVERING, false);
79+
WebDriverBuilder builder = new WebDriverBuilder().setDesiredCapabilities(caps);
80+
driver = builder.get();
81+
82+
try {
83+
driver.get(pages.javascriptPage);
84+
// Move to a different element to make sure the mouse is not over the
85+
// element with id 'item1' (from a previous test).
86+
new Actions(driver).moveToElement(driver.findElement(By.id("keyUp"))).build().perform();
87+
WebElement element = driver.findElement(By.id("menu1"));
88+
89+
final WebElement item = driver.findElement(By.id("item1"));
90+
assertEquals("", item.getText());
91+
92+
((JavascriptExecutor) driver).executeScript("arguments[0].style.background = 'green'", element);
93+
new Actions(driver).moveToElement(element).build().perform();
94+
95+
// Move the mouse somewhere - to make sure that the thread firing the events making
96+
// hover persistent is not active.
97+
Robot robot = new Robot();
98+
robot.mouseMove(50, 50);
99+
100+
// Intentionally wait to make sure hover DOES NOT persist.
101+
Thread.sleep(1000);
102+
103+
wait.until(elementTextToEqual(item, ""));
104+
105+
assertEquals("", item.getText());
106+
107+
} finally {
108+
driver.quit();
109+
}
110+
}
111+
54112
private WebDriver newIeDriver() {
55113
return new WebDriverBuilder().get();
56114
}

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

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@
2525
import static org.openqa.selenium.WaitingConditions.elementTextToContain;
2626
import static org.openqa.selenium.WaitingConditions.elementTextToEqual;
2727
import static org.openqa.selenium.WaitingConditions.elementValueToEqual;
28-
import static org.openqa.selenium.ie.InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING;
2928
import static org.openqa.selenium.support.ui.ExpectedConditions.not;
3029
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
3130
import static org.openqa.selenium.testing.Ignore.Driver.CHROME;
3231
import static org.openqa.selenium.testing.Ignore.Driver.FIREFOX;
3332
import static org.openqa.selenium.testing.Ignore.Driver.HTMLUNIT;
3433
import static org.openqa.selenium.testing.Ignore.Driver.IE;
3534
import static org.openqa.selenium.testing.Ignore.Driver.MARIONETTE;
36-
import static org.openqa.selenium.testing.Ignore.Driver.PHANTOMJS;
3735
import static org.openqa.selenium.testing.Ignore.Driver.REMOTE;
3836
import static org.openqa.selenium.testing.Ignore.Driver.SAFARI;
3937
import static org.openqa.selenium.testing.TestUtilities.isFirefox;
@@ -51,19 +49,15 @@
5149
import org.openqa.selenium.Platform;
5250
import org.openqa.selenium.WebDriver;
5351
import org.openqa.selenium.WebElement;
54-
import org.openqa.selenium.remote.DesiredCapabilities;
5552
import org.openqa.selenium.support.Color;
5653
import org.openqa.selenium.support.Colors;
5754
import org.openqa.selenium.support.ui.ExpectedCondition;
5855
import org.openqa.selenium.testing.Ignore;
5956
import org.openqa.selenium.testing.JUnit4TestBase;
6057
import org.openqa.selenium.testing.JavascriptEnabled;
61-
import org.openqa.selenium.testing.NeedsLocalEnvironment;
6258
import org.openqa.selenium.testing.NotYetImplemented;
6359
import org.openqa.selenium.testing.TestUtilities;
64-
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
6560

66-
import java.awt.*;
6761
import java.util.Map;
6862

6963
/**
@@ -451,55 +445,6 @@ public void testHoverPersists() throws Exception {
451445
assertEquals("Item 1", item.getText());
452446
}
453447

454-
@JavascriptEnabled
455-
@Ignore(
456-
value = {FIREFOX, CHROME, SAFARI, PHANTOMJS, MARIONETTE},
457-
reason = "This is an IE only tests")
458-
@NotYetImplemented(HTMLUNIT)
459-
@NoDriverAfterTest
460-
@NeedsLocalEnvironment
461-
@Test
462-
public void testPersistentHoverCanBeTurnedOff() throws Exception {
463-
assumeTrue(TestUtilities.isInternetExplorer(driver));
464-
// Destroy the previous driver to make sure the hovering thread is
465-
// stopped.
466-
driver.quit();
467-
468-
DesiredCapabilities caps = new DesiredCapabilities();
469-
caps.setCapability(ENABLE_PERSISTENT_HOVERING, false);
470-
WebDriverBuilder builder = new WebDriverBuilder().setDesiredCapabilities(caps);
471-
driver = builder.get();
472-
473-
try {
474-
driver.get(pages.javascriptPage);
475-
// Move to a different element to make sure the mouse is not over the
476-
// element with id 'item1' (from a previous test).
477-
new Actions(driver).moveToElement(driver.findElement(By.id("keyUp"))).build().perform();
478-
WebElement element = driver.findElement(By.id("menu1"));
479-
480-
final WebElement item = driver.findElement(By.id("item1"));
481-
assertEquals("", item.getText());
482-
483-
((JavascriptExecutor) driver).executeScript("arguments[0].style.background = 'green'", element);
484-
new Actions(driver).moveToElement(element).build().perform();
485-
486-
// Move the mouse somewhere - to make sure that the thread firing the events making
487-
// hover persistent is not active.
488-
Robot robot = new Robot();
489-
robot.mouseMove(50, 50);
490-
491-
// Intentionally wait to make sure hover DOES NOT persist.
492-
Thread.sleep(1000);
493-
494-
wait.until(elementTextToEqual(item, ""));
495-
496-
assertEquals("", item.getText());
497-
498-
} finally {
499-
driver.quit();
500-
}
501-
}
502-
503448
@JavascriptEnabled
504449
@Ignore(value = {SAFARI, MARIONETTE},
505450
reason = "Advanced mouse actions only implemented in rendered browsers",

0 commit comments

Comments
 (0)