Skip to content

Latest commit

 

History

History
138 lines (116 loc) · 5.54 KB

readme.md

File metadata and controls

138 lines (116 loc) · 5.54 KB

YTI robot automation tests

Test automation repository for all yti projects. Root contains tests for v2 of yti project UI and legacy older versions. Currently only terminology has v2.

Setup virtual environment

To setup virtual environment run the following commands.

python -m venv env
. ./env/bin/activate

Install dependencies

Install required libraries for running tests

pip install -r requirements.txt

Download and install chromedriver. Or on Linux, you can just install it from your package manager.

sudo apt-get install chromium-chromedriver

Configure environment variables

Copy .env.dist to .env and set values to secrets.

Folder structure

Tests folder


Tests resouce folder


Legacy test folder


Environment URLS for V2

Robot framework run command

  • Build docker with dockerfile
    docker build -t yti-robot-tests:latest .
    

  • run all tests on headless

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values.
    python -m robot.run -v BROWSER:headlesschrome -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -v ENVIRONMENT:dev -d test_reports tests
    

    or

    ./run_tests.sh headless
    

    or

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values. %CD%, . or absolute path on -v.
    docker run -it --rm -v "%CD%:/robot_tests/" yti-robot-tests:latest /bin/bash -c "/usr/bin/Xvfb :0 -screen 0 1920x1080x24& python3 -m robot.run -v BROWSER:headlesschrome -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -v ENVIRONMENT:dev -d test_reports tests"
    

  • run all tests without headless, record video and highlight element

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values.
    python -m robot.run -v BROWSER:chrome -v RECORD:True -v HIGHLIGHT_ELEMENT:True -v ENVIRONMENT:dev -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -d test_reports tests
    

    or

    ./run_tests.sh record
    

    or

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values. %CD%, . or absolute path on -v.
    docker run -it --rm -v "%CD%:/robot_tests/" yti-robot-tests:latest /bin/bash -c "/usr/bin/Xvfb :0 -screen 0 1920x1080x24& python3 -m robot.run -v BROWSER:chrome -v RECORD:True -v HIGHLIGHT_ELEMENT:True -v ENVIRONMENT:dev -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -d test_reports tests"  
    

  • run single test in the suite

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values.
    python -m robot.run -v BROWSER:chrome -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -v ENVIRONMENT:dev -d test_reports -t "T1C2. Select first terminology on search page" tests
    

    or

    ./run_tests.sh single <testname>
    

    or

    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values. %CD%, . or absolute path on -v.
    docker run -it --rm -v "%CD%:/robot_tests/" yti-robot-tests:latest /bin/bash -c "/usr/bin/Xvfb :0 -screen 0 1920x1080x24& python3 -m robot.run -v BROWSER:chrome -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-KEY% -v ENVIRONMENT:dev -d test_reports -t 'T1C2. Select first terminology on search page' tests"
    

  • run legacy tests
    # Replace %YTI-API-KEY%, %YTI-EDUUNI-PASSWORD% with wanted values. %CD%, . or absolute path on -v.
    docker run -it --rm -v "%CD%:/robot_tests/" yti-robot-tests:latest /bin/bash -c "/usr/bin/Xvfb :0 -screen 0 1920x1080x24& cd legacy/yti-groupmanagement-robot && python3 -m robot.run -v EDUUNI_EMAIL_PASSWORD:%YTI-EDUUNI-PASSWORD% -v API_KEY:%YTI-API-key% -v BROWSER:chrome-local -v CHROME_DRIVER_PATH:chromedriver -v SELENIUM_SPEED:0.2 -d test_reports --include regression tests"