Ext.button的点击事件不适用于Bryntum Siesta Test

时间:2017-10-09 16:25:52

标签: testing extjs click sencha-cmd siesta

我尝试填充textfield,然后使用Bryntum Siesta Test运行点击事件。整个测试过程已成功,但只有'保存'按钮不响应此点击事件并保持说:

Waited too long for: componentQuery "datatoolbar[id=datatoolbar-1100]"
Failed assertion `waitForComponentQuery` 
Condition was not fullfilled during 10000ms

如何使用Bryntum Siesta为可见按钮运行click事件?

Test.js

describe('Testing Update Process', function (t) {
    t.it('Should to login with correct creds.', function (t) {
        t.chain(
            {waitForCQ: 'window[title=Login]'},
            {click: '>> textfield[itemId=userName]'},
            {type: 'user@name.com', target:'>> textfield[itemId=userName]'},
            {click: '>> textfield[name=password]'},
            {type: 'superSecretPass', target:'>> textfield[name=password]'},
            {click: '>> button[text=Submit]', desc: 'Submit process is succeed!'}
        )
    })

    t.it('Login window should be invisible', function (t) {
        t.chain(
            {waitForCQNotVisible: 'window[title=Login]', desc: 'Login window is hidden now!'}
        )
    })

    t.it('Should open Folio grid', function (t) {
        t.chain(
            {waitForCQ: 'treelist[itemId=navigationTreeList]', desc: 'Wait for treelist'},
            {click: '>> treelistitem[id=ext-treelistitem-6]', desc: 'Clicks Folio item'},
            {waitForCQ: 'treelistitem[id=ext-treelistitem-7]', desc: 'Wait for treelist sub-item: Folios'},
            {click: '>> treelistitem[id=ext-treelistitem-7]', desc: 'Clicks Folios'}
        )
    })

    t.it('Should click on Edit button', function (t) {
        t.chain(
            {waitForCQ: 'gridview[id=gridview-1067]'},
            {click: '>> button[id=button-1087]', desc: 'Clicks on Edit button'}
        )
    })

    t.it('Should update Client Name', function (t) {
        t.chain(
            {click: '>> textfield[name=clientname]'},
            {type: 'Siesta Testing for Update', target: '>> textfield[name=clientname]', desc: 'Types lorem ipsum data'}
        )
    })

    //This last part is giving error and test becomes failure.
    t.it('Should Save the last changes', function (t) {
        t.chain(
            {waitForCQ: 'datatoolbar[id=datatoolbar-1100]'},
            {click: '>> button[id=button-1104]', desc: 'Clicks on Save, All Succeed :-)'}
        )
    })
})

以下是dataform和测试片段的屏幕截图。正如您将在上面注意到的那样,我已将waitForCQ用于datatoolbar,其中包含保存按钮。此外,我已尝试自己调用点击事件,但它也会出现错误:Wait for button[id=button-1104] to appear并且失败。

按钮已经可见,包裹的DOM元素是formdata(包括标签和文本字段)和datatoolbar(包括按钮)。

enter image description here

1 个答案:

答案 0 :(得分:2)

正如评论中已经提到的,原因可能只是一个不稳定的查询(因为它使用自动生成的ID)。

错误消息 Waited too long for: componentQuery "datatoolbar[id=datatoolbar-1100]" 表示Siesta正在运行指定的组件查询,但没有返回结果。

尝试使用您定位的工具栏的更稳定和特定的属性,而不是自动生成的ID:datatoolbar[specificAttr=value]