Page 1 of 1

Load external js resource file

Posted: Mon May 14, 2018 4:00 pm
by claudia_
Hi,

I've written some tests for a Sencha Extjs app (Extjs version 6.5.3 and I'm using Siesta 4.4.4).

I need to load an external javascript file which contains some functions I need inside my tests.

I've already added an external js file inside the 'preload' option of my harness file but I cannot execute the functions defined in those external js (e.g. I get 'function not defined method').

Can you explain which is the best practice about loading external js files for having custom functions to use inside Siesta tests ?

Any hint is appreciated.
Regards,

Claudia

Re: Load external js resource file

Posted: Mon May 14, 2018 4:33 pm
by mats
Could you please upload a ZIP file showing your test setup?

Re: Load external js resource file

Posted: Mon May 14, 2018 5:27 pm
by claudia_
Attached the ZIP file showing my test setup.

Re: Load external js resource file

Posted: Tue May 15, 2018 10:12 am
by nickolay
I've already added an external js file inside the 'preload' option of my harness file but I cannot execute the functions defined in those external js (e.g. I get 'function not defined method').
Are there any 404 errors? How exactly you call those external functions (your setup does not seem to contain any tests). See also https://www.bryntum.com/docs/siesta/#!/ ... test_class

Re: Load external js resource file

Posted: Tue May 15, 2018 11:23 am
by claudia_
Attached new setup zip with one test file inlcuded plus the js call to the external js resource.
Besides I have no 404 code about the loaded resources on my console network panel..
I simply call the function as normal function call.

Re: Load external js resource file

Posted: Tue May 15, 2018 11:29 am
by nickolay
Weird, this definetely should work. If you comment the call to external function - does the check about Ext pass? What if you switch it to explicit global assignment:
myTestSetup = function (){

Re: Load external js resource file

Posted: Tue May 15, 2018 11:44 am
by claudia_
If I comment the call to external function the check about Ext does pass.

After using explicit global assignment on my external js file, the function call does execute correctly.

So this has solved my issue
thanks