Get help with testing, discuss unit testing strategies etc.


Post by nickolay »

No, don't think so. Can you prepare a test case for us to inspect?

Post by Edgar »

describe('Sla testing', function (t) {

    t.it('Test Sla Creation', function (t) {
        t.chain({
                waitForCQ: 'button[text=Scheduler]'
            }, {
                click: '>> button[text=Scheduler]'
            }, {
                click: '>> menuitem[text=Timetable]'
            }, {
                waitForCQ: 'panel[title=SLA]'
            }, {
                click: '>> panel[title=SLA]'
            }, {
                click: '>> button[tooltip=Create SLA]'
            },
            function (next) {
                t.selectText('>> scheduler-sla-info textfield[fieldLabel=Name]');
                t.type('>> scheduler-sla-info textfield[fieldLabel=Name]', 'SOME SLA', next);
            },
            function reloadPage(next) {
                t.waitFor(2000, function () {
                    t.global.location.reload()
                });
                t.waitForPageLoad(next);
            },
            function (next) {
                t.waitForComponentVisible('>> scheduler-sla-info textfield[value=SOME SLA]',next);
            }
        )
    })
});
did you mean the test I try to run? Here you are.
But exeptions are thrown,before testing starts, on initializtion.

Post by nickolay »

No, I mean the zip folder with your setup or something else so that I can reproduce the problem.

Post by Edgar »

It is kind a big project, it requires some additional app to run.

Post by nickolay »

Ok, then, please can you enable "stop on exception" in your debugger, do some investigation and post the results here? I can't fix the problem w/o knowing anything about it :)

Post by Edgar »

The stack trace of error:
ReferenceError: AlertDependency is not defined
    at eval (https://localhost:8181/ac-web-package/plugins/scheduler/view/controller/EditSlaAlertsController.js:6:332)
    at eval (native)
    at Object.Ext.globalEval (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1366:32)
    at Object.Ext.Boot.Ext.Boot.Entry.inject (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1122:21)
    at Object.b.Boot.Entry.inject (eval at <anonymous> (https://localhost:8181/ac-web-package/:34:43), <anonymous>:3:470)
    at Object.Ext.Boot.Ext.Boot.Entry.evaluateContent (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1239:18)
    at Object.Ext.Boot.Ext.Boot.Entry.evaluate (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1255:24)
    at Object.Ext.Boot.Ext.Boot.Entry.loadSync (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1175:16)
    at Object.Ext.Boot.Ext.Boot.Entry.load (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:1231:24)
    at Object.Ext.Boot.Ext.Boot.Request.loadEntries (https://localhost:8181/ac-web-package/extjs/ext-all-debug.js:799:47)
The line where it happens:
Ext.define('Plugin.scheduler.view.controller.EditSlaAlertsController', {
	extend : 'Ext.app.ViewController',
	alias : 'controller.edit-sla-alerts-controller',

	requires : ['Platform.utils.Permissions', 'Plugin.scheduler.utils.Events'],

	control : {
		'grid#assigned-alerts-grid' : {
			selectionchange : 'onAlertSelectionChange',
			itemdblclick : AlertDependency.onRedirectToAlert,  <---HERE
			rowkeydown : 'onAlertKeyDown',
			boxready : 'initDnD'
		}
	},
"AlertDependency" is alternative name of controller.
Ext.define('Plugin.scheduler.dependency.AlertDependencyController', {
    extend : 'Ext.app.Controller',

    alternateClassName : ['AlertDependency'],

    requires : ['Plugin.scheduler.utils.Events'],
When I use this code to hook:
		<script type="text/javascript">console.log(parent);
				parent.Harness && eval(parent.Harness.getLoaderInstrumentationHook())
            </script>
it has problems to see static clases, or maybe(I not sure) it tries to hook EditSlaAlertsController before AlertDependencyController or something like this.

Post by nickolay »

Hm.. Can you reproduce the problem in simplified environment (build an empty app with single controller) and post the test case?

Post Reply