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

Figure out a means to "consume user activation" #36727

Open
marcoscaceres opened this issue Oct 29, 2022 · 16 comments
Open

Figure out a means to "consume user activation" #36727

marcoscaceres opened this issue Oct 29, 2022 · 16 comments

Comments

@marcoscaceres
Copy link
Contributor

Tests in WPT are currently relying on various indirect means to "consume user activation". Some of these means are non-standard, meaning that the tests are inshrining non-standard behavior for conformance purposes.

These workarounds are:

  • using fullscreen API
  • using window.open and window.close
  • Using Payment Request API

The are not interoperable solutions. We should come up with something better.

Some proposed straw-persons:

  • A web driver API to consume user activation
  • A method on UserActivation itself to consume user activation.
  • Something else???
@domenic
Copy link
Member

domenic commented Oct 29, 2022

Why are those not interoperable? At least PaymentRequest calls "consume user activation" in its spec, and per the WebDex link I posted, so do several others.

@marcoscaceres
Copy link
Contributor Author

marcoscaceres commented Oct 30, 2022

per the WebDex link I posted

Thanks... this is what I found:

Generally speaking, anything that requires user permission prompts probably can't be used, because those are usually modal (and non-cancellable) on mobile browsers.

So, a third option is seeing if there is a useful intersection in the above that covers all engines (and it would be a somewhat ugly hack). However, I'm not seeing anything very viable from the above.

chromium-wpt-export-bot pushed a commit that referenced this issue Nov 11, 2022
Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
chromium-wpt-export-bot pushed a commit that referenced this issue Nov 11, 2022
Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4023882
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1070478}
aarongable pushed a commit to chromium/chromium that referenced this issue Nov 11, 2022
Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

web-platform-tests/wpt#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4023882
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1070478}
chromium-wpt-export-bot pushed a commit that referenced this issue Nov 11, 2022
Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4023882
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1070478}
@marcoscaceres
Copy link
Contributor Author

@domenic, @mustaqahmed, what's the resistance (if any) to adding .consumeUserActivation()?

Even if we get agreement that .requestFullscreen() will consume it, .requestFullscreen() is computationally extremely expensive: it can take upwards of a second to rquestFullscreen().then(.exitFullscreen()). This ends up adding a lot of overhead to testing infrastructure, both for implementers and developers.

Having a sync consumeUserActivation() would solve for the above. Similarly, with window.open().close(), which is not very mobile friendly and also takes a lot of computing power... can make a sustainability argument here too 🌲.

@EdgarChen
Copy link
Member

Some proposed straw-persons:

  • A web driver API to consume user activation
  • A method on UserActivation itself to consume user activation.
  • Something else???

Or a method on TestUtils to consume user activation.

@marcoscaceres
Copy link
Contributor Author

Sorry if this is a silly question, but wouldn't TestUtils still also just rely on a one of the "hacks" above (unless Web Driver consumed it)?

@domenic
Copy link
Member

domenic commented Nov 15, 2022

what's the resistance (if any) to adding .consumeUserActivation()?

It doesn't solve any user- or web-developer facing problems. Test-only utilities should be done via Web Driver, not via exposed APIs.

@marcoscaceres
Copy link
Contributor Author

Ok, I agree.

So we have consensus that Web Driver is the way to go then?
w3c/webdriver#1691

I can try to put together a PR for that.

@domenic
Copy link
Member

domenic commented Nov 15, 2022

I don't really understand TestUtils vs. WebDriver, but yeah, seems reasonable to me.

@marcoscaceres
Copy link
Contributor Author

oh! TestUtils is this spec:
https://testutils.spec.whatwg.org

Given the discussions we've had elsewhere, I would argue that this is generally useful for web developers doing automated testing because it allows them to test for situations where transient activation has expired (and they many need to recover somehow). Thus, this fits into the "Web Driver" bucket, instead of the "browser vendor" bucket.

@jgraham, @EdgarChen, would you agree?

@marcoscaceres
Copy link
Contributor Author

I slapped together a quick PR:
w3c/webdriver#1695

Would appreciate any feedback there.

@EdgarChen
Copy link
Member

Doesn't have strong opinion on TestUtils vs Webdriver, just learn about TestUtils few days ago and share a possible altertive here :)

@marcoscaceres
Copy link
Contributor Author

Ok, implemented test_driver.consume_user_activation() for WebKit's test runner (not Safari Driver yet!): WebKit/WebKit#6539

It makes the tests super nice 😍 (plus WebKit now passes a lot more tests ✅):

consumed = await test_driver.consume_user_activation();

Everyone ok with making this a thing?

@mustaqahmed
Copy link
Member

This would be a great complement to test_driver.bless() and test_driver.click(). Thanks, 👍

@gsnedders
Copy link
Member

Ok, implemented test_driver.consume_user_activation() for WebKit's test runner (not Safari Driver yet!): WebKit/WebKit#6539

It makes the tests super nice 😍 (plus WebKit now passes a lot more tests ✅):

consumed = await test_driver.consume_user_activation();

Everyone ok with making this a thing?

This per our normal process should require an RFC.

@marcoscaceres
Copy link
Contributor Author

@gsnedders, ok cool. I can draft that up for WPT.

For Web Driver, I followed:
https://github.com/w3c/webdriver/#contribute

However, for the tests... I don't know any Python... I can try to copy/pasta 🍝 my way to success, but if anyone wants to help me with that, it would be massively appreciated. 🙏

@marcoscaceres
Copy link
Contributor Author

Hey everyone, I put together the RFC:
web-platform-tests/rfcs#128

Would love you feedback and, if you agree, show of support there.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 21, 2022
…n as tentative., a=testonly

Automatic update from web-platform-tests
Mark WPTs for user activation consumption as tentative.

Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

web-platform-tests/wpt#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4023882
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1070478}

--

wpt-commits: c5b10ac48ded5aa6b2a13006888da217bf9a63c8
wpt-pr: 36938
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Nov 21, 2022
…n as tentative., a=testonly

Automatic update from web-platform-tests
Mark WPTs for user activation consumption as tentative.

Currently these WPTs assume window.open() consumes user activation.
While this is true for most browsers, we still don't have any spec
standardizing this behavior.

web-platform-tests/wpt#36727

Change-Id: Ia1cb6a343e4c8ab86b0b672a583398c9d6c27ad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4023882
Commit-Queue: Mustaq Ahmed <[email protected]>
Reviewed-by: Robert Flack <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1070478}

--

wpt-commits: c5b10ac48ded5aa6b2a13006888da217bf9a63c8
wpt-pr: 36938
annevk pushed a commit to whatwg/html that referenced this issue Mar 7, 2023
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

No branches or pull requests

5 participants