-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Avoid the integration tests creating PDF files in the downloads folder #18274
Comments
What if we simply added Line 922 in 4c04158
|
It looks like that might just work, and it'd be a very simple change. That'd at least address the concern of the newly added files since the mentioned commit, and we can deal with the autoprint files in another change. |
The majority of the issue is fixed by #18282. For this issue only the print tests remain. From a quick search it looks like both Chrome and Firefox have a way to configure the default download directory, so if we can't actually disable the printing action itself (which would be preferable) then probably the best we can do is point that to |
I found out that Firefox actually does it correctly and doesn't store anything in the downloads directory; we configured this here: https://github.com/mozilla/pdf.js/blob/master/test/test.mjs#L930-L938 The problem is limited to Chrome for which, even though it does have a preference for this called The only option I have been able to find in the Puppeteer issue tracker is puppeteer/puppeteer#923 (comment), for which we'd have to prepare a custom preferences file in the profile directory. This feels hacky, I can't really find good documentation on e.g. the format of said file and the default file contains all kinds of entries by default in there so it's not clear to me what happens if we don't provide those. We could try this approach, but it seems much better if Puppeteer had an option similar to |
If the integration tests are run locally (this likely also happens on the bot but we don't really notice it there) some PDF files are stored in the downloads folder as a side-effect of e.g. the autoprint tests. This was already a bit suboptimal because tests should not leave files on disk as a side-effect in general, but it looks like after #18271 the number of PDF files increased quite a bit. I think this is because we now actually clean up the viewer correctly, which causes all documents with forms in them to be auto-saved on closing of the viewer.
We should check if there is a way to avoid this. Maybe we can tell the viewer to discard the form changes via an existing API or include an extra parameter
save=false
in theclose
method or so, or at the very least maybe configure the browser (via Puppeteer configuration) to store such files in/tmp
so they are not in the way and are usually cleaned automatically. It might have to be a combination of both because I'm not sure if we can prevent the autoprint tests from doing this in the first place (on the other hand, maybe https://github.com/mozilla/pdf.js/pull/17962/files#diff-c0973b2c3b147db1eccd21c6b1af307f33a7e5d2658b4a0738a2386470b9c0caR1792 takes care of that?).Another reason why this is more of a concern now that more files are being created is that it might fill up the disk on the bots more quickly over time than before, which would require manual intervention to fix.
The text was updated successfully, but these errors were encountered: