theintern / intern

A next-generation code testing stack for JavaScript.
https://theintern.io/
Other
4.36k stars 311 forks source link

Update webdriver code to assume W3C mode by default #1105

Open jason0x43 opened 4 years ago

jason0x43 commented 4 years ago

Currently the WebDriver code in Intern assumes that the remote browser is using the JsonWireProtocol by default. Intern performs feature tests to determine if certain commands are broken, and to detect W3C versions of certain commands.

The goal of this issue is to reverse that assumption. Intern should instead assume that remotes are using the W3C mode spec by default, and should fall back to JWP semantics if a command fails. This will involve emulating some commands that don't have W3C endpoints, such as findByClassName (W3C does use classname as a locator strategy).

This issue will primarily involve code in webdriver/Session (where most of the commands to remotes are created), but will also affect webdriver/Server (where feature tests are performed, some of which directly communicate with drivers).

See #1046

Dependency: If #1106 is in progress, this should wait for it since the work will overlap.

wkeese commented 4 years ago

As a workaround to Edge Chromium not working (until this ticket is fixed), is there a way for me to hardcode Intern to use w3c? I know you can specify something like that for Chrome:

"environments": [
    {
        "browserName": "chrome",
        "goog:chromeOptions": {
            "w3c": true,
        }
    }
]

But it seems like that's controlling how the webdriver works, not how Intern works.

I'm also open to hacking @theintern/leadfoot/Server.js, but not sure what part to change.

I don't really care about findByClassName() working. I'm asking because clicking is also broken, which makes Chromium Edge untestable.

PS: I filed #1118 about the click() problem, in retrospect it may be unrelated.

jason0x43 commented 4 years ago

Intern doesn't yet have comprehensive W3C mode, just W3C fixups for problematic commands. This issue will take care of part of that (using W3C semantics by default). #1027 is focused on improving mouse support (not relevant to /element/<id>/click, which is in W3C, but most of the other mouse interaction endpoints are not).

I did some local testing around mouse clicks in Edge Chromium and commented in #1118. Basically, it seems to work with a simple project and Intern 4.8, so there may be some other issue at play.