wpt icon indicating copy to clipboard operation
wpt copied to clipboard

Clipboard API: use bless() instead

Open marcoscaceres opened this issue 2 years ago • 9 comments
trafficstars

Replaces waitForUserActivation() for test_driver.bless(). They functionally do the same thing, but bless is better for devices where an actual clickable thing needs to be activated.

marcoscaceres avatar Nov 23 '22 08:11 marcoscaceres

@marcoscaceres looking at the test results here, it looks like 3 tests have gone missing: https://wpt.fyi/results/clipboard-apis?diff&filter=ADC&run_id=5200303578677248&run_id=4800456115617792

The same can be seen for Chrome and Firefox. Can you check what might be going on with this?

foolip avatar Jan 30 '23 14:01 foolip

Let's see if the strange missing tests situation corrects itself... not sure why that would happen.

marcoscaceres avatar May 27 '24 06:05 marcoscaceres

@saschanaz, hopefully better now 🙈

marcoscaceres avatar May 28 '24 01:05 marcoscaceres

Hehe, I like letting the bots do the work🤖 will check, don’t worry.

marcoscaceres avatar May 28 '24 08:05 marcoscaceres

(You might want to keep the load event listener inside the current waitForUserActivation?)

saschanaz avatar May 28 '24 09:05 saschanaz

Why not just replace the implementation of waitForUserActivation() with a call to test_driver.bless()?

waitForUserActivation is far more readable in the test - how many people know that test_driver.bless() means the test waits for user activation? I know I wasn't aware of that.

See also saschanaz's comment, since keeping waitForUserActivation would make it easier to keep the 'load' listener, and also add workarounds if in the future we find a scenario where bless() doesn't quite do what we need.

garykac avatar May 28 '24 18:05 garykac

Why not just replace the implementation of waitForUserActivation() with a call to test_driver.bless()?

That adds additional layers of indirection: test ➡️ user-activation.js ➡️ test_driver...

waitForUserActivation is far more readable in the test - how many people know that test_driver.bless() means the test waits for user activation? I know I wasn't aware of that.

Right, but it's the same problem with .waitForUserActivation(): it could (was) be doing the unnecessary things. Using test_driver.bless() gives us single place (single thing to learn), and any updates to it will also benefit these tests. It reduces complexity and duplication.

I know I wasn't aware of that.

I understand. That should have been caught in review (and it's part of all of us learning what the test_driver API provides). This was caught because it then goes into WebKit's review.

See also saschanaz's comment, since keeping waitForUserActivation would make it easier to keep the 'load' listener, and also add workarounds if in the future we find a scenario where bless() doesn't quite do what we need.

Right, but we should only use something like waitForUserActivation() in cases where bless() doesn't do what we need.

The load listener might be a more general issue with the test design, which we hopefully shouldn't need at all. I'll take a look.

marcoscaceres avatar May 29 '24 02:05 marcoscaceres

Ok, so, noting that bless() supports user activation within iframes. The load was using the wait for load on the iframes, but it's less racy to just set that explicitly. I've updated the tests to do that...

marcoscaceres avatar May 29 '24 03:05 marcoscaceres

@saschanaz, @garykac, let me know what you think! Hopefully this captures the intent better.

marcoscaceres avatar May 30 '24 01:05 marcoscaceres

Ok, closing this as I'm not getting time to go through them properly.

marcoscaceres avatar Aug 20 '24 02:08 marcoscaceres