mardi 31 octobre 2017

Siesta Test Class Gives 'Maximum call stack size exceeded' error

I've created a Test Class which includes some iterative actions; such as Login and opening menu item through Menu. The error exist during opening menu item:

Test threw an exception
RangeError: Maximum call stack size exceeded
    at line 13760, character 45, of http://localhost:1841/app/test/Siesta/resources/js/siesta-all.js


Here is Test Class and I guess the error occurs through those multiple methods;

Class('Siesta.Test.OWeb', {

    isa     : Siesta.Test.ExtJS,

    methods: {
        login : function(callback){
            var t = this;

            this.chain(
                { waitForCQ : 'window[title=Login]' },

                function(next) {
                    t.cq1('>> textfield[name=username]').setValue('user@adress.com');
                    t.cq1('>> textfield[name=password]').setValue('password');
                    next();
                },

                {click: '>> button[text=Submit]'},
                {waitForCQNotVisible: 'window[title=Login]', desc: 'Submit process is succeed!'},

                callback
            )
        },

        firstMenuItem: function (callback) {
            var t = this;

            t.chain(
                {waitForCQ: 'treelist[itemId=navigationTreeList]'},
                {click: '>> treelistitem[_text=First]'},
                {click: '>> treelistitem[_text=MenuItem]', desc: 'First Menu Item is displaying now.'},

                callback
            )
        },

        secondMenuItem: function (callback) {
            var t = this;

            this.chain(
                {waitForCQ: 'treelist[itemId=navigationTreeList]'},
                {click: '>> treelistitem[_text=Second]'},
                {click: '>> treelistitem[_text=MenuItem]', desc: 'Second Menu Item is displaying now.'},

                callback
            )
        },
        // Keep going like this for 5-6 times...
}

and I'm calling TestClass for each menu item sanity file this way;

describe('CRUD Tests: Login', function (t) {
    t.it('Should extend the Test Class and Login to App', function (t) {
        t.chain(
            {
                login: t.next
            }
        )
    });

    t.it('Should open First Menu Item', function (t) {
        t.chain(
            {
                firstMenuItem: t
            }
        )
    });
});


Normally Test Class works with 2 methods but as i told after rearranged for multiple menu item, it threw this error. Is it possible to arrange methods with an array and implement each menu item as a object;

methods: [
  {firstMenuItem: func () ... },
  {secondMenuItem: func () ... },
  //....
] 

and How to call array object on Menu item sanity file? I've tried but it couldn't extend Test Class... or any other idea?

Aucun commentaire:

Enregistrer un commentaire