2017-10-09 56 views
0

我试图填充textfield,然后运行单击事件与Bryntum午睡测试。整个测试过程已经成功,但只有“保存”按钮不响应这个点击事件,并保持说:Ext.button的点击事件不是响应与Bryantum Siesta测试

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

如何运行单击事件与Bryntum午睡可见的按钮?

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: '[email protected]', 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 :-)'} 
     ) 
    }) 
}) 

这里是数据形和测试片段的屏幕截图。正如你会注意到以上,我用waitForCQdatatoolbar被包裹保存按钮。此外,我已经试过调用click事件byself但gaves错误,以及:Wait for button[id=button-1104] to appear并且是失败的。

按钮是已经visiable并包裹DOM元素是FORMDATA(包括标签和文本框),并datatoolbar(包括按钮)。

enter image description here

+2

你不应该依赖于你的测试自动生成的ID,因为他们可以很容易地改变。 – Alexander

+0

感谢您指示@Alexander。我会以坚实的方式重构查询。 –

回答

2

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

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

而是自动生成的ID,尽量使用工具栏的更加稳定和特定的属性,你的目标:datatoolbar[specificAttr=value]

+0

亲爱@SamuraiJack不知何故该id属性仍保持为相同--button-1104,但正如你所说,我用另一种特定的属性和现在的作品。非常感谢。 –