Skip to content

Commit

Permalink
Switch tests to run on IE11/Win7 rather than IE11/Win8.1.
Browse files Browse the repository at this point in the history
That uses native mouse events and avoids problems
listed in theintern/leadfoot#17.
  • Loading branch information
wkeese committed Jan 18, 2017
1 parent a5d325d commit ce0904c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 26 deletions.
69 changes: 47 additions & 22 deletions tests/functional/HasDropDown.js
Expand Up @@ -20,7 +20,7 @@ define([
"basic menu drop down": {
mouse: function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -44,9 +44,12 @@ define([
assert.notStrictEqual(index, "1", "focus didn't move to drop down");
})
.execute(function () {
// note: "return node.getBoundingClientRect();" doesn't work on IE; webdriver bug.
var anchor = document.getElementById("dd").getBoundingClientRect();
var dropDown = document.getElementById("dd_popup").getBoundingClientRect();
return {
anchor: document.getElementById("dd").getBoundingClientRect(),
dropDown: document.getElementById("dd_popup").getBoundingClientRect()
anchor: {left: anchor.left, width: anchor.width},
dropDown: {left: dropDown.left, width: dropDown.width}
};
}).then(function (pos) {
assert(Math.abs(pos.anchor.left - pos.dropDown.left) < 1,
Expand Down Expand Up @@ -102,7 +105,7 @@ define([

// Mouse down, slide to menu choice, mouse up: should execute menu choice and close menu.
"mouse - slide": function () {
if (this.remote.environmentType.browserName === "internet explorer") {
if (this.remote.environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -129,7 +132,7 @@ define([

"dropdown dialog": function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -152,13 +155,18 @@ define([
.execute(function () {
var anchor = document.querySelector("button[is=delayed-drop-down-button]");
var dropDown = document.querySelector(".dropdown-dialog");

// note: "return node.getBoundingClientRect();" doesn't work on IE; webdriver bug.
var anchorRect = anchor.getBoundingClientRect();
var dropDownRect = dropDown.getBoundingClientRect();

return {
anchorId: anchor.id,
anchorAriaHasPopup: anchor.getAttribute("aria-haspopup"),
anchorRect: anchor.getBoundingClientRect(),
anchorRect: {left: anchorRect.left, width: anchorRect.width},
anchorAriaOwns: anchor.getAttribute("aria-owns"),
dropDownId: dropDown.id,
dropDownRect: dropDown.getBoundingClientRect(),
dropDownRect: {left: dropDownRect.left, width: dropDownRect.width},
dropDownLabelledBy: dropDown.getAttribute("aria-labelledby")
};
}).then(function (ret) {
Expand Down Expand Up @@ -204,7 +212,7 @@ define([
// Just to make sure that a non-focusable button can still open the drop down
"non focusable HasDropDown": function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand Down Expand Up @@ -262,7 +270,7 @@ define([
"autowidth: false": {
"alignment - left": function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -279,9 +287,12 @@ define([
assert(visible, "visible");
})
.execute(function () {
// note: "return node.getBoundingClientRect();" doesn't work on IE; webdriver bug.
var anchor = document.getElementById("nawl").getBoundingClientRect();
var dropDown = document.getElementById("nawl_popup").getBoundingClientRect();
return {
anchor: document.getElementById("nawl").getBoundingClientRect(),
dropDown: document.getElementById("nawl_popup").getBoundingClientRect()
anchor: {left: anchor.left, width: anchor.width},
dropDown: {left: dropDown.left, width: dropDown.width}
};
}).then(function (pos) {
assert(Math.abs(pos.anchor.left - pos.dropDown.left) < 1,
Expand All @@ -295,7 +306,7 @@ define([

"alignment - right": function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -307,9 +318,12 @@ define([
return this.remote.findById("nawr")
.click()
.execute(function () {
// note: "return node.getBoundingClientRect();" doesn't work on IE; webdriver bug.
var anchor = document.getElementById("nawr").getBoundingClientRect();
var dropDown = document.getElementById("nawr_popup").getBoundingClientRect();
return {
anchor: document.getElementById("nawr").getBoundingClientRect(),
dropDown: document.getElementById("nawr_popup").getBoundingClientRect()
anchor: {left: anchor.left, width: anchor.width},
dropDown: {left: dropDown.left, width: dropDown.width}
};
}).then(function (pos) {
assert(Math.abs((pos.anchor.left + pos.anchor.width) -
Expand All @@ -326,7 +340,7 @@ define([

"centered dialog": function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand All @@ -345,10 +359,21 @@ define([
.execute("return document.activeElement.tagName.toLowerCase();").then(function (tag) {
assert.strictEqual(tag, "input", "focus moved to dialog's <input>");
})
// Use delite/Viewport to get size because window.innerWidth not quite right on iOS7.1.
// It returns 304 instead of 320.
.execute("return { viewport: require('delite/Viewport').getEffectiveBox(), "
+ "dropDownRect: document.querySelector('.centered-dialog').getBoundingClientRect() };")
.execute(function () {
// note: "return node.getBoundingClientRect();" doesn't work on IE; webdriver bug.
var dropDownRect = document.querySelector(".centered-dialog").getBoundingClientRect();
return {
// Use delite/Viewport to get size because window.innerWidth not quite right on iOS7.1.
// It returns 304 instead of 320.
viewport: require("delite/Viewport").getEffectiveBox(),
dropDownRect: {
left: dropDownRect.left,
width: dropDownRect.width,
top: dropDownRect.top,
height: dropDownRect.height
}
};
})
.then(function (ret) {
var viewport = ret.viewport,
popupCoords = ret.dropDownRect;
Expand All @@ -368,7 +393,7 @@ define([

events: function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand Down Expand Up @@ -400,7 +425,7 @@ define([
// Test that HasDropDown can be used to apply dropdown behavior to a random node.
behavior: function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand Down Expand Up @@ -434,7 +459,7 @@ define([
// Make sure that destroying a HasDropDown closes the popup
destroy: function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown/mouseup, so popup won't open");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/KeyNav.js
Expand Up @@ -378,7 +378,7 @@ define([

mouse: function () {
var environmentType = this.remote.environmentType;
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// https://github.com/theintern/leadfoot/issues/17
return this.skip("click() doesn't generate mousedown, so navigation won't work");
}
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/activationTracker.js
Expand Up @@ -81,7 +81,7 @@ define([
// though there's no actual DOM focus event
.findByCssSelector("fake-spinner .button").click().end()
.findById("activeStack").getProperty("value").then(function (activeStack) {
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// click() doesn't generate pointerdown event on IE10+ and neither does
// moveMouseTo().pressMouseButton(1).releaseMouseButton(1).
// see https://github.com/theintern/leadfoot/issues/17.
Expand Down Expand Up @@ -144,7 +144,7 @@ define([
.click()
.end()
.findById("activeStack").getProperty("value").then(function (activeStack) {
if (environmentType.browserName === "internet explorer") {
if (environmentType.brokenMouseEvents) {
// click() doesn't generate pointerdown event on IE10+ and neither does
// moveMouseTo().pressMouseButton(1).releaseMouseButton(1).
// see https://github.com/theintern/leadfoot/issues/17.
Expand Down
2 changes: 1 addition & 1 deletion tests/intern.js
Expand Up @@ -14,7 +14,7 @@ define({
// OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
// capabilities options specified for an environment will be copied as-is
environments: [
{ browserName: "internet explorer", version: "11", platform: "Windows 8.1", name: "delite" },
{ browserName: "internet explorer", version: "11", platform: "Windows 7", name: "delite" },
{ browserName: "firefox", version: "45", platform: "Windows 7", name: "delite" },
{ browserName: "chrome", version: "36", platform: "Windows 7", name: "delite" },
{ browserName: "safari", version: "9", name: "delite" },
Expand Down

0 comments on commit ce0904c

Please sign in to comment.