|
Introduction
This page describes an example test script for the Google Gmail application.
Unlike a
Prior Gmail Example which was based on the "old" style Gmail account,
this example is based on use of the current Gmail (early 2008).
This test scripts shown below realizes the following test plan, which realizes all of the essential steps of operating with a Gmail account:
Script Creation Process
The script was constructed by first recording from the live
application, using application mode commands when necessary.
These non-desktop-safe commands were then converted into operations
performed by one or more of the
DOM Element Manipulation/Motion commands,
using data taken from the application screen using
the
PageMap feature.
The resulting final script is entirely "desktop safe", completely self synchronizing (can run without any playback Waits), and idempotent (unless you interrupt it midway).
Performance Notes
The script typically plays back in about 30-40 secs,
without modification of the small number of Wait times.
We have run the script 100's of times in rapid succession
(using the eValid: Play > Control Playback > Run Multiple option)
with good success.
Gmail Response Time
as fast as Google's Gmail is,
there are sometimes delays in Gmail's response time
that push the total playback time upward
due to lengthly synchronization times for some of the playback steps.
That is, if you multiply all Wait times by 0.0, then you have a situation
in which a fast machine executing the test can "play ahead" of the
Gmail website response times, resulting in loss of sync.
Gmail Email Scanning
A second problem arises because of Gmail's ability to declare
email as "trash" -- a consequence of Gmail's automatic spam filtering.
This means that sometimes the email message sent by the eValid playback
process does NOT arrive
the InBox area but lands in the Trash area.
Because it is not in the InBox, it can't be deleted, and as a consequence the playback.
will fail -- correctly confirming that the sent email didn't arrive as expected.
Detailed Script Description
The solution script performs the following functions
(the steps are keyed to the actual script shown below):
To assure that the required screen has actually arrived, two SyncOnText commands are used to confirm readiness based on visible text on the page.
Here the script uses an IndexFindElement command to locate the page element with the id on which "Compose" always appears. Once found, eValid clicks on it to start the composition process.
In this passage the IndexFind commands look on the screen for the location of "To:" and "Subject:" (searching from the top of the page), and then starting from the bottom searching UP to find the TEXT AREA into which to insert the message.
This confirmation is done with two SyncOnText commands (for safety) and once the synchronization is complete, with a validation to make sure that the required text message appears on the screen.
We know "me" is present if that text appears in the subject header of one of the incoming messages. The check for is done with another IndexFindElement command to locate and then select the message (which shortly will be deleted).
As above, we locate where to click "Delete" using an IndexFindElement command.
Script
Here is the script that implements the above steps.
# (c) Copyright 2000-2012 by Software Research, Inc. # Recording made on: Microsoft Windows XP # NOTE: This script is dependent on use of eValid with IE 7.0 only. ProjectID "Motion" GroupID "Google" TestID "gmail2" LogID "AUTO" ScreenSize 1280 1024 FontSize 0 DeleteCache DeleteCookies DeleteSession # --------------------------------------------------------------------- # Step 1: Start at www.google.com, then navigate to gmail and log in... # Natural timings remain in script here. The password is encrypted. InitLink "http://www.google.com/" Wait 5016 IndexSet 0 IndexFindElement 0 DOWN "innerText" "Gmail" "" IndexFollowLink 0 "" Wait 2079 SyncOnText 0 "Username:" "" Wait 2516 IndexSet 0 IndexFindElement 0 DOWN "id" "Email" "" IndexInputValue 0 "TEXT" "evalidinc" "" "" Wait 2542 IndexFindElement 0 DOWN "id" "Passwd" "" IndexInputValue 0 "TEXT" "«p°ã®‰»" "" "" Wait 171 IndexFindElement 0 DOWN "name" "signIn" "" IndexSubmitClick 0 "" Wait 2213 SyncOnText 0 "Sign out" "number:3" Wait 2099 SyncOnText 0 "Add Contact" "number:3" Wait 1814 # --------------------------------------------------------------------- # Step 2: Find "Compose Mail" on the screen and click on it...and wait # a short time for the navigation to complete... # IndexSet 0 IndexFindElement 0 DOWN "id" ":r3" "number:3" IndexFollowLink 0 "number:3" Wait 1500 # --------------------------------------------------------------------- # Step 3: Compose the message by finding the correctly named fields # and typing data into them...Short waits between each step # assure that the JavaScript can "keep up". Note we are # sending the email to ourselves. # # Original recorded commands are shown commented out. IndexSet 0 IndexFindElement 0 DOWN "name" "to" "number:3" IndexInputValue 0 "TEXTAREA" "evalidinc@gmail.com" "" "number:3" Wait 1542 IndexSet 0 IndexFindElement 0 DOWN "name" "subject" "number:3" IndexInputValue 0 "TEXT" "Testing Gmail with eValid" "" "number:3" Wait 1560 IndexSetEnd 0 "number:3" IndexFindElement 0 UP "name" "body" "number:3" IndexInputValue 0 "TEXTAREA" "Hello folks," \ "\n\nHere is the test email that is used to demonstrate eValid operation on the " \ "\nGoogle Gmail system." \ "\n\nIn case the Google Gmail anti-spam processes send this email to the Trash rather" \ "\nthan to the InBox area, this playback will fail because there is no message to be deleted." \ "\n\nIn such case eValid will have correctly detected a failure to do a round trip " \ "\ncompose/send/receive/delete test." "" "number:3" # --------------------------------------------------------------------- # Step 4: Go ahead and send the email and get ready to wait for it... # IndexFindElement 0 DOWN "innerText" "Send" "number:3" IndexElementClick 0 "number:3" Delay 2000 # --------------------------------------------------------------------- # Step 5: Wait (synchronize) until "Your message has been # sent." appears on the screen... Wait 1719 SyncOnText 0 "View message" "number:3" Wait 1086 SyncOnText 0 "Your message has been sent." "number:3" Wait 1662 ValidateSelectedText 0 116 0 "Your message has been sent." "number:3" Wait 1534 # --------------------------------------------------------------------- # Step 6: We know it has been sent, now wait until it is received # (by ourselves)... SyncOnText 0 "Testing Gmail with eValid" "number:3" IndexSet 0 IndexFindElement 0 DOWN "innerText" "me" "number:3" IndexMove -3 IndexInputValue 0 "CHECKBOX" "on" "TRUE" "number:3" Wait 2200 # --------------------------------------------------------------------- # Step 7: It's there because we found the incoming message to "me", # so we can go ahead and delete it. IndexSet 0 IndexFindElement 0 DOWN "innerText" "Delete" "number:3" IndexElementClick 0 "number:3" Wait 1818 # --------------------------------------------------------------------- # Step 8: Finally, wait to confirm that the message has been deleted, # confirm that it's gone by the "Undo" appearing visibly on # the screen, and validate that the deletion is complete... SyncOnText 0 "Undo" "number:3" Wait 1806 ValidateSelectedText 0 116 0 "The conversation has been moved to the Tra" \ "sh." "number:3" Wait 2556 # --------------------------------------------------------------------- # Step 9: Sign out and wait (synchronize) until you're ready to sign # in again... IndexSet 0 IndexFindElement 0 DOWN "id" ":pt" "number:3" IndexFollowLink 0 "number:3" Wait 1872 SyncOnText 0 "Sign in to Gmail with your" "" # Note: Playback involves adaptive playback, so there will be Messages in the # event log and you probably will see a "Yellow screen", unless the GMAIL # application itself generated a server side internal navigation error to # document... # Script ends. |
Important Note
Playback involves adaptive playback, so there will be Messages in the
event log and you probably will see a "Yellow screen".
Unless the GMail application itself generated a server side internal navigation error to document.
The GMail process evidently uses different JavaScript passage depending on the version of the browser you are using. This script design here will only play back successfully with IE 7.0 installed on your machine. If you have IE 6.0 installed the playback may not work the same way (the underlying application is actually different, so you would expect the script to detect it and it does).