External API broken when called with TestCafe
What is your Scenario?
- Load API for HERE Maps
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-core.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-service.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>
- Use HERE Map as React-Component:
const H = window.H;
const platform = new H.service.Platform({
apikey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
});
const defaultLayers = platform.createDefaultLayers({ lg: mapConfig.lang });
const hMap = new H.Map(mapRef.current, defaultLayers.vector.normal.map, {
bounds: buildViewport(H, mapConfig),
pixelRatio: window.devicePixelRatio || 1,
});
What is the Current behavior?
Map Shows without any Problem when running in normal mode. When run with TestCafe an error occurrs:
JavaScript error details: TypeError: Cannot read properties of undefined (reading 'withCredentials')
What is the Expected behavior?
API works the same under 'normal' circumstances and in TestCafe
What is your public website URL? (or attach your complete example)
https://developer.here.com/tutorials/react/#code-examples
What is your TestCafe test code?
fixture`ExecutionSteps`.beforeEach(goToShipment);
test.only('click first step', async (t) => {
await t
.expect(jumboCheckBox1.exists)
.ok()
.expect(getClass(jumboCheckBox1))
.notContains('checked')
.click(jumboCheckBox1)
.expect(getClass(jumboCheckBox1))
.contains('checked');
});
Your complete configuration file
No response
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
- Open HERE Map in Browser -> works
- Run TestCafe Test containing that same page
- JS-Error occurrs
TestCafe version
1.18.0
Node.js version
v14.17.6
Command-line arguments
testcafe chrome ./e2e/tests/MyTest.test.ts
Browser name(s) and version(s)
Chrome 97.0.4692.71
Platform(s) and version(s)
Windows 10
Other
No response
Hello,
I reproduced the problem on my side using the component from the link you shared: https://developer.here.com/tutorials/react/#code-examples. Please refer to this screencast: https://www.screencast.com/t/cpCr3KgNbp. I also attached the archive with the test project and test.js file. 6813.zip
Hi @ohlsen3000,
This issue was fixed in Testcafe v1.18.5. Please update Testcafe to the latest v1.19.0. Feel free to contact us if you face any issues.