Page 1 of 1

Preload config not loading

Posted: Fri Jul 06, 2018 2:09 am
by zombeerose
The preload option is not loading the specified JS file before launching each test. I don't even seen the file requested in network traffic. Here is the harness config:
var harness = new Siesta.Harness.Browser.ExtJS();

harness.configure({
    autoCheckGlobals: true,
    coverageUnit: 'file',
    defaultTimeout: 30000,
    enableCodeCoverage: false,
    expectedGlobals: [
        'Ext'
    ],
    forceDOMVisible: true,
    needDone: true,
    pauseBetweenTests: 500,
    preload: [
        '/includes/portal/tests/bootstrap.t.js'
    ],
    showTestDurationColumn: true,
    speedRun: true,
    testClass: Portal.TestClass,
    title: 'Portal Test Suite',
    transparentEx: false, 
    viewDOM: true, 
    waitForTimeout: 30000
});

harness.startFromUrl('/tests/unit/discover');

Any ideas? Does preload work when using "startFromUrl"?

Siesta 4.2.2 and 4.4.4.

Re: Preload config not loading

Posted: Fri Jul 06, 2018 9:59 am
by nickolay
Hm.. Preload should definitely work. Perhaps test has its own "preload" config? Or it uses "pageUrl" config (in this case preload will be ignored by default)?

Re: Preload config not loading

Posted: Mon Jul 09, 2018 5:06 pm
by zombeerose
Indeed, that is the case that I overlooked. I was including the "pageUrl" in the startFromUrl response. I have updated the response and it works. Thanks!

One more question - during the preload (or before the test runs), is there a way to augment the Ext object such that the ajax responses can be manipulated? Essentially I want this code to run so I can redirect tests to local static data:
Ext.Function.interceptBefore(Ext.Ajax, 'request', function(options){ ... }

Re: Preload config not loading

Posted: Tue Jul 10, 2018 6:56 am
by nickolay
Sure, just place this code in the test? There's SimManager IIRC - Ext ajax mocking in the examples.

Re: Preload config not loading

Posted: Tue Jul 10, 2018 5:35 pm
by zombeerose
Since this intercept would apply to a lot of tests (>100), I am looking for a universal way to inject it. I'll check the examples.

Re: Preload config not loading

Posted: Sat Jul 14, 2018 8:23 am
by nickolay
Then probably you need your own test class with tweaked "setup" method.