w3c / w3c/webdriver

Merging capabilities seems broken?

Open
#1,891 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

New Session
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

Imagine trying to process the following:

{
    "alwaysMatch": {"browserName": "fake"},
    "firstMatch": [
        {"browserName": "real"},
        {}
    ]
}

Per step 7.1 of process capabilities:

Let merged be the result of trying to merge capabilities with required capabilities and first match capabilities as arguments.

"Trying" returns the error if it fails, so I think the merged capabilities ends up with:

[
    [abstract error],
    {
        "browserName": "real"
    },
]

This seems wrong, given we then assume the argument passed to "match capabilities" is a JSON object.

If we instead use the same JSON serialization of an error as send an error — though we don't define this outside of sending an error so this is definitely not what the spec currently says — then the merged capabilities would be:

[
    {
        "error": "invalid argument",
        "message": "[implementation defined]",
        "stacktrace": "[implementation defined]"
    },
    {
        "browserName": "real"
    },
]

This also doesn't seem particularly helpful.

From the look of our current tests in /webdriver/tests/classic/new_session/merge.py, we seem to expect the following to return to the client "invalid argument":

{
    "alwaysMatch": {
        "acceptInsecureCerts": True
    },
    "firstMatch": [
        {},
        {"acceptInsecureCerts": True}
    ]
}

Thus it's not that we're "trying to merge capabilities", it's that we need to process that error by then returning error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with step 7.1, “process capabilities,” and compare its “trying to merge capabilities” wording with the “match capabilities” input assumptions. Review webdriver/tests/classic/new_session/merge.py, especially the invalid-argument cases. Done means the specification defines how a merge error is handled and the related tests reflect that behavior.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.