I spent about one week trying to make my Robot Framework tests work for Safari browser in MacOS, when launched by Jenkins via ssh.
The main issue was that Robot couldn't open a browser when executed in ssh session, reporting "No browser is open".
- MacOS 10.12.6 Sierra (issue was there also with 10.14 Mojave)
- Safari 12.1.2 (issue was there also with Safari 10)
- Robot Framework 3.1.2 (Python 3.6.8 / Python 2.7.16)
My current workaround is:
- Application "robot_test" created (in Automator based on shell script type) which is to launch a shell script and save the exit code:
/tmp/execute_test.sh > /tmp/execute_test.log 2>&1 echo "export EXITCODE=$?" > /tmp/execute_test.result
- On the Jenkins side, in the shell command section, I am creating an shell script with the contents I need, execute it and wait for result file to appear:
export CURRENT_FOLDER=`pwd` echo "#!/bin/bash ~/.bash_profile cd $CURRENT_FOLDER python3 -m robot -parameters robot_script.robot " > /tmp/execute_test.sh chmod +x /tmp/execute_test.sh rm -f /tmp/execute_test.result MAX_WAIT_TIME=1200 WAIT_TIME=0 open -a robot_test > /tmp/robot_test_app.log 2>&1 while [ ! -f /tmp/execute_test.result ] && [ $WAIT_TIME -le $MAX_WAIT_TIME ]; do WAIT_TIME=$((WAIT_TIME+10)); sleep 10 done cat /tmp/execute_test.log EXITCODE=1 if [ -f /tmp/execute_test.result ]; then chmod +x /tmp/execute_test.result source /tmp/execute_test.result fi exit $EXITCODE
Am I the only one having problems with running robot test from ssh sessions in MacOS? If yes, could you please share you steps to configure the proper setup? If no, then this post might be helpful for someone to have working configuration at least, please share your solutions/workarounds if they are better.