Testcafe: Only first test loads all resources correctly

Created on 6 Dec 2019  路  3Comments  路  Source: DevExpress/testcafe

What is your Test Scenario?

Testing a website which relies on multiple JavaScript classes.

What is the Current behavior?

All classes are always loaded on the first test. Afterwards, not all classes are loaded.

What is the Expected behavior?

All classes are always loaded.

What is聽your web application and聽your TestCafe聽test code?

I'm testing a html page, let's say index.html, which includes a JavaScript module as follows:

<script src="app.js" type="module"></script>

Additionally, app.js imports a JavaScript class:

import ExampleClass from './ExampleClass.js'

And this is how ExampleClass is defined:

export default class ExampleClass {
}

As for my test class, it defines the following fixture:

fixture`Example`
  .page`index.html`

In this situation, if I run any number of tests, ExampleClass is only correctly loaded the first time. After the first test, no matter what this first test looks like, any other test logs a 404 for ExampleClass in the browser console. However, the local file's path as shown in the console log exists in the filesystem, although Testcaf茅 fails to find it.

Sample project: https://github.com/xalvarez/testcafe-import-class-issue

Your Environment details:

  • testcafe version: 1.7.0
  • node.js version: 12.13.1
  • command-line arguments: testcafe chromium test/
  • browser name and version: Chromium 78.0.3904.108
  • platform and version: Ubuntu 18.04.3
level 1 bug

Most helpful comment

@xalvarez

Hello,

Thank you for the sample project. I reproduced the issue under Windows 10 / Chrome 79. Our team will research it and check for a suitable solution.

All 3 comments

Please provide us with a sample project and test code, which demonstrate the issue.

I've written this sample project to reproduce the issue: https://github.com/xalvarez/testcafe-import-class-issue

@xalvarez

Hello,

Thank you for the sample project. I reproduced the issue under Windows 10 / Chrome 79. Our team will research it and check for a suitable solution.

Was this page helpful?
0 / 5 - 0 ratings