Get help with testing, discuss unit testing strategies etc.


Post by nuridesengin »

I've created two other Test Class and I am able to inherit whole functions through those test classes and all works pretty well. Now I've created a new class and totally same as two other classes but somehow this one keep fails;
Launching test suite, OS: MacOS, browser: Chrome 63.0.3239.84
[WARN] [ERROR] message : Uncaught TypeError: testClass is not a constructor
[WARN] [ERROR] url     : https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js
[WARN] [ERROR] line    : 17818
[WARN] [ERROR] col     : 53
[WARN] [ERROR] stack   : TypeError: testClass is not a constructor
    at Object.processURL (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:17818:53)
    at Object.override [as processURL] (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:817:32)
    at Object.runCoreSequential (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:17511:22)
    at Object.override [as runCoreSequential] (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:817:32)
    at https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:44108:24
    at Object.runCoreParallel (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:17459:25)
    at Object.override [as runCoreParallel] (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:817:32)
    at https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:44106:20
    at processGroup (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:44146:78)
    at Object.runCoreSharedContext (https://localhost:1841/oweb/test/Siesta/resources/js/siesta-all.js:44153:13)
Here is some snippets, how can other test classes works but this one fails?
index.js
var webApp = 'https://www..../';
var cloudApp = 'https://....';

{
        group: 'Application Tests',
        testClass: Siesta.Test.MonkeyTestClass,
        runCore : 'sequential',
        items: [
            {
                title: 'Automated Monkey Test for Web',
                pageUrl         : owebApp,
                url             : '04-app-tests/monkeyTestWeb.js'
            },
            {
                title: 'Automated Monkey Test for Cloud',
                pageUrl         : cloudApp,
                url             : '04-app-tests/monkeyTestCloud.js'
            }
        ]
    }
MonkeyClass.js
// Here is Test Class
Class('Siesta.Test.MonkeyTestClass', {
    isa: Siesta.Test.ExtJS,

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

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

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

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

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

                callback
            )
        }
    }
});
monkeyTestCloud.js
// and the test assertion.
describe('Monkey Test', function (t) {
    t.it('Should Login and doing some clicks on dashboard', function (t) {
        t.chain(
            {
                monkeyTest: t.next
            }
        )
    });
});

Post by nuridesengin »

BTW: I'm using siesta-standart 4.4.0. I've over come packing error with fixing node_modules directory. (It had another subfolder with the name of node_modules, just replaced those files under root node_modules directory and i've over come terminal usage problem.)

But still wondering if 4.4.0 version occurs testClass error? Because other test classes still works without any problem :/
Update: Nope! That's not the problem. I've switched to 4.3.2 but still keep says testClass is not constructor

Post by nuridesengin »

Succeed! So sorry to missed that up! I've not stated MonkeyTestClass on index.html of test-runner! Thats were all about that.. All fixed and work fine.

Just the thing; when i use pageUrl for 'https://...' it's being 'Failed' and instead of it when i use hostPageUrl it's 'Passed'. Is that sounds to bad?

Post by nickolay »

Cool, glad you figured that out!

`pageUrl` and `hostPageUrl` are the same thing, thats not the reason for sure. Using "pageUrl" may fail if you use self-signed certificates, in such case need to add certificate exception to the browser.

Post Reply