Skip to content

Commit

Permalink
fix(leadfoot): IE feature test fixes
Browse files Browse the repository at this point in the history
- Always set supportsNavigationDataUris to false
- Always set supportsGetTimeouts to false
- Fix webdriver timeouts test to work in IE 11 by removing GET check
  after setting
- Fix a mouse test to use `window.events` vs just `events`
  • Loading branch information
jason0x43 committed Sep 1, 2020
1 parent 9da60f8 commit 50644fa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 44 deletions.
48 changes: 24 additions & 24 deletions packages/leadfoot/docs/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -19680,7 +19680,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2092,
"line": 2088,
"character": 15
}
]
Expand Down Expand Up @@ -19854,7 +19854,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2085,
"line": 2081,
"character": 24
}
]
Expand Down Expand Up @@ -19898,7 +19898,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2059,
"line": 2055,
"character": 13
}
]
Expand Down Expand Up @@ -20120,7 +20120,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2257,
"line": 2253,
"character": 6
}
],
Expand All @@ -20138,7 +20138,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2256,
"line": 2252,
"character": 10
}
],
Expand All @@ -20161,7 +20161,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2255,
"line": 2251,
"character": 22
}
]
Expand Down Expand Up @@ -20204,7 +20204,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 51
}
],
Expand All @@ -20226,7 +20226,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 60
}
],
Expand All @@ -20248,7 +20248,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 52
}
]
Expand All @@ -20264,7 +20264,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 35
}
],
Expand All @@ -20287,7 +20287,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 28
}
]
Expand All @@ -20304,7 +20304,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2097,
"line": 2093,
"character": 21
}
]
Expand Down Expand Up @@ -20345,7 +20345,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2125,
"line": 2121,
"character": 18
}
]
Expand Down Expand Up @@ -20386,7 +20386,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2130,
"line": 2126,
"character": 26
}
]
Expand Down Expand Up @@ -20471,7 +20471,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2135,
"line": 2131,
"character": 17
}
]
Expand Down Expand Up @@ -20564,7 +20564,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2200,
"line": 2196,
"character": 25
}
]
Expand Down Expand Up @@ -20657,7 +20657,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2174,
"line": 2170,
"character": 34
}
]
Expand Down Expand Up @@ -20698,7 +20698,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2147,
"line": 2143,
"character": 14
}
]
Expand Down Expand Up @@ -20739,7 +20739,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2152,
"line": 2148,
"character": 14
}
]
Expand Down Expand Up @@ -20832,7 +20832,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2161,
"line": 2157,
"character": 24
}
]
Expand Down Expand Up @@ -20925,7 +20925,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2187,
"line": 2183,
"character": 24
}
]
Expand Down Expand Up @@ -21013,7 +21013,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2218,
"line": 2214,
"character": 23
}
]
Expand All @@ -21040,7 +21040,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2243,
"line": 2239,
"character": 13
}
]
Expand Down Expand Up @@ -21087,7 +21087,7 @@
"sources": [
{
"fileName": "packages/leadfoot/src/Server.ts",
"line": 2251,
"line": 2247,
"character": 20
}
]
Expand Down
36 changes: 16 additions & 20 deletions packages/leadfoot/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RequestMethod,
Response
} from '@theintern/common';
import Session, { WebDriverTimeouts } from './Session';
import Session from './Session';
import Element from './Element';
import statusCodes from './lib/statusCodes';
import { format, parse, resolve, Url } from 'url';
Expand Down Expand Up @@ -780,6 +780,9 @@ export default class Server {
}

if (isInternetExplorer(capabilities)) {
// Internet Explorer does not allow data URIs to be used for navigation
updates.supportsNavigationDataUris = false;

if (isValidVersion(capabilities, 10, Infinity)) {
// At least IE10+ don't support the /frame/parent command
updates.brokenParentFrameSwitch = true;
Expand Down Expand Up @@ -807,7 +810,7 @@ export default class Server {

// At least IE11 will fail this feature test because it only supports
// the POST endpoint for timeouts
updates.usesWebDriverTimeouts = true;
updates.supportsGetTimeouts = false;

// At least IE11 will fail this feature test because it only supports
// the POST endpoint for timeouts
Expand Down Expand Up @@ -914,14 +917,13 @@ export default class Server {
);
}

// Internet Explorer 9 and earlier, and Microsoft Edge build 10240
// and earlier, hang when attempting to do navigate after a
// `document.write` is performed to reset the tab content; we can
// still do some limited testing in these browsers by using the
// initial browser URL page and injecting some content through
// innerHTML, though it is unfortunately a quirks-mode file so
// testing is limited
if (isInternetExplorer(capabilities, 0, 10) || isMsEdge(capabilities)) {
// Internet Explorer and Microsoft Edge build 10240 and earlier hang when
// attempting to do navigate after a `document.write` is performed to
// reset the tab content; we can still do some limited testing in these
// browsers by using the initial browser URL page and injecting some
// content through innerHTML, though it is unfortunately a quirks-mode
// file so testing is limited
if (isInternetExplorer(capabilities) || isMsEdge(capabilities)) {
// Edge driver doesn't provide an initialBrowserUrl
let initialUrl = 'about:blank';

Expand Down Expand Up @@ -1014,15 +1016,7 @@ export default class Server {
session
// Try to set a timeout using W3C semantics
.serverPost<void>('timeouts', { implicit: 1234 })
.then(() => {
// Verify that the timeout was set
return session
.serverGet<WebDriverTimeouts>('timeouts')
.then(timeouts => {
return timeouts.implicit === 1234;
})
.catch(unsupported);
}, unsupported)
.then(supported, unsupported)
.then(logResult('usesWebDriverTimeouts'))
);
};
Expand Down Expand Up @@ -1321,7 +1315,9 @@ export default class Server {
)
.then(() => session.moveMouseTo(100, 50))
.then(() =>
session.execute<{ x: number; y: number }[]>('return events')
session.execute<{ x: number; y: number }[]>(
'return window.events'
)
)
.then(events => {
if (!events) {
Expand Down

0 comments on commit 50644fa

Please sign in to comment.