Adding user actions in a test from smartshots

When you want to add user actions as steps in an existing Web UI test, you can add such steps from smartshots associated with the test. You can select a graphical element in the smartshot and add a user action for that element.

Before you begin

You must have completed the following tasks:
  • Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
  • Read and understood the information in Edit branch overview and Create or select an Edit branch.
  • Ensured that your project contains a Web UI test.

About this task

The Test Editor page displays a hierarchical view of the steps in a test. The step details pane displays the object properties with the associated smartshot. You can add a step as a node and add further actions as sub-steps by selecting any of the widgets in the Smartshot view.

Procedure

  1. Click the Edit button displayed on the Test Editor page.

    The Edit button appears only when no active edit branch is selected.

    Alternatively, right-click the test in the test navigator panel and select Edit.

    The Edit branch dialog is displayed.
    If the Edit branch dialog is not displayed, then go to step 3.
  2. Select an existing branch or create a new branch.
  3. Drag and drop one of the following element from the UI catalog in the Catalog tab after the required step.
    • Verify
    • Assign
    • Click
    • Type
    • Select
    A test step is added.
  4. Click the newly added step.
    The step details pane is displayed.
  5. Select one of the panes and perform the following actions:
    Name of the pane Action
    Smartshot Hover over a UI element in the Smartshot view, right-click, and then select one of the following options:
    • Use this element as a step target
    • Create user action for this element: Click, Select, Type, Verify, Assign
    Alternatively, you can drag and drop a UI element from the Smartshot view to the Object Identified By section.
    Elements Perform the following actions:
    1. Expand the list of elements in Elements.
    2. Select an element, right-click, and then select one of the following options:
      • Use this element as a step target
      • Create user action for this element: Click, Select, Type, Verify, Assign
    Properties Perform the following actions:
    1. Click any of the UI elements in the Smartshot view.
    2. Select a property from the Properties list, right-click, and then select one of the following options:
      • Add property to step target
      • Create user action with this property: Click, Select, Type, Verify, Assign

      If the target object is already defined, then you can use the Replace property in step target option to replace the identifier.

    If you selected the Use this element as a step target option, the action or condition is assigned to the selected element. Else, if you selected the Create user action for this element option with one of the listed actions, a step is added just before the selected step.

    The step details pane is displayed with the Smartshot, UI Object type, Action, and Object Identified By details. The values displayed are dependent on the object selected.

    Alternatively, you can select the Code checkbox, and then enter a JavaScript code that returns the target object for the selected action.

  6. Optional: Click the Click here to add relative to link, specify the relative location in the Location field, and then specify the relative object in the UI Object field.
  7. Optional: Click the Click here to add alternative identifier link, and select a target object from the list in the Target 2 field.
  8. Click the Save icon to save the modifications.

Results

You have added user actions as steps from smartshots in a Web UI test.

What to do next

You can perform the following tasks: