WI-OC-054 - Selenium Automation Project

This KB page contains all of the details of the automation project.

Purpose

  1. Describe the methods of using the automation program.

Responsibilities

  1. Application Administrator
    1. Tests should be run in DEV environment
    2. These programs SHOULD NOT be used in a production system 

Instructions

  1. Requirements:
    1. For downloading the software, with the exception of the python packages, you will need to set up a meeting with DoIT to help install software.
    2. Need to have an IDE installed
      1. Visual Studio Code is an excellent choice (https://code.visualstudio.com/download)
    3. Need to have the most recent version of python installed (https://www.python.org/)
    4. If you are planning on doing software development you will also need to install GIT
      1. If you are just doing testing scripts then share the scripts with someone who can upload information to the project and they can add it to the scripts document.
    5. Need to have the browsers (Chrome and Firefox) up to date
      1. This can be done by finding the help menu for Chrome and then "About Google Chrome"
        1. From there you can update and relaunch chrome
      2. For Firefox this can also be done by finding the help menu and then selecting "About Firefox"
        1. From there you can relaunch and update Firefox
    6. Need to have access to project 'OnCore Testing Automation Project' in Doit GitLab
    7. Need to have several python packages installed
      1. How to install python packages (https://packaging.python.org/en/latest/tutorials/installing-packages/
      2. Packages to install
        1. Selenium (https://pypi.org/project/selenium/)
        2. Webdriver-manager (https://pypi.org/project/webdriver-manager/)
        3. pyyaml (https://pypi.org/project/PyYAML/)
        4. pytest (https://pypi.org/project/pytest/)
  2. Type of file to use
    1. Currently only using yaml files for the script records
  3. Structure of a document for automation
    1. Uses the following keywords:
      • case:
        • Details of the test case written
      • loop:
        • 'true' or 'false' 
      • driver:
        • 'new' or 'continue'
      • errors:
        • Uses the following keys:
          • permitted:
          • scope:
      • steps:
        • Uses the following keys:
          • comment:
          • action:
          • element:
  4. Structure of errors:
    1. permitted:
      • Provide an integer value of 0 or greater. This is the number of errors it takes for the script to no longer attempt any steps in a single yaml document
    2. scope:
      • Currently non-functional. Should just enter 'global'
  5. Structure of steps
    1. comment:
      • The comment describing what is done in each step
    2. action:
      • The details of the step being performed
    3. element:
      • The details of the element being interacted with for specific action types
    4. They are set up as a list. You specify a position in a list with a hyphen: -
    5. Under each step should be at least a comment and an action, an element is optional depending on the action
    6. It ends up looking like this if all 3 components are present:
      • steps:
          -  comment: This is a comment
             element:
                  type: xpath
                  value: //a[contains(text(),'Edit')]
             action:
                  type: input
                  specifications:
                       type: click
          -  comment...
  6. Structure of Element
    1. uses the following keywords:
      • type:
        • This is the method that is used in locating the element
        • These are the keyword options:
          • id
          • name
          • xpath
          • link_text
          • partial_link_text
          • tag_name
          • class_name
          • css_selector
      • value:
        • This is the value that will be used in searching for the element
  7. Structure of Action
    1. Uses the following keywords:
      • type:
        • This is the type of action to be performed
      • specifications:
        • This contains the details of how the action will be performed
  8. Structure of Specifications nested under actions
    1. Uses the following keywords:
      1. type
        1. If there is further details needed to specify the type of action this field is used
      2. value
        1. If a value needs to be provided this field is typically provided
        2. For example free text if you are entering text into a form, or a number for the wait timer
  9. Types of actions and their information:
    1. action_chain
      • Description: A type of action where you list a series of steps that are queued up and then performed
      • The structure of an action chain action
        • type:
          • always 'action_chain'
        • specifications:
          • will only use the key 'value' and never use 'type' as a key
          • The key 'value' will have a list nested under it
          • value:
            • Has a list nested under it
            • Each list item will always have the keys 'type' and value'
            • type:
              • This is where you specify what type of action to use in the action chain
            • value: 
              • This is where you specify the details of that action
          • Please jump to the next number to see details of the types and values of actions in action_chains.
    2. alerts
      • Description: A type of action that interacts with alerts (similar to a popup but alerts are a part of the original web-page)
        • type:
          • always 'alert'
        • specifications:
          • Must have a key of 'type' but does require a key of 'value'
          • type:
            • can be 'accept' which indicates you are accepting the warning
            • can be 'dismiss' which means you will dismiss the warning
            • can be 'alert_warning' which means you will validate the text present within the alert, you will still need to accept or dismiss it after verifying the text present
          • value:
            • Only used with 'alert_warning' and you should put all or a piece of the exact text you are expecting to see in the pop up. If there is not an exact match present somewhere in the popup this step will fail
    3. browser
      • Description: Opens a browser of a specific type
        • type:
          • always 'browser'
        • specifications:
          • Must have a key of 'type', does not have a key of 'value'
          • type:
            • Can be 'chrome' which will use a chrome browser instance
            • Can be 'firefox' which will use a firefox browser instance
    4. input
      • Description: Inputs information into the web-page
        • type:
          • always use 'input'
        • specifications:
          • Must have a key of 'type', sometimes has a key of 'value'
          • type:
            • Here the options are:
              • text, click, enter, escape, delete, backspace, tab, arrow_down, arrow_right, arrow_left, arrow_up
            • With the exception of text, it inputs the key (or click) that is specified
          • value:
            • A value is only given if your type of input is 'text'
            • You should put the text you would like entered, exactly as you would like it entered.
      • Special cases
        • If a value of '___random_mrn___' is used then a random number between 20,000 and 99,999 will be generated and used for the string.
    5. quit
      • Description: Closes out the open browser
        • type:
          • Always use 'quit'
        • specifications:
          • Specifications are not needed for this action
    6. scan
      • Description: Searches over the HTML of the web-page for specific text 
        • type:
          • Always use 'scan'
        • specifications:
          • Will only have a key of 'value', do not use 'type' here
          • value:
            • Enter the exact text you would like found on the page separated by commas if there is more than one piece of text you would like to check for.
    7. select
      • Description: Interacts with drop down menus on a web-page
        • type:
          • Always use 'select'
        • specifications:
          • Will always have both the keys of 'type' and of 'value'
          • type:
            • The options are: index, text, and value
            • This indicates what identifier you will use for the selection in the drop down you are attempting to select
          • value:
            • Here you should put the exact text or number you are matching on to select your drop down option
    8. verify
      • Description: Similar to scan, but searches for text at a specific location on the page. Recommend using scan unless there is a special case.
      • Don't use this yet.
    9. wait
      • Description: Has the automation wait a specified number of seconds
        • type:
          • Always use 'wait'
        • specifications:
          • Will only have a key of 'value' and not of 'type'
          • value:
            • Put an integer value
            • This will be the amount of time in seconds that no actions will be taken.
    10. website
      • Description: Navigates the web-page to a specific website
        • type:
          • Always use 'website'
        • specifications:
          • Will only have a key of 'value' and not of 'type'
          • value:
            • Enter the full exact URL of the web-page you would like to navigate to, including https://...
    11. windows
      • Description: Can be used to switch between the main browser window and a pop-up window (different from an alert that is part of the main page)
        • type:
          • Always use 'window'
        • specifications:
          • Only has a key of 'type' and not of 'value'
          • type:
            • The options are: popup and main
            • After a popup has been created and you would like to interact with it, use a type of popup
            • After you are done interacting with the popup and would like to interact with the main window, you can use a type of main
      • Details: 
        • This does not automatically close the popup window, just changes what page you are interacting with
        • Even if you close the popup window, you still need to always manually change back to the main window
  10. Action Chains value details

Additional Information Documentation

  1. Brian's Test Protocols (*Any bold indicates that it still needs automated)
    • These protocols should use the protocol creation test for their setting broadly 
    • Protocol No: 234657
      • Title: BRIANS PERSONAL TEST PROTOCOL DO NOT USE
      • Staff:
        • Protocol Creator: TesterBTD, Selenium
      • Needed for tests:
        • Almost all of them
    • Protocol No: 234654
      • Title: Another Test Protocol - BRIANs
      • Staff:
        • Data Coordinator: Davidson, Brian
        • Primary Study Coordinator: Boysen, Erin
        • Principal Investigator: Boysen, Erin
        • Protocol Creator: TesterBTD, Selenium
        • Study Coordinator: Buehler, Marc
      • Status: Get the status to Open to accrual
      • Institution: UW - Madison
      • Treatment Arms:
        • Step Code: '26'
        • Arm Code: 'TestingArm'
        • Arm Description: 'SeleniumTesting'
      • Subjects:
        • 1 subject enrolled on the protocol, but not on a treatment arm
      • Documents:
        • 1 document named TestDocumentUpload.docx with a description of 'Main Study Consent' under the initial IRB Review that is released
        • 1 document named Test_Document_Upload.docx with a description of 'Main Protocol Document' under the documents tab
      • Calendar/Financials/Sponsor
        • Protocol needs one sponsor
        • Protocol needs a calendar with one procedure on a day on it
        • Protocol financial console needs to have that one procedure select the sponsor as it's sponsor
        • Protocol calendar needs to be released
      • Coding Scheme:
        • CTCAE v5.0
      • Includes Specimen Banking:
        • Checked
      • Needed for tests:
        • GEN-CP-040
        • GEN-CP-050
        • GEN-CP-051
        • GEN-CP-052
        • GEN-AD-001
        • GEN-AD-1.2
  2. Testing Information
    • Sponsor: A_Testing_Sponsor
      • Fun: 246
      • Acct: 135
      • PI: Boysen, Erin
      • Department: CALS - Bacteriology
  3. Tests requiring local files configured with path
    • GEN-CP-038
    • GEN-CP-039
    • GEN-AS-011
    • GEN-AD-2.7
  4. Special Scripts
    • BSM-STOR-001
      • Script must be updated after each run (increment counter by 1 where indicated)
    • BSM-STOR-002
      • Script must be updated after each run (increment counter by 1 where indicated)
    • BSM-STOR-003
      • Script must be updated after each run (increment counter by 1 where indicated)
  5. Deprecated Tests:
    1. GEN-CP-049 (This feature has been changed and this test no longer applies)
    2. GEN-CP-053 (The blue hyperlink no longer appears to change version. And if there is anyone with toxicity details in an SAE, then the update cannot occur.)

Document History

Document History
Reviewed Date Change Reason Approver
11/16/2023 New Brian Davidson

Related Documents

  • Link to SOPs
  • Link to Controlled Documents


KeywordsSelenium Automation Python   Doc ID132781
OwnerBrian D.GroupSMPH Research Informatics
Created2023-11-14 14:20:45Updated2024-02-22 10:08:39
SitesSMPH Research Informatics , SMPH Research Informatics TEST
Feedback  0   0