Auto Reusable Actions 13

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Reusable Actions 13

resplin
Intermediate
0 0 3,798

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Test ScriptsBack to Auto Scripts






Reusable Actions


The script 'Alfresco 1.3 Actions' contains several QTP reusable actions that are used in the automated tests.

These are:


LoginAsAdmin


Input Parameters: URL to Alfresco

Output Parameters: none

Usage: RunAction 'LoginAsAdmin', oneIteration, 'http:<url to alfresco>'

What it does:

Summary

Loads up IE, connects to the URL passed and logs in as Admin.

Detail


  • Runs IE
    • Logs the Connection URL to the Results report
  • Navigates to the Connection URL
  • Checks the initial state of Alfresco
    • Checks to see if Alfresco has connected as Guest
    • Checks to see if the No Cookies warning is displayed
    • Logs the Guest connection check result to the Results report
    • Logs the No Cookies check result to the Results report
  • If the Guest connection test returns False (guest not connected)
    • Log in as Admin
    • Log out by clicking the Logout link (to clear the cookie)
    • Closes the Browser
    • Runs IE
    • Navigates to the Connection URL
  • Checks that Alfresco has connected as Guest (because there is no cookie any more)
    • Logs the result of the check as a Pass or Fail in the Results report
  • Checks that the Tutorial is available in the Guest home space
    • Logs the result of the check as a Pass or Fail in the Results report
  • Clicks the Login link to bring up the Login page
  • Checks to see if the No Cookies warning is displayed
    • Logs the No Cookies check result to the Results report
  • Logs in to Alfresco as Admin
    • Checks to ensure that Admin is indeed logged in

CreateTestUser


Input Parameters: None

Output Parameters: None

Usage: RunAction 'CreateTestUser', oneIteration

What it does:

Summary

Creates a User called 'Test User' with a home space of 'TestUser' and login details of username = 'Test' and password = 'User'

Detail

Assumes that Alfresco is logged in as Admin (use the LoginAsAdmin action)


  • Checks to ensure that Admin is indeed logged in
    • Logs the Admin check result to the Results report
  • Clicks the More Actions link
  • Clicks the Administration Console link
  • In the Administration Console clicks the Manage System Users link
  • In the User Management screen clicks the Create User link
  • In the Create User wizard creates the Test User with the details as above
  • Finishes the Wizard
  • Closes the User Management screen
  • Closes the Administration Console
  • Checks that the TestUser homespace has been created
    • Logs the TestUser homespace check result to the Results report

Cleanup


Input Parameters: None

Output Parameters: None

Usage: RunAction 'Cleanup', oneIteration

What it does:

Summary

Removes the Test User and deletes their Home Space.

Detail


  • Checks to see if the Test User is logged in
    • Logs the check result to the Results report
    • If the Test User is logged in, log them out and log in as Admin
    • Otherwise assume Admin is logged in
  • As Admin, load the Administration Console
  • In the Administration Console clicks the Manage System Users link
  • In the User Management screen clicks the Show All link to display all the users
  • Clicks the Delete link for the Test User
    • Checks on the Delete Confirmatiuon screen that the Test User is the user to be deleted
    • If the check returns true:
      • Delete the user
      • Close the User Management screen
      • Close the Administration Console
      • Click the Delete link for the TestUser space
      • Checks on the Delete Confirmatiuon screen that the TestUser space is the Space to be deleted
      • If the check returns true:
        • Click the Yes button to confirm the deletion of the space
      • If the check returns false:
        • Logs a fail on the check to the Results report
        • Click the No button to cancel the deletion of the space
    • If the check does not return true:
      • Logs a fail on the check to the Results report
      • Click the No button to cancel the deletion of the user
      • Close the User Management screen
      • Close the Administration Console

ClipboardActions


Input Parameters: Item Name, Clipboard action

Output Parameters: None

Usage: RunAction 'ClipboardActions', oneIteration, 'CopySpace', 'Paste Item'

What it does:

Summary

Locates the Item in the Clipboard that matches the passed in Item Name and clicks on the matching Clipboard action for that item. E.g, using above example, finds the Item called 'CopySpace' and clicks the 'Paste Item' action.

