Write automated test(s) to cover manual test 'PiP window controls functionality .'
Categories
(Toolkit :: Video/Audio Controls, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox81 | --- | fixed |
People
(Reporter: tracy, Assigned: tracy)
References
Details
Attachments
(1 file)
PiP window controls functionality is a manual test we'd like to automate. This test checks basic functionality of the PiP controls.
| Assignee | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
So the way this test would work is:
- Pref on the mute/unmute toggle, which is only enabled in Nightly for now.
- Open up a PiP window for a video that is playing
- Click on the "pause" button in the player, and ensure that the video pauses
- Click on the "play" button in the player, and ensure that the video plays again
- Click on the "mute" button in the player and ensure that the video mutes
- Click on the "unmute" button in the player and ensure that the video unmutes
- Click on the "unpip" button in the player and ensure that the PiP player window closes and the video continues to play
- Re-open the PiP window on the playing video, and then click on the "close" button. Ensure that the PiP player window closes, and the video is paused.
The pre-existing tests are in toolkit/components/pictureinpicture/tests and can be used as reference. The head.js file contains some pretty handy shared functions that can take care of a lot of boiler plate.
I recommend getting started by adding the test with the ./mach addtest command, like so:
./mach addtest toolkit/components/pictureinpicture/tests/browser_playerControls.js
You can run the test while developing using:
./mach mochitest toolkit/components/pictureinpicture/tests/browser_playerControls.js
I'd start by looking at toolkit/components/pictureinpicture/tests/browser_showMessage.js to see how it works. Note that it's testing two different types of videos (with and without the controls attribute), which I don't think will be necessary for this test. Just choosing one is fine.
The test opens up a new tab, and then does:
let pipWin = await triggerPictureInPicture(browser, videoID);
That's key - that's going to get you your player window. You can then access the DOM for the player window via pipWin.document. So, for example, to get the play/pause toggle button, you should be able to do:
let playPause = pipWin.document.getElementById("playpause");
playPause.click(); // If the video is playing, this should pause it.
For things like play, pause, mute and unmute, you'll want to then check the state of the video after the button is clicked. You can do that using SpecialPowers.spawn to run a function within the content area to get access to the underlying video element and look at its properties. Some examples: https://searchfox.org/mozilla-central/rev/56bb74ea8e04bdac57c33cbe9b54d889b9262ade/toolkit/components/pictureinpicture/tests/browser_closePlayer.js#14-23
This should hopefully get you started. Let me know if and when you get stuck, and I'll guide you through.
| Assignee | ||
Comment 2•5 years ago
|
||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Backed out changeset 0e8938777f94 (bug 1656016) for browser_playerControls.js failures
Backout link: https://hg.mozilla.org/integration/autoland/rev/25802f39f81f187335d779d3152f6fc14ed06d96
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=312400548&repo=autoland&lineNumber=7307
[task 2020-08-07T15:22:22.041Z] 15:22:22 INFO - TEST-START | toolkit/components/pictureinpicture/tests/browser_playerControls.js
[task 2020-08-07T15:22:22.658Z] 15:22:22 INFO - TEST-INFO | started process screentopng
[task 2020-08-07T15:22:23.647Z] 15:22:23 INFO - TEST-INFO | screentopng: exit 0
[task 2020-08-07T15:22:23.648Z] 15:22:23 INFO - Buffered messages logged at 15:22:22
[task 2020-08-07T15:22:23.649Z] 15:22:23 INFO - Entering test bound
[task 2020-08-07T15:22:23.650Z] 15:22:23 INFO - Testing with-controls case.
[task 2020-08-07T15:22:23.651Z] 15:22:23 INFO - Waiting for videos to be ready
[task 2020-08-07T15:22:23.652Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | Got Picture-in-Picture window. -
[task 2020-08-07T15:22:23.652Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is not paused -
[task 2020-08-07T15:22:23.653Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is paused -
[task 2020-08-07T15:22:23.654Z] 15:22:23 INFO - Buffered messages finished
[task 2020-08-07T15:22:23.655Z] 15:22:23 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is playing -
[task 2020-08-07T15:22:23.655Z] 15:22:23 INFO - Stack trace:
[task 2020-08-07T15:22:23.656Z] 15:22:23 INFO - chrome://mochikit/content/browser-test.js:test_ok:1299
[task 2020-08-07T15:22:23.656Z] 15:22:23 INFO - chrome://mochitests/content/browser/toolkit/components/pictureinpicture/tests/browser_playerControls.js:null:50
[task 2020-08-07T15:22:23.656Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The audio is playing -
[task 2020-08-07T15:22:23.656Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The audio is muted -
[task 2020-08-07T15:22:23.656Z] 15:22:23 INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-08-07T15:22:23.657Z] 15:22:23 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The audio is playing -
[task 2020-08-07T15:22:23.657Z] 15:22:23 INFO - Stack trace:
[task 2020-08-07T15:22:23.657Z] 15:22:23 INFO - chrome://mochikit/content/browser-test.js:test_ok:1299
[task 2020-08-07T15:22:23.657Z] 15:22:23 INFO - chrome://mochitests/content/browser/toolkit/components/pictureinpicture/tests/browser_playerControls.js:null:59
[task 2020-08-07T15:22:23.658Z] 15:22:23 INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-08-07T15:22:23.659Z] 15:22:23 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is not paused -
[task 2020-08-07T15:22:23.659Z] 15:22:23 INFO - Stack trace:
[task 2020-08-07T15:22:23.660Z] 15:22:23 INFO - chrome://mochikit/content/browser-test.js:test_ok:1299
[task 2020-08-07T15:22:23.660Z] 15:22:23 INFO - chrome://mochitests/content/browser/toolkit/components/pictureinpicture/tests/browser_playerControls.js:null:66
[task 2020-08-07T15:22:23.661Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | Got Picture-in-Picture window. -
[task 2020-08-07T15:22:23.662Z] 15:22:23 INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-08-07T15:22:23.662Z] 15:22:23 INFO - TEST-UNEXPECTED-FAIL | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is not paused -
[task 2020-08-07T15:22:23.663Z] 15:22:23 INFO - Stack trace:
[task 2020-08-07T15:22:23.663Z] 15:22:23 INFO - chrome://mochikit/content/browser-test.js:test_ok:1299
[task 2020-08-07T15:22:23.663Z] 15:22:23 INFO - chrome://mochitests/content/browser/toolkit/components/pictureinpicture/tests/browser_playerControls.js:null:71
[task 2020-08-07T15:22:23.665Z] 15:22:23 INFO - TEST-PASS | toolkit/components/pictureinpicture/tests/browser_playerControls.js | The video is paused -
[task 2020-08-07T15:22:23.665Z] 15:22:23 INFO - Leaving test bound
[task 2020-08-07T15:22:23.666Z] 15:22:23 INFO - GECKO(21953) | MEMORY STAT | vsize 3478MB | residentFast 359MB | heapAllocated 137MB
[task 2020-08-07T15:22:23.668Z] 15:22:23 INFO - TEST-OK | toolkit/components/pictureinpicture/tests/browser_playerControls.js | took 1214ms
| Assignee | ||
Comment 5•5 years ago
|
||
Mike, unpause of the paused video failed. Any ideas why this is failing in production?
| Assignee | ||
Comment 7•5 years ago
|
||
Patch on the way. However, I need to get access to try restored (see bug 1658335), to confirm raciness is fixed there.
Comment 9•5 years ago
|
||
| bugherder | ||
Description
•