Get help with testing, discuss unit testing strategies etc.


Post by Bhavana Kunjal »

Hi Team,

we are using Siesta for automating our application.
Off-late we are facing some maintenance problems in the scripts. Your help would be appreciated.

1. We are facing some challenges in the execution of the scripts because of the usage of offsets:[x,y],
Tests are getting failed because of the usage of co-ordinates, especially for drag operations.

 Is there any way we can avoid using offsets for double click, drag and selecting from drop down operations in Siesta?

 Is there any way we can write our scripts (by finding out locators) by ourselves instead of recording,
For ex: Getting locators like ID, name etc from DOM and use them in click, drag, operations?

 How does click, drag APIs work in Siesta?

2. Do we have anything equivalent to ‘finally’ block in Siesta ? So that we can do logout and other operations inside .


Following is the piece of code for reference ,

t.it('Drag and create the Datastore input',function(t){

t.chain(

{ click : "#contentRegion igx-analysisview [itemId=splitPanel] igx-analysispalette igx-diagrampalette[iconCls=inputOutput] => div.igx-paletteItem-wrap:nth-child(2) img", offset : [21, 20] },

{ drag : "#contentRegion igx-analysisview [itemId=splitPanel] igx-analysispalette igx-diagrampalette[iconCls=inputOutput] => div.igx-paletteItem-wrap:nth-child(2) img", offset : [20, 20], by : [373, 54] },

{ waitFor: 2000} ,

{ dblclick : ">>#editGroupTabPanel panel[title=Group Members] igx-groupmemberselector[name=groupMembers] multiselectfield[title=Available Users] panel[title=Available Users] boundlist", offset : [83, 13] },

{ click : ">>#contentRegion igx-analysisview [itemId=splitPanel] panel [itemId=topPanel] [itemId=analysisDiagram]", offset : [94, 202.5] },


)
}
)

Thanks in advance.

Post by nickolay »

Hi,

Please always use CODE tags, when posting code. Also, its a good idea, to post different question in different posts, to narrow the discussion.

Answering your questions:
Is there any way we can avoid using offsets for double click, drag and selecting from drop down operations in Siesta?
Yes, offsets usage is optional. If offset is not provided the default value of [ '50%', '50%' ] is used, which is equivalent of center point of the target element.
Is there any way we can write our scripts (by finding out locators) by ourselves instead of recording,
For ex: Getting locators like ID, name etc from DOM and use them in click, drag, operations?
Of course you can write your scripts yourself. Just don't use recorder if you don't need it.
How does click, drag APIs work in Siesta?
Please refer to the documentation: https://www.bryntum.com/docs/siesta/#!/api
Do we have anything equivalent to ‘finally’ block in Siesta ? So that we can do logout and other operations inside .
There's a "afterEach" block, which can be asynchronous: https://www.bryntum.com/docs/siesta/#!/ ... -afterEach

Post by Bhavana Kunjal »

Thanks for the response.

I tried removing offset in the below code for double click,

{ dblclick : ">>#editGroupTabPanel panel[title=Group Members] igx-groupmemberselector[name=groupMembers] multiselectfield[title=Available Users] panel[title=Available Users] boundlist", offset : [83, 13] },

I tried giving the name of the text field instead of offset.
Ex:
{ dblclick : ">>#editGroupTabPanel panel[title=Group Members] igx-groupmemberselector[name=groupMembers] multiselectfield[title=Available Users] panel[title=Available Users] boundlist textfield[name=Alex Parks]"

It didn't work for me.

How to give DOM elements in Siesta? Is there anything like ID, Name or any locator type we can give and can do the operations like we do in Selenium ?

Can you please give the alternate way of doing following piece of code,

{ drag : "#contentRegion igx-analysisview [itemId=splitPanel] igx-analysispalette igx-diagrampalette[iconCls=inputOutput] => div.igx-paletteItem-wrap:nth-child(2) img", offset : [20, 20], by : [373, 54] },

{ dblclick : ">>#editGroupTabPanel panel[title=Group Members] igx-groupmemberselector[name=groupMembers] multiselectfield[title=Available Users] panel[title=Available Users] boundlist", offset : [83, 13] },

and also please give any sample code.

Thanks,
Bhavana

Post by mats »

Bhavana, Please always use CODE tags, when posting code.

Post by nickolay »


Post Reply