Get help with testing, discuss unit testing strategies etc.
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.
Are you preloading it in your test? Can you perhaps upload a small test case we can inspect / run?
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]});
});
Could you please zip this up so we can try run it? The most basic test which fails for you is enough
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 199 times