How to validate Sort order of list

I enter and save a value for a variable called “Name”.The saved value will be displayed in a dropdown list

  1. How can i validate whether it is created and displayed in the dropdown list
  2. Also have to check,whether it is placed in the proper sort order.

The Value entered is dynamically generated by system i cannot say in front.

The same case i have to check with normal screen also.whereas in that case it has paging i donnt know after it got created,in which page it wil get listed.(There is no search option available for this case)

I searched few but,i couldn’t make it .Kindly help me out.I will be thankful if you would help me out with sample code

You can use a text image and the imageFound() function to verify whether the item is in the list or on the page, but unless you are generating all of the other values in the list or you know what they should be, it would be difficult to validate the sort order. It’s easy for EggPlant to match text, but not easy for it to read an unknown value. You could validate that a series of known strings appeared on the page and use the coordinates where they were found to determine the sequence they appeared in.

Please note that customers with active maintenance agreements (and those in active evaluations) who need timely answers to their questions should submit them via e-mail to the support address. The forums are a community resource and while TestPlant employees generally respond to forum posts, they are not our first priority and no response is guaranteed on any timetable.

This seemed like an interesting problem, so I tried it… on the SUT, I had a text file that I looked at first letters (simplified the problem to just check for each letter of the alphabet).

I think this was interesting, not because I’d suggest doing this, but it shows what you can do with Eggplant. Script and image of what I did below. I created a text file, then used the alphabet to search a rectangle that only included the first letters. I had to adjust tolerance in order to not have an “m” show up as “n” or “r” (see tolerance:3)

the script

put imagelocation(SortOrderUL) into foo # look for image upper left of text
set mySearchRectangle to (foo,foo + (13,100))
set myAlphabet to (“a”,“b”,“c”,“d”,“e”,“f”,“g”,“h”,“i”,“j”,“k”,“l”,“m”,“n”,“o”,“p”,“q”,“r”,“s”,“t”,“u”,“v”,“w”,“x”,“y”,“z”)

repeat with each item in myAlphabet

if the number of items in (

put everyimageLocation(Text:it,SearchRectangle:mySearchRectangle,tolerance:3) into foo # > 0 then
if the number of items in foo > 0 then
insert it && item 2 of foundImageLocation() after myFound
end if

end if

now take the Y locations

end repeat
put myFound

SCRIPT OUTPUT:(a 191,g 207,m 142,s 175,w 158)

Text was


so you could check the text’s Y position and clearly say that it’s NOT sorted alphabetically, but instead its m,w,s,a,g.

Oops, sorry for the extra commented out code of

if the number of items in (

end if

I was playing around with some things and should have cleaned that out before posting.