results-collection
results-collection copied to clipboard
Safari Tech Preview test results are different on local machine
I'm seeing some timeouts on Picture-in-Picture idl harness tests that I'm not seeing locally with Safari Tech Preview Release 67 (on macOS 10.13.6).
Note that it is the same with Safari stable locally.
Local machine

web-platform-tests dashboard

@jugglinmike do you have logs available for these runs, to see if they provide any clues?
Note that I actually get timeouts when running from command line (see below) Same for Safari Stable and Tech Preview.
./wpt run safari picture-in-picture/idlharness.window.html
Running 1 tests in web-platform-tests
▶ TIMEOUT [expected OK] /picture-in-picture/idlharness.window.html
▶ Unexpected subtest result in /picture-in-picture/idlharness.window.html:
│ TIMEOUT [expected PASS] idl_test setup
└ → Test timed out
It turns out that if I attach <video> to document.body, test doesn't time out anymore.
Note that test times out because loadedmetadata event is NOT fired when <video> is not attached to document.body.
It seems to be specific to running from command line (using Automation mode).
function loadVideo(activeDocument, sourceUrl) {
return new Promise((resolve, reject) => {
const document = activeDocument || window.document;
const video = document.createElement('video');
+ document.body.appendChild('video'); // Needed only for Safari Automation mode.
video.src = sourceUrl || getVideoURI('/media/movie_5');
video.onloadedmetadata = () => { resolve(video); };
video.onerror = error => { reject(error); };
});
}
https://github.com/web-platform-tests/wpt/blob/2ac8a23714d941c1a544f2b897a3c77f65425ae9/picture-in-picture/resources/picture-in-picture-helpers.js
@burg any idea what's up here with Safari behaving differently under automation?
I'm not quite sure what "Automation mode" means. Does this run via WebDriver, or not?
Yes @burg
What do I run to test this locally from the wpt repository with a custom driver path?
Two avenues come to mind:
- Is the window visible on the screen? If not, this might cause trouble. A video recording from a failing run would help triage this aspect.
- There may be a misconfiguration of the Automation window. safaridriver may need to set WKWebViewConfiguration._mediaDataLoadsAutomatically = YES to behave the same as Safari, but I can't check this easily.
@burg
./wpt run safari --webdriver-binary /Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver picture-in-picture/idlharness.window.html
--channel=preview should also work after https://github.com/web-platform-tests/wpt/pull/13460 too.
Great, I'm tracking this internally as rdar://problem/45384220. I'll update this issue when I figure it out.
@burg, here's a 28s screen recording: https://photos.app.goo.gl/qsxSgHijiWEfVW649
That's cool :)
Note that if you ever want to run a single test and don't want the window to stay open you can use --no-pause.
FWIW @jernoble and I noticed that HTMLMediaElement logs were not present in the Console.app to help debugging this.
Moreover, on @padenot's machine, test was actually flaky, not always a timeout.
Update: I was able to get flakyness as well.
@burg Let me know if I can help.
@beaufortfrancois once https://github.com/web-platform-tests/wpt/pull/13769 has landed, you should be able to submit a PR that tweaks .azure-pipelines.yml a bit to run the test using Safari Technology Preview, for a second data point. If it also is different from a local machine, then at least it's easy (ish) to iterate on the Azure Pipelines setup to work out why it's different.
@burg Any progress on this issue?
I executed ./wpt run --channel=preview safari picture-in-picture/idlharness.window.html again this morning and I'm still seeing the timeout issue.
As I said in https://github.com/web-platform-tests/results-collection/issues/619#issuecomment-430696562, attaching the video to the body fixes the timeout.
@burg Were you able to figure this one out? @jernoble may help as well to diagnose. @foolip Is there anything else I can do as well to help?
$ ./wpt run --channel=preview safari picture-in-picture/idlharness.window.html
Running 1 tests in web-platform-tests
▶ TIMEOUT [expected OK] /picture-in-picture/idlharness.window.html
▶ Unexpected subtest result in /picture-in-picture/idlharness.window.html:
│ TIMEOUT [expected PASS] idl_test setup
└ → Test timed out
$ ./wpt run safari picture-in-picture/idlharness.window.html
safaridriver: unrecognized option `--version'
Running 1 tests in web-platform-tests
▶ TIMEOUT [expected OK] /picture-in-picture/idlharness.window.html
▶ Unexpected subtest result in /picture-in-picture/idlharness.window.html:
│ TIMEOUT [expected PASS] idl_test setup
└ → Test timed out

@beaufortfrancois if you're getting unrecognized option --version'then you're probably not using the most recent Safari Technology Preview. Does/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver --version` also give you that error? If so can you update it?
The problem, however, seems to be related to picture-in-picture-helpers.js. Can you just attach the video to the document if that fixes the problem? You could file a WebKit bug and link to it in a comment.
Sorry, there were two ./wpt run invocations in your code block, and only the second one shows the warning. That's as expected until the next Safari stable release.
My goal with these tests is to make sure a video doesn't have to be attached to the DOM to be able to enter Picture-in-Picture, so it should fail (because it is not supported yet) but not time out.
To be clear, this issue happens only in SafariDriver, not Safari browser.
@beaufortfrancois is there anything in https://github.com/WebKit/webkit/blob/master/Source/WebCore/html/HTMLMediaElement.cpp that provides hints? Without reading code, my guess would be that the window isn't considered focused or visible when run under automation, and that there's some code that waits for it to be focused/visible.
It may be mediaDataLoadsAutomatically as suggested earlier by @burg but I'm not sure.
I haven't had time to look into this, but it's still being tracked.
@burg Is there any chance you can prioritize this or we can help?