├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENCE.txt ├── README.md ├── robotframework ├── Dockerfile ├── requirements.txt ├── run-rf-tests.sh └── run.sh └── tests ├── ChromeConfiguration.py ├── bing.robot └── google.robot /.gitignore: -------------------------------------------------------------------------------- 1 | logs/* 2 | *.ipr 3 | *.iws 4 | 5 | # Compiled source # 6 | ################### 7 | *.com 8 | *.class 9 | *.dll 10 | *.exe 11 | *.o 12 | *.so 13 | 14 | # Packages # 15 | ############ 16 | # it's better to unpack these files and commit the raw source 17 | # git has its own built in compression methods 18 | *.7z 19 | *.dmg 20 | *.gz 21 | *.iso 22 | *.rar 23 | *.tar 24 | *.zip 25 | 26 | # Logs and databases # 27 | ###################### 28 | *.log 29 | *.sqlite 30 | 31 | # OS generated files # 32 | ###################### 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db 40 | 41 | # Node # 42 | ######## 43 | 44 | lib-cov 45 | *.seed 46 | *.log 47 | *.csv 48 | *.dat 49 | *.out 50 | *.pid 51 | *.gz 52 | npm-debug.log 53 | node_modules 54 | 55 | # Scala # 56 | ######### 57 | *.class 58 | *.log 59 | dist/* 60 | target/ 61 | lib_managed/ 62 | src_managed/ 63 | project/boot/ 64 | project/plugins/project/ 65 | .scala_dependencies 66 | 67 | 68 | # Puppet & Vagrant # 69 | #################### 70 | .tmp/ 71 | modules/ 72 | Gemfile.lock 73 | *.swp 74 | .vagrant 75 | puppet/ 76 | 77 | # Generated files 78 | .lein-env 79 | .idea/ 80 | .lein-failures 81 | .lein-plugins/ 82 | .lein-repl-history 83 | .lein-deps-sum 84 | 85 | # Clojure 86 | test/user.clj 87 | boot2docker.vmdk 88 | pom.xml 89 | *.iml 90 | .nrepl-port 91 | resources/public 92 | 93 | docker/neo4j/dev-data 94 | lib/ 95 | bin/ 96 | .settings/ 97 | .project 98 | .classpath 99 | logs/ 100 | 101 | .tf 102 | 103 | aws/ 104 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at teemu.matilainen@reaktor.fi. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /LICENCE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Yleisradio Oy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dockerfiles for running ui-tests in robotframework 2 | 3 | Inspired by https://github.com/danielwhatmuff/robot-docker 4 | 5 | This Dockerfile is designed to make it easier to run robot framework based UI-tests on CI environments. 6 | 7 | It includes the ability to run tests sequentially with pybot or parallel with pabot 8 | 9 | User needs to mount tests from host to docker image and set required environment variables. 10 | 11 | ## Usage 12 | 13 | Project includes two simple tests in tests directory, which also show how chromedriver can be configured to be used with SeleniumLibrary. 14 | 15 | Run tests with pybot, passing only mandatory environment variables ROBOT_TESTS and ROBOT_LOGS 16 | 17 | `` 18 | docker run --rm -e ROBOT_TESTS=/tests/ -e ROBOT_LOGS=/tests/logs/ -v $(pwd)/tests:/tests/ -ti yleisradio/docker-robotframework 19 | `` 20 | 21 | Use tags to select only certain tests 22 | 23 | `` 24 | docker run --rm -e ROBOT_TESTS=/tests/ -e ROBOT_LOGS=/tests/logs/ -e ROBOT_ITAG=google -v $(pwd)/tests:/tests/ -ti yleisradio/docker-robotframework 25 | `` 26 | 27 | Run tests with pabot (2 processes without locks and 15 processes with locks): 28 | 29 | `` 30 | docker run --rm -e ROBOT_MODE=pabot -e ROBOT_TESTS=/tests/ -e ROBOT_LOGS=/tests/logs/ -e LOG_LEVEL=DEBUG -v $(pwd)/tests:/tests/ -ti yleisradio/docker-robotframework 31 | `` 32 | 33 | `` 34 | docker run --rm -e ROBOT_MODE=pabot -e PABOT_LIB=pabotlib -e PABOT_RES=/tests/conf/list_for_pabot.dat -e ROBOT_TESTS=/tests/tests -e ROBOT_LOGS=/tests/logs/ -e PABOT_PROC=15 --shm-size 6g -v $(pwd):/tests -ti yleisradio/docker-robotframework 35 | `` 36 | 37 | Mandatory environment variables: 38 | 39 | - ROBOT_TESTS = directory inside the container where tests are mounted / bound to 40 | - ROBOT_LOGS = directory inside the container where logs will be written to 41 | 42 | Optional environment variables: 43 | 44 | - ROBOT_MODE= pabot runs tests in parallel mode with pabot 45 | - PABOT_LIB= indicates that pabot library is used 46 | - PABOT_RES= resource file which contain value sets needed with locks 47 | - PABOT_PROC= number of processes pabot should use 48 | - ROBOT_VAR = variablefile used when running the test(s). ( passed as --variablefile to pybot/pabot ) 49 | - ROBOT_ITAG = tags to be included in the test run ( passed as -i to pybot ) 50 | - ROBOT_ETAG = tags to be excluded from the test run ( passed as -e to pybot ) 51 | - ROBOT_TEST = test to be run ( passed as -t to pybot ) 52 | - ROBOT_SUITE = suite to be run ( passed as -s to pybot ) 53 | - RES = resolution used in Xvfb when using browser tests 54 | 55 | Note that PABOT_LIB and PABOT_RES must be right after the ROBOT_MODE (otherwise the value set file is not found) 56 | 57 | ### Build image locally 58 | 59 | If you do changes to the image, you can test local version by building your own image: 60 | 61 | ``` 62 | cd robotframework 63 | docker build -t docker-robotframework . 64 | ``` 65 | 66 | ## Contributing 67 | 68 | Bug reports and pull requests are welcome on GitHub at https://github.com/Yleisradio/docker-robotframework. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. 69 | 70 | ## License 71 | 72 | The Dockerfile is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 73 | -------------------------------------------------------------------------------- /robotframework/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | LABEL description="Docker image for the Robot Framework http://robotframework.org/ modified for Yleisradio use cases" 4 | LABEL usage=" " 5 | 6 | # Set timezone to Europe/Helsinki and install dependencies 7 | # * git & curl & wget 8 | # * python3 9 | # * xvfb 10 | # * chrome 11 | # * chrome selenium driver 12 | # * hi-res fonts 13 | 14 | ENV DEBIAN_FRONTEND noninteractive 15 | 16 | # Create user 17 | RUN useradd automation --shell /bin/bash --create-home 18 | 19 | RUN apt-get -yqq update \ 20 | && apt-get install -y software-properties-common \ 21 | 22 | #install pip3 and python3 + libraries 23 | && add-apt-repository ppa:jonathonf/python-3.6 \ 24 | && apt-get -yqq update \ 25 | && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv \ 26 | && python3.6 -m pip install pip --upgrade \ 27 | && pip install --upgrade urllib3 \ 28 | && pip install requests \ 29 | && apt-get upgrade -yqq \ 30 | && apt-get install -y \ 31 | 32 | #install basic programs and correct time zone: 33 | apt-utils \ 34 | sudo \ 35 | tzdata \ 36 | xvfb \ 37 | git \ 38 | unzip \ 39 | wget \ 40 | curl \ 41 | dbus-x11 \ 42 | xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic \ 43 | --no-install-recommends \ 44 | && apt-get clean autoclean \ 45 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ 46 | && echo "Europe/Helsinki" > /etc/timezone \ 47 | && rm /etc/localtime \ 48 | && dpkg-reconfigure -f noninteractive tzdata \ 49 | 50 | #install google chrome latest version 51 | && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ 52 | && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ 53 | && apt-get -yqq update \ 54 | && apt-get -yqq install google-chrome-stable \ 55 | && rm -rf /var/lib/apt/lists/* \ 56 | && chmod a+x /usr/bin/google-chrome \ 57 | 58 | #install chromedriver based on the chrome-version (compatible chromedriver and chrome has same main version number) 59 | && CHROME_VERSION=$(google-chrome --version) \ 60 | && MAIN_VERSION=${CHROME_VERSION#Google Chrome } && MAIN_VERSION=${MAIN_VERSION%%.*} \ 61 | && echo "main version: $MAIN_VERSION" \ 62 | && CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_$MAIN_VERSION` \ 63 | && echo "**********************************************************" \ 64 | && echo "chrome version: $CHROME_VERSION" \ 65 | && echo "chromedriver version: $CHROMEDRIVER_VERSION" \ 66 | && echo "**********************************************************" \ 67 | && mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION \ 68 | && echo "directory for chromedriver set: /opt/chromedriver-$CHROMEDRIVER_VERSION" \ 69 | && curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \ 70 | && unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION \ 71 | && rm /tmp/chromedriver_linux64.zip \ 72 | && echo "chromedriver copied to directory" \ 73 | && chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver \ 74 | && echo "original file: /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver" \ 75 | && echo "linked to file: /usr/local/bin/chromedriver" \ 76 | && ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver 77 | 78 | # Fix hanging Chrome, see https://github.com/SeleniumHQ/docker-selenium/issues/87 79 | ENV DBUS_SESSION_BUS_ADDRESS /dev/null 80 | 81 | # Configure monitor 82 | ENV DISPLAY :20.0 83 | ENV SCREEN_GEOMETRY "1440x900x24" 84 | # Configure chromedriver 85 | ENV CHROMEDRIVER_PORT 4444 86 | ENV CHROMEDRIVER_WHITELISTED_IPS "127.0.0.1" 87 | ENV CHROMEDRIVER_URL_BASE '' 88 | ENV CHROMEDRIVER_EXTRA_ARGS '' 89 | 90 | EXPOSE 4444 91 | 92 | #Set python 3.6 to default python version and io-encoding 93 | RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 \ 94 | && update-alternatives --set python /usr/bin/python3.6 \ 95 | && export PYTHONIOENCODING="utf-8" 96 | 97 | # Install Robot Framework libraries 98 | #(pypi setup for jsonlibrary is broken and it needs separate installation from master) 99 | COPY requirements.txt /tmp/ 100 | RUN pip3 install -Ur /tmp/requirements.txt && rm /tmp/requirements.txt 101 | RUN pip3 install https://github.com/nottyo/robotframework-jsonlibrary/archive/master.zip 102 | 103 | ADD run.sh /usr/local/bin/run.sh 104 | RUN chmod +x /usr/local/bin/run.sh 105 | 106 | CMD ["run.sh"] 107 | -------------------------------------------------------------------------------- /robotframework/requirements.txt: -------------------------------------------------------------------------------- 1 | #pip3 2 | robotframework==3.1.1 3 | robotframework-seleniumlibrary==3.3.1 4 | pyvirtualdisplay==0.2 5 | robotframework-pabot==0.56 6 | retry 7 | -------------------------------------------------------------------------------- /robotframework/run-rf-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | << //// 4 | ********************************************************************************************************************* 5 | pre-requisites: 6 | - yle-ovp-test repository cloned and updated in the same parent directory where the ovp-xxx-repository is 7 | 8 | using the script: 9 | - copy this script to the repository you want to test (e.g. to the folder 'robotframework') 10 | - run the script from main level of the ovp-repository (e.g. ./robotframework/run-rf-tests.sh xxx yyy zzz) 11 | 12 | variables with this sh-file: 13 | - 1. where feenix is run (feenix url selection and selection if image is built or not). Options: 14 | - travis (docker-feenix with image building in Travis --> for ovp-ui test run), 15 | - local-with-image (docker-feenix with image building in own laptop), 16 | - local-without-image (docker-feenix without image building in own laptop), 17 | - without-docker (Feenix in yle test environment) 18 | - local-without-building (docker-feenix without image buiding and without starting the container in own laptop) 19 | - feenix-mac (feenix at own laptop --> check the url from robotframework-tests/env/test_env.py) 20 | - 2. type how to select tests and correct pabot script (testtag or testsuite) 21 | - 3. name for type (e.g. tag 'image' or test suite 'live_order_with_encoder' 22 | 23 | example: 24 | - from repository ovp-ui in yle test environment run all tests for images: 25 | ./robotframework/run-rf-tests.sh without-docker testtag image 26 | 27 | test results and logs: 28 | - test logs are always stored to the directory 'yle-ovp-test/logs' 29 | - log.html is the best result file for debugging 30 | 31 | ********************************************************************************************************************* 32 | //// 33 | 34 | #other than yle-ovp-test repo: 35 | export OVP_REPO_FOLDER=$(pwd) 36 | cd .. 37 | export FOLDER=$(pwd) 38 | export OVP_TEST_FOLDER=$FOLDER/yle-ovp-test; 39 | 40 | echo "ovp-repo: $OVP_REPO_FOLDER" 41 | echo "parent folder: $(pwd)" 42 | echo "RF tests: $OVP_TEST_FOLDER" 43 | 44 | cd $OVP_TEST_FOLDER 45 | 46 | # Selecting the Feenix url and putting it in the new file (test_env_for_run.py) which is used in run_pabot_for_xxx.sh. 47 | if 48 | [ $1 == 'without-docker' ]; then 49 | sed 's/{{FEENIX_SELECTION}}/FEENIX_YLE/g' env/test_env.py > env/test_env_for_run.py; 50 | 51 | elif 52 | [ $1 == 'feenix-mac' ]; then 53 | sed 's/{{FEENIX_SELECTION}}/FEENIX_MAC/g' env/test_env.py > env/test_env_for_run.py; 54 | 55 | else 56 | sed 's/{{FEENIX_SELECTION}}/FEENIX_DOCKER/g' env/test_env.py > env/test_env_for_run.py; 57 | fi 58 | 59 | # scripts for setting test environment up: 60 | echo "Setting Feenix test environment up: $1" 61 | echo 62 | 63 | export OVP_SCRIPT_LOCATION=$OVP_REPO_FOLDER/robotframework 64 | export TEST_SCRIPT_LOCATION=$OVP_TEST_FOLDER/scripts/pabot 65 | echo "Script location: $OVP_SCRIPT_LOCATION" 66 | 67 | # Correct user rights 68 | chmod ugo+x $TEST_SCRIPT_LOCATION/* 69 | chmod ugo+x $OVP_SCRIPT_LOCATION/* 70 | 71 | # Building image and creating container whenever needed. After that starting Feenix. 72 | if [ $1 == 'without-docker' ]; then 73 | echo 'Starting Feenix in yle test environment' 74 | docker network create rftest-net 75 | 76 | elif 77 | [ $1 == 'local-without-image' ]; then 78 | echo 'Starting Feenix locally in container (no image building)' 79 | $TEST_SCRIPT_LOCATION/tests/start-feenix.sh local no-image 80 | 81 | elif 82 | [ $1 == 'travis' ]; then 83 | echo 'Starting Feenix in Travis' 84 | $TEST_SCRIPT_LOCATION/tests/start-feenix.sh travis no-image 85 | 86 | elif 87 | [ $1 == 'local-with-image' ]; then 88 | echo 'Starting Feenix locally in container (build image first)' 89 | $TEST_SCRIPT_LOCATION/tests/start-feenix.sh local build-image 90 | 91 | elif 92 | [ $1 == 'feenix-mac' ]; then 93 | echo "Starting Feenix locally ($FEENIX_MAC)" 94 | echo 95 | $TEST_SCRIPT_LOCATION/tests/start-feenix.sh feenix-mac 96 | fi 97 | 98 | # Selecting the type how to select tests, by suite or tag. 99 | export CONFIGURATION_FILE=$OVP_TEST_FOLDER/env/test_env_app.py 100 | python $CONFIGURATION_FILE 101 | 102 | run_tests() 103 | { 104 | TYPE=$1 105 | NAME=$2 106 | docker run --rm --network rftest-net \ 107 | -e ROBOT_MODE=pabot \ 108 | -e PABOT_LIB=pabotlib \ 109 | -e ROBOT_VAR=/ovp-tests/env/test_env_for_run.py \ 110 | -e ROBOT_TESTS=/ovp-tests/tests \ 111 | -e ROBOT_ETAG=test-not-ready \ 112 | -e ROBOT_$TYPE=$NAME \ 113 | -e ROBOT_LOGS=/ovp-tests/logs/ \ 114 | -e LOG_LEVEL=INFO \ 115 | -e PABOT_PROC=15 \ 116 | --shm-size 6g \ 117 | -v $(pwd):/ovp-tests \ 118 | -ti yleisradio/docker-robotframework 119 | 120 | } 121 | 122 | if 123 | [ $2 == 'testtag' ]; then 124 | echo "running tests with tags: $3..." 125 | run_tests ITAG $3 126 | elif 127 | [ $2 == 'testsuite' ]; then 128 | echo "running test suite: $3..." 129 | run_tests SUITE $3 130 | fi 131 | 132 | exit $RESULT; 133 | 134 | -------------------------------------------------------------------------------- /robotframework/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Entry script to start Xvfb and set display 3 | set -e 4 | 5 | # Set sensible defaults for env variables that can be overridden while running 6 | # the container 7 | DEFAULT_LOG_LEVEL="INFO" 8 | DEFAULT_RES="1680x1050x24" 9 | DEFAULT_DISPLAY=":99" 10 | DEFAULT_ROBOT="pybot" 11 | 12 | # Use default if none specified as env var 13 | LOG_LEVEL=${LOG_LEVEL:-$DEFAULT_LOG_LEVEL} 14 | RES=${RES:-$DEFAULT_RES} 15 | DISPLAY=${DISPLAY:-$DEFAULT_DISPLAY} 16 | ROBOT_MODE=${ROBOT_MODE:-$DEFAULT_ROBOT} 17 | 18 | if [[ -n ${ROBOT_TESTS} ]]; 19 | then 20 | echo "" 21 | else 22 | echo "Error: Please specify the robot test or directory as env var ROBOT_TESTS" 23 | exit 1 24 | fi 25 | 26 | if [[ -n ${ROBOT_LOGS} ]]; 27 | then 28 | echo "" 29 | else 30 | echo "Error: Please specify the robot test or directory as env var ROBOT_LOGS" 31 | exit 1 32 | fi 33 | 34 | # Process optional parameters passed to pybot/pabot 35 | OPTIONAL_PARAMETERS="" 36 | 37 | if [[ -n ${PABOT_LIB} ]] 38 | then 39 | OPTIONAL_PARAMETERS+="--${PABOT_LIB} " 40 | fi 41 | 42 | if [[ -n ${PABOT_RES} ]] 43 | then 44 | OPTIONAL_PARAMETERS+="--resourcefile ${PABOT_RES} " 45 | fi 46 | 47 | if [[ -n ${PABOT_PROC} ]] 48 | then 49 | OPTIONAL_PARAMETERS+="--processes ${PABOT_PROC} " 50 | fi 51 | 52 | if [[ -n ${ROBOT_VAR} ]] 53 | then 54 | OPTIONAL_PARAMETERS+="--variablefile ${ROBOT_VAR} " 55 | fi 56 | 57 | if [[ -n ${ROBOT_ITAG} ]] 58 | then 59 | OPTIONAL_PARAMETERS+="-i ${ROBOT_ITAG} " 60 | fi 61 | 62 | if [[ -n ${ROBOT_ETAG} ]] 63 | then 64 | OPTIONAL_PARAMETERS+="-e ${ROBOT_ETAG} " 65 | fi 66 | 67 | if [[ -n ${ROBOT_TEST} ]] 68 | then 69 | OPTIONAL_PARAMETERS+="-t ${ROBOT_TEST} " 70 | fi 71 | 72 | if [[ -n ${ROBOT_SUITE} ]] 73 | then 74 | OPTIONAL_PARAMETERS+="-s ${ROBOT_SUITE} " 75 | fi 76 | 77 | # Start Xvfb 78 | echo -e "Starting Xvfb on display ${DISPLAY} with res ${RES}" 79 | Xvfb ${DISPLAY} -ac -screen 0 ${RES} +extension RANDR & 80 | export DISPLAY=${DISPLAY} 81 | 82 | #export ROBOT_SYSLOG_FILE=${ROBOT_LOGS}/syslog.txt 83 | #export ROBOT_SYSLOG_LEVEL=DEBUG 84 | 85 | # Execute tests 86 | if [ "${ROBOT_MODE}" != "pabot" ] 87 | then 88 | echo -e "Executing robot tests at log level ${LOG_LEVEL}, parameters ${OPTIONAL_PARAMETERS}with pybot" 89 | pybot --loglevel ${LOG_LEVEL} ${OPTIONAL_PARAMETERS}--outputdir ${ROBOT_LOGS} ${ROBOT_TESTS} 90 | else 91 | echo -e "Executing robot tests at log level ${LOG_LEVEL}, pabotlib and parameters ${OPTIONAL_PARAMETERS} with pabot" 92 | echo -e "command: pabot ${OPTIONAL_PARAMETERS}--loglevel ${LOG_LEVEL} --outputdir ${ROBOT_LOGS} ${ROBOT_TESTS}" 93 | pabot ${OPTIONAL_PARAMETERS}--loglevel ${LOG_LEVEL} --outputdir ${ROBOT_LOGS} ${ROBOT_TESTS} 94 | fi 95 | 96 | # Stop Xvfb 97 | kill -9 $(pgrep Xvfb) 98 | -------------------------------------------------------------------------------- /tests/ChromeConfiguration.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver.chrome.options import Options 2 | 3 | def config(): 4 | options = Options() 5 | options.add_argument("--no-sandbox") 6 | options.add_argument('--headless') 7 | options.add_argument("window-size=1680,1050") 8 | return options 9 | 10 | def serviceargs(): 11 | return ["--verbose", "--log-path=/tests/chromedriverlog"] 12 | -------------------------------------------------------------------------------- /tests/bing.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Documentation Simple example using SeleniumLibrary. 3 | Library SeleniumLibrary 4 | Library ChromeConfiguration.py 5 | Default Tags bing 6 | 7 | *** Variables *** 8 | ${SITEURL} http://bing.com 9 | 10 | *** Test Cases *** 11 | Bing opens 12 | ${chrome_opts} ChromeConfiguration.Config 13 | @{ARGS} ChromeConfiguration.Serviceargs 14 | Create WebDriver Chrome chrome_options=${chrome_opts} service_args=${ARGS} 15 | Go To ${SITEURL} 16 | Title Should Be Bing 17 | Capture Page Screenshot bing.png 18 | [Teardown] Close Browser 19 | 20 | -------------------------------------------------------------------------------- /tests/google.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Documentation Simple example using SeleniumLibrary. 3 | Library SeleniumLibrary 4 | Library ChromeConfiguration.py 5 | Default Tags google 6 | 7 | *** Variables *** 8 | ${SITEURL} http://google.com 9 | 10 | *** Test Cases *** 11 | Google opens 12 | ${chrome_opts} ChromeConfiguration.Config 13 | @{ARGS} ChromeConfiguration.Serviceargs 14 | Create WebDriver Chrome chrome_options=${chrome_opts} service_args=${ARGS} 15 | Go To ${SITEURL} 16 | Title Should Be Google 17 | Capture Page Screenshot google.png 18 | [Teardown] Close Browser 19 | 20 | --------------------------------------------------------------------------------