Closed
Bug 1599803
Opened 5 years ago
Closed 4 years ago
Factor out repeated logic in Picture-in-Picture tests
Categories
(Toolkit :: Video/Audio Controls, task, P3)
Toolkit
Video/Audio Controls
Tracking
()
RESOLVED
FIXED
82 Branch
Tracking | Status | |
---|---|---|
firefox82 | --- | fixed |
People
(Reporter: mconley, Assigned: reidshina6)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
We have a number of PiP tests that follow this pattern:
- Cause the PiP player window to open
- Do a check of some kind
- Close the player window, and wait for the "This video is playing in Picture-in-Picture mode" message to go away in the originating video
We can / should probably factor this repeated stuff out into a helper method inside of head.js instead of repeating ourselves again and again.
Reporter | ||
Comment 1•5 years ago
|
||
It's also unclear whether those try / catch / finally blocks are really helpful.
Reporter | ||
Updated•4 years ago
|
Assignee: nobody → reidshina6
Reporter | ||
Comment 2•4 years ago
|
||
Here are 3 instances of us doing the same things in some tests:
- https://searchfox.org/mozilla-central/rev/5d45da52f2fa423c9f4505ede5d1a5c7d48163fc/toolkit/components/pictureinpicture/tests/browser_keyboardShortcut.js#44-54
- https://searchfox.org/mozilla-central/rev/5d45da52f2fa423c9f4505ede5d1a5c7d48163fc/toolkit/components/pictureinpicture/tests/browser_showMessage.js#25-35
- https://searchfox.org/mozilla-central/rev/5d45da52f2fa423c9f4505ede5d1a5c7d48163fc/toolkit/components/pictureinpicture/tests/browser_thirdPartyIframe.js#43-55
I think we can factor these out into a helper. Our helper functions for the PiP tests go in this file:
So I recommend factoring those 3 instances out into a helper function in head.js with a signature like this:
async function ensureMessageAndClosePiP(browser, videoID, pipWin) {
//...
}
Do add a docstring above the helper function, and then update the 3 instances I listed above to use it.
You can run the tests by using:
./mach mochitest <path to test>
example:
./mach mochitest toolkit/components/pictureinpicture/tests/browser_keyboardShortcut.js
Assignee | ||
Comment 3•4 years ago
|
||
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/31d155c12756
Factor out repeated logic in Picture-in-Picture tests. r=mconley
Comment 5•4 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 4 years ago
status-firefox82:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•