|
Background
The eValid DOM index/motion algorithmic/structural testing capability makes it possible
to produce robust tests which behave independently of page specifics.
Use of the DOM Manipulation Resources leads to tests that are able to operate at a level of abstraction above that of the usual eValid command level. This example is one of a series that illustrate how this process works. Please see the Guide To Examples for the complete set.
Description of Tested Feature
This example navigates to a GMAIL account and signs in, then interacts with the "Compose mail" functionalities in a separately spawned child window and signs out.
Index/Motion Command Sequence
Here is the command sequence that achieves the result:
... IndexSet 0 IndexFindElement 0 DOWN "name" "value" "frame" IndexMove -4 IndexElementMouseDown 0 "frame" IndexElementClick 0 "frame" ... IndexFindElement 0 DOWN "name" "value" "frame" IndexFindElement 0 UP "name" "value" "frame" IndexElementClick 0 "frame ...
eValid Script
Here is the eValid script that is an actual instance of this action.
# Recording by eValid V9 # Copyright 2012 by Software Research, Inc. # Recording made on: Microsoft Windows Vista Service Pack 1 (IE 7.0.6001.18000) ProjectID "Project" GroupID "Test" TestID "example13" LogID "AUTO" InitLink "http://www.gmail.com/" Wait 2032 InputValue 0 99 "TEXT" "Email" "Email" "evalidinc" "" "" ElementFocus 0 108 "Passwd" "" "" Wait 5148 InputValue 0 108 "TEXT" "Passwd" "Passwd" "«p°ã®‰»" "" "" Wait 5647 SubmitClick 0 121 "" "signIn" "Sign in" "" NAV # DOM synchronization commands are here... SyncNotOnElementProperty 0 "innerText" "Loading evalidinc@gmail.com..." "" SyncOnText 0 "evalidinc@gmail.com" "number:3" SynOnElementProperty 0 "innerText" "Oldest »" "number:3" # Recorded command... #------------------------------------------------------------------------ #ElementDblClick 0 224 39 7 "" "Compose mail" "number:3" #Wait 4680 #------------------------------------------------------------------------ # Structural command equivalent... #------------------------------------------------------------------------ IndexSet 0 IndexFindElement 0 DOWN "innerText" "Compose mail" "number:3" IndexMove -4 IndexElementMouseDown 0 "number:3" IndexFollowLink 0 "number:3" Wait 1500 SyncOnText 0 "Subject:" "number:3" IndexFindElement 0 DOWN "innerText" "Send" "number:3" IndexFindElement 0 UP "nameProp" "cleardot.gif" "number:3" IndexElementClick 0 "number:3" #------------------------------------------------------------------------ SubFrameSet 1 "Gmail" Wait 3057 InputValue 1 72 "TEXTAREA" ":r5" "to" "" "" "number:3" Wait 2013 InputValue 1 90 "TEXT" ":r2" "subject" "testing" "" "number:3" Wait 1919 InputValue 1 131 "TEXTAREA" ":pn" "body" "hello" "" "number:3" Wait 6342 WindowClose 1 Wait 1748 FollowLink 0 97 "evalidinc@gmail.com" "https://google.com/profiles" "number:3" Wait 2422 FollowLink 0 121 "Sign out" "https://mail.google.com/mail/?logout&hl=en" "number:3" # End of script.
Download example13.evs
How It Works
This is a rather complex example.
We are working with different layers and manipulating input fields;
i.e. we locate the "Compose mail" link and click,
then we go down and find the "Send" button and go UP to click on the image to
"Open message in new window" before proceeding to fill-in the input fields.
Please note that in the GWT environment the values for the "id" attribute changes from session to session, so you must choose your test pivot points wisely.
To overcome the problems induced by the dynamic behavior of the application, i.e. instances where the orginal recorded commands no longer reference the same session, we use structural command equivalents that are more flexible.