简体   繁体   中英

How to make selection on ExtJS Combo Box with Bryntum Siesta Test?

I've a datatable form and includes several items such as textfield , datefield and combobox . How i'll be able to make selection items with Siesta for combobox and I need to set Siesta waiting time more than 30000ms because data is loading through ajax request to combobox .

There is a snippet I've used which has been failed;

t.it('Should create a new registration', function (t) {
        t.chain(
            {click: '>> button[text=New]'},
            {waitForCQ: 'regdata[title=New Registration]'},
            {click: '>> firstnamefld[xtype=firstnamefld]'},
            {type: 'Siesta Reg', target: '>> firstnamefld[xtype=firstnamefld]'},
            {click: '>> lastnamefld[xtype=lastnamefld]'},
            {type: 'Test One', target: '>> lastnamefld[xtype=lastnamefld]'},
            {click: '>> datefld[xtype=datefld]'},
            {type: '11.10.2017', target: '>> checkinfld[xtype=checkinfld]'}, //Probably that's not correct way to choose date on datefield but it works

//Here is making ajax request to load data in combo.but Siesta isn't waiting for selection.
//I shouldn't use 'type' for this part but I couldn't find any proper property.
                {click: '>> groupcombo[xtype=groupcombo]'},
                {type: 'Group One', target: '>> groupcombo[xtype=groupcombo]'}

Its best to post such question to Siesta support forum (which is actively monitored by Bryntum devs). Questions on Stackoverflow are welcome as well, but may remain unnoticed for some time.

To set the maximum waiting time for all "waitFor" methods/actions in Siesta you can use waitForTimeout config option.

To wait for Ajax request to complete after you've clicked the "groupcombo" you can do something like:

{click: '>> groupcombo[xtype=groupcombo]'},
{
    waitFor : function () {
        if (someConditionThatIsTrueOnceAjaxRequestHasCompleted) return true
    }
},
{type: 'Group One', target: '>> groupcombo[xtype=groupcombo]'}

Note, however, that there's a potential race condition in this code (described here )

Also, note, that very often, when setting the value of some fields, you are actually verifying some other core business logic, that ties those fields together. Thus, there's no strict need to perform an actual typing/clicking, you can just set the value of the field directly:

t.chain(
    function (next) {
        t.cq1('compqueryselector1').setValue('someValue1')
        t.cq1('compqueryselector2').setValue('someValue2')
        next()
    },
    function (next) {
        t.pass(businessLogicIsCorrect(), "Business logic rules works")
        next()
    }
)

This often simplifies the test and is much faster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM