Page 1 of 1
How to access Ext JS project objects in Test?
Posted: Fri Oct 26, 2018 4:55 pm
by berkancimen
Hi,
I have a 'myStrings' object in Ext Js app folder. In project files I can easily get variables in that object like 'myStrings.stringOne'.
myStrings = {
stringOne: 'One',
stringTwo: 'Two',
.......
}
Usage:
Ext.define('myApp.view.classA', {
title: myStrings.stringOne,
}
Here is my test case and the place where I have trouble with:
describe('UI Test', function (t) {
t.chain({navFunction: [ myStrings.stringOne ]}) ;
});
I have to use myStrings.stringOne as parameter. But I get " ReferenceError: myStrings is not defined ". Any help would be appreciated.
Re: How to access Ext JS project objects in Test?
Posted: Sun Oct 28, 2018 6:41 pm
by mats
Are you preloading it in your test? Can you perhaps upload a small test case we can inspect / run?
Re: How to access Ext JS project objects in Test?
Posted: Tue Oct 30, 2018 8:44 am
by berkancimen
Here is index.js file:
let project = new Siesta.Project.Browser.ExtJS();
project.configure({
title: 'Test Runner',
viewDOM: true,
enableCodeCoverage: true,
autoScrollElementsIntoView: true,
viewportHeight : 1100,
viewportWidth : 900,
coverageUnit: 'file',
runCore: 'sequential',
separateContext: true,
preload: [
'....../resources/myStrings.js'
]
});
project.plan(
{
group: 'Application Tests',
testClass: Siesta.Test.TestClass,
items: [
// Test cases here...
]
}
};
project.start();
And test case class:
Class('Siesta.Test.TestClass', {
isa : Siesta.Test.ExtJS,
methods: {
nav: function (subMenu, callback) {
let t = this;
t.it('Test', function (t) {
t.chain(
...............
{click: '#main-home .x-treelist-item-expanded .x-treelist-item-text:textEquals('+ subMenu +')', desc: 'Choose Sub-Menu item' },
..............
callback
);
});
},
}
}
And lastly my test suite:
describe('UI Test Case', function (t) {
t.chain({nav: [myStrings.stringOne]});
});
Re: How to access Ext JS project objects in Test?
Posted: Tue Oct 30, 2018 10:37 am
by mats
Could you please zip this up so we can try run it? The most basic test which fails for you is enough
Re: How to access Ext JS project objects in Test?
Posted: Tue Oct 30, 2018 2:11 pm
by berkancimen
Sorry for late replies. You can download zip file from attachment.
- projectOne.zip
- I had to remove test/siesta/resources folder because of it's size.
- (17.94 KiB) Downloaded 196 times
Re: How to access Ext JS project objects in Test?
Posted: Wed Oct 31, 2018 9:58 am
by nickolay
Perhaps you use a "pageUrl" option. In this case the "preload" option behaves a bit differently, see the docs:
https://www.bryntum.com/docs/siesta/#!/ ... fg-preload
You need to specify the `preload : "inherit"`basically