Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webdriver] Test serialization of script values #13880

Conversation

jugglinmike
Copy link
Contributor

No description provided.

Copy link
Member

@andreastt andreastt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the specification in this area is not in sync with implementations. For example, in addition to NodeList, HTMLCollection, and Array, we expect WebDriver to also serialise the following collection types:

  • Arguments
  • FileList
  • HTMLAllCollection
  • HTMLFormControlsCollection
  • HTMLOptionsCollection

There are some tests for this in https://github.com/web-platform-tests/wpt/blob/master/webdriver/tests/execute_script/collections.py, which this PR partially duplicates in test_array_serialization and test_foreign_array_serialization. The other tests for primitives look absolutely fine.

We have two options: either we land this as it is, seeing it tests the actual wording in the spec, and fix up the tests later after addressing the missing collection types, or we take out the collection tests and land only the primitives tests.

Let me know what you’d prefer!

# > Otherwise
# > A new Object.
#
# https://w3c.github.io/webdriver/#dfn-clone-an-object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave out all quotes of the specification. We removed most of these some time ago because we weren’t able to keep them up with the changing spec.

{"primitive": "false", "expected": False},
{"primitive": "23", "expected": 23},
{"primitive": "'a string'", "expected": "a string"}
])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of parametrizing on a dictionary with primitive and expected keys, I feel it would read better if you just exposed both values as arguments:

@pytest.mark.parametrize("primitive,expected", [("null", None), ("undefined", None), ("true", True), …])
def test_primitive_serialization(session, primitive, expected):
    …

@gsnedders
Copy link
Member

We have two options: either we land this as it is, seeing it tests the actual wording in the spec, and fix up the tests later after addressing the missing collection types, or we take out the collection tests and land only the primitives tests.

We also have a third: make sure we have rough consensus that the spec is wrong, and test what we want everyone to do. Obviously in a case like this, there's little reason not to also land the spec changes quickly (which @andreastt already has).

@andreastt
Copy link
Member

Fair point @gsnedders. Seeing as w3c/webdriver#1340, let’s land tests that are to its intent. There are already collection tests in https://github.com/web-platform-tests/wpt/blob/master/webdriver/tests/execute_script/collections.py so I’m leaning towards dropping all the collection tests from this PR + addressing the parametrization nitpick.

@jugglinmike
Copy link
Contributor Author

I'm happy to remove the redundant tests and use the more readable patterns for Pytest, but there's still some ambiguity about what is not a collection, so I'm going to hold off on further changes for now.

@gsnedders
Copy link
Member

@jugglinmike can we have at least one test that Edge fails for now?

@jugglinmike
Copy link
Contributor Author

This patch was originally motivated by the need for tests of collection serialization. That's why I wanted to delay merging until the corresponding specification text was clear.

However, I've just today come across a conformance issue in Edge/Edgedriver that concerns serialization of primitive values. In order to get that issue documented, I've limited the scope of this patch to primitive values (including a test case for Edge's bug).

I'll use w3c/webdriver#1347 to continue the discussion about collections.

@andreastt mind taking another look?

@jugglinmike
Copy link
Contributor Author

@brendyna & @thejohnjansen The conformance issue I mentioned above is this: if a string value returned from "Execute Script" or "Execute Async Script" contains the null byte, Edgedriver truncates the string to the first occurrence of that character.

@brendyna
Copy link

Thanks for reporting that issue, @jugglinmike. @thejohnjansen and I will take a look and report back.

Is the issue blocking this PR at all or will we simply pass a test once this bug is fixed on our end?

@jugglinmike
Copy link
Contributor Author

Thanks for the quick response! The bug isn't blocking this pull request, though it may motivate a change to the testharness.js framework: gh-14245

@mjzffr mjzffr removed their request for review August 27, 2019 15:08
@whimboo
Copy link
Contributor

whimboo commented Feb 24, 2023

@jugglinmike as it looks like this PR was forgotten. Do you still have interest to update it to the current state on master?

@jugglinmike
Copy link
Contributor Author

Hey there, @whimboo! I have the interest but not the time.

@whimboo
Copy link
Contributor

whimboo commented Feb 28, 2023

@jugglinmike thanks for the reply! Let me actually add those tests while I'm working on https://bugzilla.mozilla.org/show_bug.cgi?id=1819029. As such they will be upstreamed later this week.

@whimboo whimboo closed this Feb 28, 2023
moz-wptsync-bot pushed a commit that referenced this pull request Feb 28, 2023
Tests originally written by jugglinmike:
 #13880

Differential Revision: https://phabricator.services.mozilla.com/D171234

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1819029
gecko-commit: f4cffe8e9381701473709db6054097d43396ce6e
gecko-reviewers: webdriver-reviewers, jdescottes
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 1, 2023
…rimitive values. r=webdriver-reviewers,jdescottes

Tests originally written by jugglinmike:
 web-platform-tests/wpt#13880

Differential Revision: https://phabricator.services.mozilla.com/D171234
moz-wptsync-bot pushed a commit that referenced this pull request Mar 1, 2023
Tests originally written by jugglinmike:
 #13880

Differential Revision: https://phabricator.services.mozilla.com/D171234

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1819029
gecko-commit: f4cffe8e9381701473709db6054097d43396ce6e
gecko-reviewers: webdriver-reviewers, jdescottes
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 1, 2023
…rimitive values. r=webdriver-reviewers,jdescottes

Tests originally written by jugglinmike:
 web-platform-tests/wpt#13880

Differential Revision: https://phabricator.services.mozilla.com/D171234
marcoscaceres pushed a commit that referenced this pull request Mar 28, 2023
Tests originally written by jugglinmike:
 #13880

Differential Revision: https://phabricator.services.mozilla.com/D171234

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1819029
gecko-commit: f4cffe8e9381701473709db6054097d43396ce6e
gecko-reviewers: webdriver-reviewers, jdescottes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants