Closed Keithkdl closed 6 years ago
Can you please provide us with details on how the google maps file is loaded in your jasmine/karma configurations? Otherwise, can you please provide us with a sample repo that reproduces the problem?
the only thing relating to google maps is in th emodule.exports = function ( config )
files: [ 'https://maps.googleapis.com/maps/api/js?key=BLAH&libraries=places' ],
Thanks for providing the details. Here is the way to make it work in wallaby: in your src/wallabyTest.ts
file, add the following code:
var xhrObj = new XMLHttpRequest();
xhrObj.open('GET', 'https://maps.googleapis.com/maps/api/js?key=BLAH&libraries=places', false); // <- adjust the URL
xhrObj.send('');
var se = document.createElement('script');
se.type = "text/javascript";
se.text = xhrObj.responseText;
document.getElementsByTagName('head')[0].appendChild(se);
I am getting the error message
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://maps.googleapis.com/maps/api/js?key=HIDDEN_KEY_FOR_GITHUB&libraries=places'.
at http://localhost:58653/____wallaby-bundle.js?1534931496235&wallabyFileId=bundle:209107
It sounds like it may be due to me using using Angular CLI.
Try changing your env
setting as follows:
env: {
- kind: 'electron',
+ kind: 'chrome',
+ params: {
+ runner: '--headless --disable-web-security'
+ }
},
and applying the previously suggested change.
Perfect !!!!!
Thank you, working perfectly now
Issue description or question
I am using openlayers, with google maps @types/googlemaps.
When I try to test a component which is using the googlemaps, e.g.
private _searchResults: google.maps.places.AutocompletePrediction[]
I am getting an error in the wallaby test only
I assume this is because i am not importing googlemaps from the nodes folder?
How do I fix this please?
Jasmine / karam run fine with no error
Wallaby.js configuration file
Code editor or IDE name and version
Visual Studio Code v1.21.6
OS name and version
Windows 10