Detail


  • Get the Row in the Clipboard that contains the item that matches the passed in Item Name
  • If the Row is '-1' (the item was not found in the Clipboard)
    • Log a fail on the Item in the Results report
  • Otherwise (item was found in the Clipboard)
    • Log a Pass on the Item in the Results report
    • Get the number of columns for the matching row (currently the actions are in the last column)
    • Get the list of Images in the matching row's last column (the clipboard actions are all clickable images)
    • Itterate through the images checking for a match between the Image's ALT text and the passed in Clipboard Action
      • On a match, click the matching Image

BSSpaceActions


Input Parameters: Space Name, Space Action

Output Parameters: Result

Usage: RunAction 'BSSpaceActions', oneIteration, 'MySpace', 'View Details' , retValue

What it does:

Summary

Performs the specified Space Action on the specified Space Name in the Browse View, and returns the Result. The action will attempt to find the specified Space Name on the page and if it can't be found it will navigate to the next page (if there are any) until it either finds the Space Name or get's to the end of the spaces.

E.g click the View Details action on the space MySpace.

Detail

This action uses descriptive programming to locate the Space. The reason behind this is that the Actions for spaces are identifiable (e.g. 'View Details'), but they are not unique - there is one for every space shown in the Browse Spaces display.

However, the Spaces and their Actions are all contained within their own WebTable within the Browse Spaces table.

See this image for an example:

Company_Home.jpg

So, if we want to perform an action on the CutSpace we are interested in working on the WebTable that contains the CutSpace space.

Space_WebTable.jpg

The WebTable is named after the Space it is for, so for the above example the WebTable is called 'CutSpace'. So, we can find this WebTable knowing the Space Name we are looking for, without it having to reside in the Object Repository.

Once we have located the correct WebTable, to perform an action on it we need to get some details about the Cells that are in the WebTable, namely the Cell that contains the Actions. As you can see from the image below, the Actions are contained in the Cell that is in the last Row (can be Row 3 or Row 4 if the Space has a Description) and the last Column (currently always column 2).

Space_Cells_WebTable.jpg

With this information, we can get the list of Images in the Cell that contains the Actions. The Images all have defined ALT text that matches the Action, so we can just itterate through the Images until we find one whose ALT text matches the required Space Action and Click on it.

Space_Image_ALT_text.jpg

However, the Actions contained in the More dropdown menu are all Links with associated Images, but the Images are not Clickable - only the Links are. So, if we have got to the More menu Image before we have found the Action we want to perform, the More menu is opened and then the list of Links are obtained.
These Links are again named after the Action they are for, so these are itterated through until a match is found and this is Clicked on.

Space_Image_More_Link.jpg

If no match is found an error is logged in the test results.

The Return values are:

'1' = Space found and Action performed
'0' = Space not found or Action not performed

This action checks at the start to ensure that the Browse Space view is on the first page of Spaces, and if not navigates back to the first page.


CIContentActions


Input Parameters: Content Item, Content Action, Negative Check

Output Parameters: Result

Usage: RunAction 'CIContentActions', oneIteration, 'MyContent', 'View Details' ,, retValue

Usage (negative check): RunAction 'CIContentActions', oneIteration, 'MyContent', 'Check Out' , '0', retValue

What it does:

Summary

Performs the specified Content Action on the specified Content Item in the Browse View, and returns the Result.
The action will attempt to find the specified Content Item on the page and if it can't be found it will navigate to the next page (if there are any) until it either finds the Content Item or get's to the end of the spaces. If it detects that it isn't starting its search on the first page it will navigate to the first page before it starts looking for the Content Item.

If a Negative check is performed it will return a pass if either the Content Item or the requested Action is NOT found (e.g. so that Locked documents can be checked to ensure they do not have the Actions that a non-locked document will have such as 'check out', or to check that the 'Working Copy' no longer exists after a 'Check In')

E.g click the Check Out action on the Content Item 'MyContent'.

Detail

This action uses the descriptive programming techniques described in the 'BSSpaceActions' reusable action.

The Return values for a normal (positive) test are:

'1' = Content found and Action performed (pass)
'0' = Content not found or Action not performed (fail)

The Return values for a negative test are are:

'1' = Content found and Action performed (fail)
'0' = Content not found or Action not performed (pass)