Get help with testing, discuss unit testing strategies etc.


Post by samaro »

nickolay wrote:Siesta is a web app as well it does not know anything about your backend.

What it does: 1) creates an empty iframe 2) loads the files from "preload" in the iframe. 3) launch the tests

You need to include the same files your include in your application normally.

Ok, i knew this, but this provider is put in between the front and the back, and it indicates how they comunicate, so i have to configure it on the enviroment in order to Siesta to be able to "hit" some button and that button fire a request to the server. In order to be able to get to the server, this wrapper must be configured.

Do you have any idea how?

Post by nickolay »

Not following you. You mean your app needs some additional executable file to be running in background? Then you just launch that file when opening a test suite.

Post by samaro »

nickolay wrote:Not following you. You mean your app needs some additional executable file to be running in background? Then you just launch that file when opening a test suite.
One question that raised from your comment

If i have a web app, with front end and back end, i should run the back end (ie local enviroment), and then launch the tests right?

About the configuration, i found out that this wrapper generates the json config for the provider, i ve captured it and i ll test with that config.... as soon i have an outcome i ll post it here.

What worries me, is that there might be more "magic" that this component does, that generates any other ext.js code that must be included :/

Post by samaro »

Ok, now i managed to run harness without errors on the sanity test.

I ve been digging on the documentation, and i find it a little short.

I want to write a test of a basic login flow in order to make a demo to the people here, and if we all agree buy the standard license.

I think the test should look like


Go to home
Find user textbox and password textbox
Input data
Hit the submit button, check if redirected to main page

How do i do this? Or can you point me at least?

Post by nickolay »


Post by samaro »

Nice!

How do i specify the starting url of a test, and how do i make a redirect?

Post by nickolay »

Use the "pageUrl" config. You will also need to enable "enablePageRedirect" option

Post by samaro »

Hi!

I ve some doubts according the waitForXXX methods.

I m getting this error: TypeError: Cannot read property 'query' of undefined when running this test
StartTest(function(t) {

    t.chain(
        { 
            waitFor : 'xType', 
            args    : 'label',
            desc    : 'Should find login view on app start'
        },

        function(next) {
            t.ok();
        }
    );
})
And on my login page (which i m testing)
    var lblUserName = new Ext.form.Label({
        text: 'Usuario',
        x: 40,
        y: 20,
        cls: 'labelLogin'
    });


    var lblPassword = new Ext.form.Label({
        text: 'Contraseña',
        x: 40,
        y: 80,
        cls: 'labelLogin'
    });

    var boton = new Ext.Button({
        text: 'Ingresar',
        handler: function () { loginWindow.submit(); },
        x: 140,
        y: 200,
        width: 120,
        height: 25
    });
    var chkEsDif = new Ext.form.Checkbox({
        hidden: true,
        boxLabel: 'Es Dif',
        style: 'color:red;font-weight:bold;',
        ctCls: 'labelDifLogin'
    });

    var loginWindow = new Maer.ux.browser.FormWindow({
        id:'loginWindowCmp',
        title: 'MAER BF',
        layout: 'fit',
        constrain: true,
        width: 330,
        height: 350,
        baseCls:'login',
        formApi: { submit: Seguridad.Login },
        formItems: [lblUserName, txtUserName, lblPassword, txtPassword,lblEmpresa, cboEmpresas, boton, chkEsDif],
        formMonitorValid: false,
        formBodyStyle: "background-color:#fff;padding:0px;color:#333;",
        formLayout: 'absolute',
        draggable: false,
        style:"background-color:#2EB0E4;font-family:arial, helvetica;font-weight:bold;font-size:14px;color:white;padding:10px;",
        bbar: [{
            xtype: 'tbtext',
            text: ' © Maer Software'
        }],
...... more code



When i run the test, on the dom panel it shows up the login page correctly, and the labels (even the buttons) are displayed correctly, but arent found by the component query.

Im using ext js 3.4.

Any help here?

Post by mats »

You should not use waitForXtype with Ext JS 3, since it doesn't have Ext.ComponentQuery (which is the error you're seeing). Your tests should rely on pure CSS for Ext JS version < 4.

Post by samaro »

oh s**t.

Ok, do you have any example of how do i search by selector using siesta?

Post Reply