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

Add test automation support via Web Driver #170

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

marcoscaceres
Copy link
Member

@marcoscaceres marcoscaceres commented Jul 2, 2024

Closes #146

The following tasks have been completed:

  • Modified Web platform tests (link to pull request)

Implementation commitment (and no objections):

Documentation (new feature):

  • Updated implementation report
  • Pinged MDN
  • Added example to README or spec

For documentation, either create an issue or pull request in MDN's Content repo - providing as much information as you can. PR is prefered.


Preview | Diff

@marcoscaceres marcoscaceres changed the title Add test automation support viar Web Driver Add test automation support via Web Driver Jul 2, 2024
@marcoscaceres marcoscaceres marked this pull request as draft July 2, 2024 07:12
@marcoscaceres
Copy link
Member Author

@reillyeon, this is pretty rough and probably pretty buggy... but it's at start. 😅

@rakuco, as you've got some experience in the area, would you mind also having a look? 👀🙏

index.html Outdated Show resolved Hide resolved
|target|'s [=relevant settings object=]'s [=global object=]'s
[=Window/browsing context=] to:
<ol>
<li>If |coordinates| is not given, clear the system location
Copy link
Member

Choose a reason for hiding this comment

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

We should define "system location" in a way that ties into the "acquire a position" algorithm.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about this as I was specifying this, but I think we might want keep them separate.

I initially tried to hook into "acquire a position"... but I think it might be best to keep them separate: this algorithm just sets the coordinates for the entire user agent*, then the actual API methods "acquire a position".

*at least initially... let's start simple and then see if we need to set it per origin. That adds a lot of complexity thought, so we probably don't want to do that.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's as easy as saying, "a top-level traversable has a mock position which is initially unset". This algorithm sets the mock position and the "acquire a position" algorithm checks if the mock position is set in step 5.3.3.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, yeah, I like that the mock position to take precedence over the system one... and it doesn't imply that it's touching the system one at all (it's just something that works with automation and that's it).

To <dfn>set the system coordinates</dfn> given an optional
{{GeolocationMockCoordinates}}
|coordinates:GeolocationMockCoordinates|, and an optional [=user
agent=] |agent|:
Copy link
Member

Choose a reason for hiding this comment

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

I'm still working on understanding the WebDriver BiDi architecture but in the old WebDriver specification requests have a session from which you can derive the browsing contexts to which a command will apply. Rather than applying to the entire user agent this allows automation to control only the specific context the developer is targeting.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, something like that could work... I'll see how this looks in the implementation and hopefully can base it off that.

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in #146, Chromium already implements this in the Chrome DevTools Protocol and it is scoped to a particular browsing context. This interface is used by Chrome DevTools to provide a UI for setting a mock position. It would be weird if a change made while inspecting one page affected other pages as well. Supporting both page-level and browser-level location overrides would introduce a lot of complexity to the implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree... that would be weird.

Co-authored-by: Reilly Grant <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A means to test the API via Web Driver
2 participants