Auto Reusable Actions 14

Document created by resplin Employee on Jun 6, 2015Last modified by alfresco-archivist on Aug 31, 2016
Version 6Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

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



Test ScriptsBack to Auto Scripts






Reusable Actions


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


Changes from 1.3


There are some new actions:


  • CreateSpace
  • DSpaceActions
  • DContentActions

Some actions have been changed slightly:


  • BSSpaceActions
  • CIContentActions

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, Negative Check

Output Parameters: Result

Usage (check that the space Exists): RunAction 'BSSpaceActions', oneIteration, 'MySpace', 'Exist' ,, retValue

Usage (Click on the space to navigate into it) : RunAction 'BSSpaceActions', oneIteration, 'MySpace', 'Click' ,, retValue

Usage (click the 'View Details' action): RunAction 'BSSpaceActions', oneIteration, 'MySpace', 'View Details' ,, retValue

Usage (check that the space does not have a discussion): RunAction 'BSSpaceActions', oneIteration, 'MySpace', 'View Discussions' ,'0', retValue

What it does:

Summary

Performs the specified Space Action on the specified Space Name in the Icon View (the default 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 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.

The 'Space Action' that can be performed are:


  • Exist - check to see whether the action exists or not
  • Click - just click on the Space (to navigate into it)
  • Any of the Actions available to the Space:
    • Preview In Template
    • Cut
    • Copy
    • View Details
    • Delete
    • Start Discussion
    • View Discussion

The action passed in to be performed must match the 'alt text' of the action image, or the text of the action link. Any future actions added to Spaces will automatically be usable from this test.

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

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

The Return values for a negative test are are:

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

CIContentActions


Input Parameters: Content Item, Content Action, Negative Check

Output Parameters: Result

Usage (check that the content exists): RunAction 'CIContentActions', oneIteration, 'MyContent', 'Exist' ,, retValue

Usage (view the content) : RunAction 'CIContentActions', oneIteration, 'MyContent', 'Click' ,, retValue

Usage (click View Details): RunAction 'CIContentActions', oneIteration, 'MyContent', 'View Details' ,, retValue

Usage (check that 'Check Out' is not available): RunAction 'CIContentActions', oneIteration, 'MyContent', 'Check Out' , '0', retValue

What it does:

Summary

Performs the specified Content Action on the specified Content Item in the Icon View (the default 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 'Content Action' that can be performed are:


  • Exist - check to see whether the action exists or not
  • Click - just click on the Content (to view the content)
  • Any of the Actions available to the Content:
    • Edit
    • Check Out
    • View Details
    • Preview In Template
    • Delete
    • Update
    • Cut
    • Copy
    • Start Discussion
    • View Discussion
    • Cancel Check Out
    • Check In

The action passed in to be performed must match the 'alt text' of the action image, or the text of the action link. Any future actions added to Content will automatically be usable from this test.

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

'1' = Content found, or 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 not found or Action not performed (pass)
'0' = Content found, or Content found and Action performed (fail)

CreateSpace


Input Parameters: Space Name, Space Title, Space Description, Space Icon, Negative Check

Output Parameters: None

Usage: RunAction 'CreateSpace', oneIteration, 'TestSpace', 'I am a title', 'I am a description','space-icon-star'

Usage (negative check): RunAction 'CreateSpace', oneIteration, 'TestSpace', 'I am a title', 'I am a description' ,,'0'

What it does:

Summary

Creates a Space using the information provided

Detail

Creates a Space using the information provided. Sets the space name to the 'Space Name' parameter, the title to the 'Space Title' parameter, the description to the 'Space Description' parameter and the icon to the 'Space Icon' paremeter.
The available choices for the Space Icon are: 


  • space-icon-default
  • space-icon-star
  • space-icon-doc
  • space-icon-pen
  • space-icon-cd
  • space-icon-image

The 'Negative Check' parameter specifies whether the space creation is completed or cancelled - default is completion but specifying '0' will cancel the space creation.


DContentActions


Input Parameters: Content Action, Action To Perform, Action Check

Output Parameters: Result

Usage (check that the 'Check Out' action exists): RunAction 'DContentActions', oneIteration, 'Check Out', 'Exist'

Usage (Click the 'Create Shortcut' action): RunAction 'DContentActions', oneIteration, 'Create Shortcut', 'Click'

Usage (check that the 'Check In' action does not exist): RunAction 'DContentActions', oneIteration, 'Check In', 'Exist', '0', retValue

What it does:

Summary

Within the Document Details screen for an item of content, this will look for the 'Content Action' (e.g. Check Out) and perform the action upon it specified by 'Action To Perform' (e.g. Exist, or Click). Exist will check to see if the Action exists, and Click will click the specified Content Action. Specifying an Action Check of '0' will check that the Action does not Exist and can not be Clicked.

Detail

The test aquires the list of Actions present on the Document Details screen and attempts to match the Content Action specified to the list of Actions. If it finds a match it will perform the 'Action To Perform' on the matching Action.

The 'Content Action' that can be performed are:


  • Check Out
  • Edit
  • Update
  • Cut
  • Copy
  • Delete
  • Take Ownership
  • Manage Content Users
  • Create Shortcut
  • Preview In Template
  • Run Action
  • Start Discussion
  • View Discussion
  • Cancel Check Out
  • Check In

The 'Action To Perform' that can be performed are:


  • Exist - check to see whether the action exists or not
  • Click - click on the Action

The action passed in to be performed must match the 'text' of the action link. Any future actions added to Content will automatically be usable from this test.

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

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

The Return values for a negative test are are:

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

DSpaceActions


Input Parameters: Space Action, Action To Perform, Action Check

Output Parameters: Result

Usage (check that the 'Delete' action exists): RunAction 'DSpaceActions', oneIteration, 'Delete', 'Exist'

Usage (Click the 'Manage Space Users' action): RunAction 'DSpaceActions', oneIteration, 'Manage Space Users', 'Click'

Usage (check that the 'Take Ownership' action does not exist): RunAction 'DSpaceActions', oneIteration, 'Take Ownership', 'Exist', '0', retValue

What it does:

Summary

Within the Space Details screen for a Space, it will look for the 'Space Action' (e.g. Take Ownership) and perform the action upon it specified by 'Action To Perform' (e.g. Exist, or Click). Exist will check to see if the Action exists, and Click will click the specified Space Action. Specifying an Action Check of '0' will check that the Action does not Exist and can not be Clicked.

Detail

The test aquires the list of Actions present on the Space Details screen and attempts to match the Content Action specified to the list of Actions. If it finds a match it will perform the 'Action To Perform' on the matching Action.

The 'Space Action' that can be performed are:


  • Cut
  • Copy
  • Delete
  • Import
  • Export
  • Create Shortcut
  • Take Ownership
  • Manage Space Users
  • Manage Content Rules
  • Preview In Template
  • Run Action
  • Start Discussion
  • View Discussion

The 'Action To Perform' that can be performed are:


  • Exist - check to see whether the action exists or not
  • Click - click on the Action

The action passed in to be performed must match the 'text' of the action link. Any future actions added to Spaces will automatically be usable from this test.

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

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

The Return values for a negative test are are:

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

Outcomes