Functional Test With ExtJS 6

元气小坏坏 提交于 2019-12-13 19:13:33

问题


I'm using HP UFT for functional tests.

Because of dynamic id definition of ExtJS, I can't use UFT Recording feature.

I've tried many ways for assigning dynamic IDs to staticly.

I tried to change id: function() in ext-all-debug.js file.
I tried to change Components getId() function in ext-all-debug.js file.
I tried override components with afterRender method to change ids aswell.

Sometimes I achieved to change id's using component's properties (text, fieldLabel, overflowText, etc.), but for some components I couldn't achieve to assign ID's since the components properties seem empty.

Above, I listed my actions to assign static ID. So, I want to know your opinions about my actions and if you found them incorrect or not sufficient, could you offer me new approaches for using HP UFT recording feature with ExtJS6.


回答1:


You can't change the dynamic id of the dom elements which represents ExtJS components. That's really bad thing and I think you would break the whole app.

The easiest way to test ExtJS app is to use already created frameworks/tools like:

Siesta by Bryntum
Sencha Test by Sencha

The Siesta is free. It has some pro features which requires the license. But you can use it for free.

If you still insists on doing it your way. You need to dynamically get the IDs of the dom elements created by ExtJS components. Basically write your own API.
You need to execute the ExtJS JS code, which will return you the ID of the component. So you need to get the ExtJS component and call getId() function on it to get the dom id.

Here is the example code:

>Ext.ComponentQuery.query('checkbox')[0].getId()
"checkbox-1047"

You will definetely need: http://docs.sencha.com/extjs/6.5.3/modern/Ext.ComponentQuery.html#method-query And keep in mind that the query can be pretty advanced and you can use all the configs which are set on the ExtJS elements such as name, xtype, etc

You can find some other info in my other anwser https://stackoverflow.com/a/41718879/1768843



来源:https://stackoverflow.com/questions/49104817/functional-test-with-extjs-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!