Sencha Test proxies the app (when using the In-Browser mechanism), so you can make additional requests for resources within that same site, and they will be passed through. However, you will likely run in to issues if the web services are on a different endpoint that requires authentication, which sounds like the case here. In that instance, you would need to call those endpoints directly, which will need additional CORS rules (e.g. to allow requests from the Sencha Test proxied URL), and perhaps authenticate using a token.
Alternatively, it is possible to mock Ajax requests using the SimManager. I have included an example below.
First, in your project's "app.json" under the "development" section, add a "requires" section specifically for the development build and add the "ux" package. For example:
Code:
"development": {
"watch": {
"delay": 250
},
"tests": {
"path": "test/project.json"
},
"requires": [
"ux"
]
},
Then, in your test suite do an "Ext.require" of the "Ext.ux.ajax" classes using Jasmine's "beforeAll". This will load the SimManager (and related classes) prior to the tests being run. After these classes have been loaded, the SimManager can be initialized and the endpoints configured. When an Ajax request is made to one of the endpoints, the mock data will be returned:
Code:
describe('Data Tests', function() {
beforeAll(function(done) {
Ext.require('Ext.ux.ajax.*', function() {
Ext.ux.ajax.SimManager.init({
delay: 300
}).register({
'/users': {
type: 'json',
data: [{
id: 1,
name: 'Dan'
}, {
id: 2,
name: 'Dave'
}]
}
});
done();
});
});
it('should load a mock set of users', function(done) {
Ext.Ajax.request({
url: '/users',
success: function(response) {
// Validate response here
done();
}
});
});
});
I tested the above example on an Ext JS 6.6 Classic app.
Hope this helps.