-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Pdf does not preview in iframe in electron #2835
Comments
Could you provide a way to reproduce this? |
We just hit this one and now I'm really confused. What should happen when there is an embedded pdf on a page and Cypress test is run on the page? Should it be displayed, should there be a placeholder (I've seen this on some runs, that there is an iframe placeholder on the page) or should this happen? We seemingly changed nothing on our system but suddenly our test runs in CI started to hang and I found out it was because of the save dialog popping up when navigating to a page with an embedded pdf. We've had the tests run ok for a few months now and now I'm in doubt that what happened now and how they have passed before. Tried with Cypress versions of 3.1.0 and 3.1.4. |
Are you running the tests on CI with the We'll need an example of the behavior, including test code and app code, to really look at the issue though. |
https://github.com/Juholei/cypress-pdf-problem here's an isolated example app with the simplest test. The app is a Reagent (React) ClojureScript app. Contains pdf embedded with an iframe. The test navigates to the page and looks for "Hello world!", but it gets stuck during the test run as the pdf prompts a save dialog. Works fine with Chrome, the problem occurs when running in Electron. There's also a couple screenshots of the prompt occurring, one when running headless and one when running with the GUI The web page itself can also be found at https://juholei.github.io/cypress-pdf-problem/. This example does not contain setting As per my original comment, I would like to know what should happen when the page under testing contains an embedded pdf and the tests are ran using Electron? |
@Juholei Thanks so much for providing a reproducible example! 💯 I've simplified this repo so that ClojureScript is no longer required. You can find my fork https://github.com/jennifer-shehane/cypress-pdf-problem |
I have the same issue, is they any workaround for this? |
@olaf89 the workaround is to run the tests in Chrome. This is less than ideal though, as then it is not possible to get video of the test run. Still hoping this will get fixed soon. |
Any updates on this issue? |
I wonder if it's because Electron doesn't package Chromium's built-in PDF viewer: electron/electron#12337 Maybe a fix could be to add this plugin to the BrowserWindow launched for the AUT: https://github.com/gerhardberger/electron-pdf-window |
I've discovered this problem as well, but not until I was trying to run our tests in CI using the headless option. Locally I was using Chrome so it took a while to figure out what was happening on the CI server. |
Running into this one as well. PDFs shown inline are a big part of our app. We can run tests with Chrome in CI, but we lose the ability to generate artifacts without Electron. |
I have the same issue, waiting for news... |
A simple example inline of way to reproduce. Requires
<html>
<body>
<iframe src="testing.pdf"></iframe>
</body>
</html>
it('Visiting iframe with pdf src', function () {
cy.visit('index.html')
}) |
@flotwig Electron removed support for the Chromium PDF viewer in 3.0.0. If this were due to the Electron not packaging the Chromium viewer electron/electron#12337, then this test case should work in Cypress 3.4.1 and fail in 3.5.0 (since that is when we upgraded from 2.0.18 to 5.0.10, but that is not the case. Right? Although this seems to describe this issue completely, they even mention iframes and nested iframes in Electron not working for PDF viewer: https://github.com/electron/electron/projects/7 I tested this all the way back to Cypress 2.0.0 and it breaks in that version too, so the original assertion that this may have been working in 3.1.2 by @rbokel doesn't appear to be the case. These issue sound completely relevant, but they are all tagged as duplicates of electron/electron#12337:
WorkaroundI was unable to find a current workaround to have this work when running in Electron. The only way around this is to run your tests in Chrome using the |
This will be partially addressed in the Electron 9 upgrade #7791 The browser will no longer prompt to 'download', which will prevent some locking up if running via Running this example after the PR shows the results below: https://github.com/jennifer-shehane/cypress-pdf-problem |
@jennifer-shehane Not able to understand what is the solution provided.... do I need to create index.html in cypress test suite... |
@86SUSHIL There is no workaround. You can run your test in Chrome using the --browser flag to avoid running Cypress in electron. |
@jennifer-shehane I have some restriction in using Chrome |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior:
A Pdf url is offered for download in Electron.
Desired behavior:
The Pdf should open in the pdf viewer in Electron
This works fine in Chrome.
The content-disposition header is set to inline
I think, this was working fine before 3.1.2
cypress 3.1.2
ubuntu 18.4
chrome 70
electron 59
The text was updated successfully, but these errors were encountered: