testcafe: Test hangs with non-HTML tested pages (pdf, plain text, etc.)

Are you requesting a feature or reporting a bug?

Enhancement

What is the current behavior?

If you are redirected by tested page to some non-HTML document (e.g. SVG, PNG, or PDF), or use such document in a fixture as a test page, the document will be loaded, but the test will hang because we don’t proxy such documents.

What is the expected behavior?

Show an error with a message that will explain that we don’t support such documents as test pages.

How would you reproduce the current behavior (if this is a bug)?

Run test

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://andreybelym.github.io/test-pages/gh-1471.html

Test code

fixture `Redirect`
        .page `https://andreybelym.github.io/test-pages/gh-1471.html`;


test('1',async t => {
    await t
        .click('a')
        .expect(true).ok();
}); 

Specify your

  • operating system: Windows 10
  • testcafe version: 0.15.0
  • node.js version: 7.4.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 26 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I have run into this today while trying to use testcafe to test an application which heavily uses PDF export functionality. I’m not expecting to be able to do assertions on the content of a PDF or anything like that, but it would be essential for my use case to be able to test that a PDF is generated and displayed in the browser.

Hi, having a similar problem with this. Some of our error messages come with type “text/plain” so when testcafe visits a broken page, instead of marking it as failed and continuing, it breaks the entire test. Is there any workaround to this? I’ve tried setting the timeout, but it doesn’t help.

Hello @Akshay-Kawlay,

Yes, the workaround implies that you know in advance which non-HTML pages TestCafe will be redirected to. I think this solution is more stable than relying on multiple TestCafe restarts when your browser hangs. If you still want to try that, you can change the threshold value here and build a custom version of TestCafe using Build Instructions from our contributing guide.

+1 for it, I also need to go through user flow, where in one step is generating PDF in another window (but due to fact, that TestCafe didn’t allow for multi tabs, it’s loaded in main window) so it crash test execution.

Although you only want go through and do navigate(url) to another place, still didn’t work. 💔

When this issue will be solved? A sprint is common 7-14 days. In my eyes it is not. bug this is definitely an incident because it blocks your customer. So if this will take a year more, it was reported in 2018 as I read, I have to look for another solution. Be fair and please give an estimation.

We would appreciate it too, as we are handling with some long URL during multiple redirects.