Testcafe-hammerhead: Support javascript files with type=module

Created on 15 Aug 2018  路  20Comments  路  Source: DevExpress/testcafe-hammerhead

Roadmap:

  • [x] es6-module
  • [x] import/export

https://jakearchibald.com/2017/es-modules-in-browsers/

Auto-locked bug support center

Most helpful comment

Thank you for your interest. The es6-module support (without import/export) has already been merged. I cannot currently tell you when we will publish TestCafe with this fix. Maybe, we will do it next week.

All 20 comments

Would you be able to provide some more details on the progress of this issue @miherlosev?

I'm currently experiencing problems when testing a web page with the following:

<head>
  <script type="module" src="index.mjs"></script>
</head>

It loads the module script index.mjs, then fails with:

TypeError: __call$ is not a function
...
  2) Unhandled promise rejection:

      { type: 'uncaughtErrorOnPage', isTestCafeError: true, callsite:
      CallsiteRecord { filename:'filename.ts',
      lineNum: 38, callsiteFrameIdx: 6, stackFrames: [ [CallSite],
      [CallSite], [CallSite], [CallSite], [CallSite], [CallSite],
      [CallSite], CallSite {}, [CallSite], [CallSite], [CallSite] ],
      isV8Frames: true }, errStack: 'TypeError: __call$ is not a
      function\n    at
      http://localhost:8888/index.mjs:2:1252\n    at
      http://localhost:8888/index.mjs:128:2738',
      pageDestUrl: 'http://localhost:8888/' }

Removing the module attribute resolves the issue for me, but it is not something that I can easily do on the web page I am testing.

Is there a work around or quick fix that I can do in the meantime?

Hi,

+1 on this issue, having problems on our side also

Hi,
was this issue fixed in the latest version. or are we expecting a fix ?

any timeline when that problem gonna be fix?
Or maybe any rough ideas?

Any personal estimate may be misleading, so I cannot tell you the precise date. Currently, I'm working on the es6-module support without the import/export keyword support.

@LavrovArtem thanks!
We are highly depended on that feature, so if you would need help with a testing or if you will have some pre-alpha release please let us know

Thank you for your interest. The es6-module support (without import/export) has already been merged. I cannot currently tell you when we will publish TestCafe with this fix. Maybe, we will do it next week.

@LavrovArtem Thanks for this, This issue was a deal breaker for me. Great to see that it is been looked into and fixed.

Any news on that issue @miherlosev ?
Need help ?

We're also being impacted by this issue.

Here is an example of what our code looks like:

<script type="module" src="<%= htmlWebpackPlugin.options.cdnUrl %>/abc-app@dev/dist/abc-app/abc-app.esm.js" data-fl-resources-url="<%= htmlWebpackPlugin.options.cdnUrl %>/abc-app@dev/dist/abc-app" data-fl-namespace="abc-app"> </script>

We're using TestCafe 1.3.3 and when test navigates to the page, we see the following error:

TypeError: Failed to fetch dynamically imported module: http://10.10.8.18:45280/abc-app.entry.js

ERROR Error: Uncaught (in promise): Error: Constructor for "abc-app#undefined" was not found Error: Constructor for "abc-app#undefined" was not found at initializeComponent (chunk-9c3af8d4.js:1769) at resolvePromise (hr-app-es2015.js:134537) at hr-app-es2015.js:134447 at hr-app-es2015.js:134463 at ZoneDelegate.invoke (hr-app-es2015.js:134099) at Object.onInvoke (hr-app-es2015.js:71053) at ZoneDelegate.invoke (hr-app-es2015.js:134098) at Zone.run (hr-app-es2015.js:133864) at hr-app-es2015.js:134595 at ZoneDelegate.invokeTask (hr-app-es2015.js:134131) at Object.onInvokeTask (hr-app-es2015.js:71034)

testcafe-error

Is there any workaround that we can use for now? (so we can at least automate this page)

Thank you!

@vogloblinsky

The <script type="module"> directive is already supported ([email protected])
Support of the dynamic imports is on the way.

@rodrigotolledo
Please wait until we implement this feature completely. If the problem persists after that, we will inspect it more deeply.

@miherlosev Just created a repro repository : https://github.com/vogloblinsky/testcafe-stencil
It just a simple html page loading a Stencil Web Component.
The page runs perfectly alone, but none inside testcafe/hammerhead.

Capture d鈥檈虂cran 2019-08-10 a虁 00 16 30
Capture d鈥檈虂cran 2019-08-10 a虁 00 16 41

@vogloblinsky I was able to reproduce the problem you described.
It seems like the problem is related to using the import/export functionality in your module. Currently, this feature isn't officially supported.
Please wait until we finish our work on the implementation of this functionality. If the problem persists, we will fix it in a separate issue.

@miherlosev Problem still persist with testcafe-hammerhead 1.9.0 in my repo repository.

@vogloblinsky

We've investigated your example and decided to create a separate issue for you case - https://github.com/DevExpress/testcafe-hammerhead/issues/2122. Track it be informed about our progress.

Thanks

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebokgabor84 picture sebokgabor84  路  8Comments

JoergFiedler picture JoergFiedler  路  7Comments

matthias-b picture matthias-b  路  8Comments

LinusBorg picture LinusBorg  路  4Comments

AndreyBelym picture AndreyBelym  路  5Comments