Get help with testing, discuss unit testing strategies etc.


Post by abenhamdine »

Hi,

We are currently testing Siesta Lite, in order to evaluate the product.

We wrote a simple application test, just to check if the app is loading.
And indeed, the app load (we can see our login view in the dom panel) but we run into the following error in the siesta ui :
Error: [Ext.createByAlias] Unrecognized alias: data.field.cvlDate
    at Ext.Inventory.instantiateByAlias (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:14608:27)
    at Ext.Factory.create (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:24173:36)
    at Function.initFields (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:82535:39)
    at Function.<anonymous> (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:82951:15)
    at Function.triggerExtended (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:11372:33)
    at Function.<anonymous> (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:12994:31)
    at Function.doProcess (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:12826:34)
    at https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:19402:24
    at Object.load (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:18943:30)
    at Object.require (https://localhost:8889/client/libs/ext-6.0.1/build/ext-all-debug.js:18873:39)
Yet the alias data.field.cvlDate is totally valid since it's one of our classes :
Ext.define('RMWeb.framework.cvlDataFieldDate', {
 	extend: 'Ext.data.field.Date',

 	alias: 'data.field.cvlDate',

 	dateWriteFormat: "Y-m-d"

 });
This class is extensively used in our application, as a field type in all models, and it works perfectly.

I added this class in bootstrap file index.js, thus I don't understand this message.

Thx in advance.
Last edited by abenhamdine on Sat Dec 03, 2016 8:47 pm, edited 1 time in total.

Post by nickolay »

Hi,

Can you post your harness "index.js" content?

Post by abenhamdine »

var harness = new Siesta.Harness.Browser.ExtJS();

harness.configure({
    title: "Test payroll-app",

    preload: [
        // version of ExtJS used by your application
        // (not needed if you use Sencha Cmd which builds a complete 'all-file' including Ext JS itself)
        "/client/libs/ext-6.0.1/build/classic/theme-crisp-touch/resources/theme-crisp-touch-all-debug.css",
        "/client/libs/ext-6.0.1/build/ext-all-debug.js",
        "/client/libs/ext-6.0.1/build/packages/charts/classic/crisp/resources/charts-all.css",
        "/client/libs/ext-6.0.1/build/packages/ux/classic/ux-debug.js",
        "/client/libs/ext-6.0.1/build/packages/ux/classic/crisp/resources/ux-all-debug.css",

        // Your application files
        "app/Application.js",
        "app/Globals.js",
        "app/model/mdlSAL_F.js",
        'app/DirectAPI.js',
        'app/framework/cvlProxyList.js',
        'Ext/ux/ExportableGrid.js',
        'app/framework/arhLiveSearchGridPanel.js',
        'app/framework/arhWindow.js',
        'app/framework/cvlViewBaseForm.js',
        'app/framework/cvlViewForm.js',
        'app/framework/arhPanelForTabpanel.js',
        'app/framework/cvlViewFormWithNav.js',
        'app/framework/cvlViewList.js',
        'app/framework/cvlViewMsg.js',
        'app/framework/cvlViewDocPage.js',
        'app/framework/cvlTabPanelForForms.js',
        'app/framework/cvlWidgetGrid.js',
        'app/framework/cvlWidgetCombo.js',
        'app/framework/cvlCheckboxField.js',
        'app/framework/cvlWidgetNumberField.js',
        'app/framework/cvlWidgetDateField.js',
        'app/framework/arhWidgetTextField.js',
        'app/framework/cvlWidgetIdField.js',
        'app/framework/cvlWidgetCodeField.js',
        'app/framework/cvlWidgetCodePostalField.js',
        'app/framework/cvlDataFieldDate.js',
        'app/framework/cvlWidgetFormFieldSet.js',
        'app/framework/cvlWidgetFormInFieldSet.js',
        'app/framework/cvlRadioGroupTypeLienDossiers.js',
        'app/view/login/viewLogin.js'

    ]
});

harness.start({
    group: "Prérequis",
    items: [
        'test-front/0.sanity-tests/sanity.t.js'
    ]
}, {
    group: "Tests unitaires",
    sandbox: false, // speeds it up, sharing the same iframe for tests in this group
    items: [
        'test-front/1.unit-tests/basic_assertions.t.js'
    ]
}, {
    group: "Tests ui",
    sandbox: false,
    //preload: ['../app/framework/arhWidgetTextField.js'],
    items: [
        'test-front/2.ui-tests/combo/combo.t.js'
    ]
}, {
    group: "Tests application",
    sandbox: false,
    //preload: ['../app/framework/arhWidgetTextField.js'],
    pageUrl: "../index.html",
    waitForAppReady: true,
    preload: 'inherit',
    items: [
        //'test-front/3.application-tests/001_sanity.t.js',
        //'test-front/3.application-tests/002_models.t.js',
        'test-front/3.application-tests/003_Login.t.js'
    ]
});
The culprit is 'test-front/3.application-tests/003_Login.t.js

Post by nickolay »

If you are pointing to the "pageUrl" you should not probably set the "preload" to "inherit" - this will double load ExtJS and other stuff on the page - 1st time by "index.html" page, 2nd time by the "preload" option. Try commenting this line: `preload: 'inherit',` in the "Tests application" group?

Post by abenhamdine »

Ahhhh yes you're right...
Thx a lot, the test now runs perfectly, with just a single click action at the moment.

Thx again for your responsiveness.

Post by nickolay »

Yw :)

Post Reply