Get help with testing, discuss unit testing strategies etc.


Post by nuridesengin »

Hello dear Bryntum team. So far I've posted my questions to Stackoverflow because of i thought forum service is paid and last days Nickolay has informed me. Well I've to transfer that posted lastest question on Stackoverflow to here. Unfortunately i couldn't be success with Nickolay's advices.

Please click to see detailed version of question on here: https://stackoverflow.com/questions/475 ... ith-siesta

The thing I've configured Test Class with has attribute and implemented attribute configs as Nickolay adviced. Unfortunately test suite is giving this error:
TypeError: Cannot read property 'apply' of undefined
 at line 728, character 37, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 61, character 25, of https://localhost:1841/oweb/test/Siesta/lib/ListClass.js
    at line 817, character 32, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 15957, character 32, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 817, character 32, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 11383, character 36, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 8152, character 27, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 817, character 32, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 8103, character 29, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
    at line 817, character 32, of https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
Nickolay has mentioned that only the function arguments will be enough so I tried to reconfigure Test Class and test file on this way:

Main Class:
Class('Siesta.Test.ListScreen', {
isa     : Siesta.Test.ExtJS,

    methods: {
        // 1.a Navigation to submodule
        navigation: function (myPackageName, mySubModule, callback) {
            var t = this;

            t.chain(
                {waitForCQ: treeList},

                function (next) {
                    t.click('treelist[itemId=navigationTreeList]');
                    next();

                },
                {click: '>> treelistitem[_text='+t.myPackageName+']'},
                {click: '>> treelistitem[_text='+t.mySubModule+']', desc: t.mySubModule+isDisplaying},
                {click: '#main-navigation-btn => .fa-navicon', desc: collapseDesc},

                function (next) {
                    console.log('navigation func log');
                    next();
                },

                callback
            );
        }, ...
and calling this class from this test file:
describe('UI Testing: Submodule List Screen', function (t) {

    //Extended method for navigation to submodule
    t.it('Should open: Submodule Grid', function (t) {
        t.chain(
            {
                navigation: t.next
            }
        )
    });
});
But this way I couldn't be success to override the Test Class and gives this error:
Waiting for element ">> treelistitem[_text=undefined]" to appear


The thing here is I want to call same TestClass method for several Submodules and override several things such as myPackageName and mySubModule. How can i mapping test file to Test Class?

Post by nickolay »

Hi :)

Since `navigation` method now accepts 2 arguments the call to it should look like:
t.chain(
            {
                navigation: [ 'param1', 'param2' ]
            }
        )
The callback will be automatically added as a last argument. Please let me know if that helped.

See also: https://www.bryntum.com/docs/siesta/#!/ ... MethodCall

Post by nuridesengin »

Nope. :( Unfortunately it says:
TypeError: Cannot read property 'Submodule1' of undefined
Submodule1 stays as mySubModule (param2) on here and seems like it's passing myPackageName (param1)? I've examine MethodCall and used callback argument as last one.

This is last configuration which I've made:
t.it('Should open: Submodule Grid', function (t) {
        var navigation = t.next;
        t.chain(
            {
                navigation: t.next [ 'Package1', 'Submodule1' ]
            }
        )

Post by nickolay »

Also need to remove the "t." when accessing the value of the function argument:
{click: '>> treelistitem[_text='+t.myPackageName+']'},
                {click: '>> treelistitem[_text='+t.mySubModule+']',
to
{click: '>> treelistitem[_text='+myPackageName+']'},
                {click: '>> treelistitem[_text='+mySubModule+']',

Post by nuridesengin »

I already tried that and still same error... Can not ready property.

Post by nickolay »

Remove the "t." and use the code I posted originally:
t.chain(
            {
                navigation: [ 'param1', 'param2' ]
            }
        )

Post by nuridesengin »

YESSS!!! It works :) Thanks a lot Nickolay.

Post Reply