Get help with testing, discuss unit testing strategies etc.


Post by sylvainm »

Hi,
We have developped an application with ExtJS 3.4.1.
I'm trying to evaluate siesta to launch integration tests.

I have followed example included in trial distribution.
The first step is to pass login page.
var Harness = new Siesta.Harness.Browser.ExtJS();

Harness.configure({
     title: 'samples'
});

Harness.start({
    group: 'login',
    // will ignore the `preload` config
    hostPageUrl: '../../../home/',
    performSetup: false, // This is done by the app itself
    items: [
        'tests/101_login.t.js'
    ]
});
'tests/101_login.t.js'
StartTest(function (t) {

    t.chain(
        function (next) {
            t.cq1('#loginField').setValue('alacour');
            t.cq1('#passwordField').setValue('BlackJack02');
            next();
        },

        // We'd like to find a headshot icon the DOM, that's proof the main app has been launched ok
        {
            trigger: {
                tap: '>> #loginButton'
            }
        },
        function (next) {
            t.pass('Should see a detail view with map after tapping a contact');
        }
    );
});
Siesta generates errors 'ComponentQuery undefined'. ComponentQuery isn't implemented in extjs 3.4.1.

Is your product compatible with extjs 3.4.1?
If so, could you send me an example?

Thanks you.

Post by nickolay »

Hi,

In your test, you explicitly ask to use ComponentQuery: `t.cq1('#loginField').setValue('alacour');` so it of course fail (`cq1` method tries to perform a component query).

The action consisting from only "trigger" property is not valid:
{
            trigger: {
                tap: '>> #loginButton'
            }
        },
It also uses "tap" method which supposed to used for touch events simulations (should use "click" I guess).

You probably were looking for t.query() method: https://bryntum.com/docs/siesta/#!/api/S ... thod-query Check its docs, especially familiarize with the "Siesta.Test.ActionTarget" concept.

Also, if during login, there's a redirect to another page, you will need to enable the "enablePageRedirect" option. See this guide for details: https://bryntum.com/docs/siesta/#!/guide ... ge_testing

Also make sure you've downloaded the latest version of Siesta (I see you are using "hostPageUrl" which has been renamed to "pageUrl" for some time already, copy-paste from an old docs?).

Post by sylvainm »

Thank you for your help.

Have you any example for manipulating ExtJS 3.4 components?

Thank you.

Post by nickolay »

Check the /examples folder of the package - contains various examples, most of them uses ExtJS. To adapt them for ExtJS3 you will just need to avoid the component query. The recorder should work just fine.

Post Reply