How to change URL from CI/CD in Gitlab on Automation Testing using Robot Framework - selenium

I have 3 env (dev/test/prod) and I want to change the URL from the gitlab-ci.yml so I can choose from CI/CD which env I want to run the tests.
Currently I run:
- robot -v BROWSER:Chrome -d results/Chrome test/test.robot
I can't find any info on this. Is it possible?

You can pass URL though command line, try below solution
- robot -v url:http://your_url -v BROWSER:Chrome -d results/Chrome test/test.robot

Related

"Startup File" on Azure Docker Web App

Is the "Startup File" option on the docker web app options for docker-compose files? or shell commands? I cannot find any documentation for it...
Basically I'd like my Web App to run a docker-compose.yml instead of executing docker run [options] when I push an image to it.
This is documented now, see below or click here.
What are the expected values for the Startup File section when I
configure the runtime stack?
For Node.js, you specify the PM2 configuration file or your script
file. For .NET Core, specify your compiled DLL name as dotnet <myapp>.dll. For Ruby, you can specify the Ruby script that you want
to initialize your app with.
Not sure if this is still a problem but I just noticed it appends whatever you put in there to the default startup command.
2019-09-02 05:03:04.493 INFO - docker run -d -p 55721:80 --name xxxxxx -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=xxxxx -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=xxxxxx.azurewebsites.net -e WEBSITE_INSTANCE_ID=xxxxxxxxx -e HTTP_LOGGING_ENABLED=1 xxxxxx.azurecr.io/xxxxxxx:latest -p 80:4000 -p 443:8000
I put the -p 80:4000 -p 443:8000 into the textbox in the portal config
Azure Web Apps for Containers does not support multi-container apps (with docker-compose) at the time of writing.

SauceLabs Pass/Fail using behat

I am trying to add Pass/Fail status in Saucelabs whenever I run an Automated test but I can't figure out how shall I do it. I use Behat - Selenium Driver. I read the documentation but it didn't help me.
I tried to use the Saucelabs Rest API guide and I launch in my console the following
curl -X PUTĀ \
-s -d '{"passed":true}' \
-u https://USERNAME:APIKEY#saucelabs.com/rest/v1/users/USERNAME
But it doesn't work.
I think you need the session Id
ownCloud uses:
curl -X PUT -s -d "{\"passed\": $PASSED}" -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY https://saucelabs.com/rest/v1/$SAUCE_USERNAME/jobs/$SAUCELABS_SESSIONID
see: https://github.com/owncloud/core/blob/master/tests/travis/start_ui_tests.sh#L235
and this Id is pulled from the URL: https://github.com/owncloud/core/blob/master/tests/ui/features/bootstrap/FeatureContext.php#L171
but there might be better ways of getting it

Create docker image to run selenium tests on different browser versions

I am currently learning to use docker to run selenium tests.
However, to run tests on different versions of the browser, it requires creating our own image.
I tried few ways but failed to run them.
I used the docker file at below path:
https://hub.docker.com/r/selenium/node-chrome/~/dockerfile/
and tried to build the image by using the following command:
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta=53.0.2785.92-1 NodeChrome
Can anyone guide me on how to implement the same?
Regards,
Ashwin Karangutkar
Use
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta <path_to_Dockerfile>
I am using elgalu/selenium.
docker run -d --name=grid -p 4444:24444 -p 5900:25900 --shm-size=1g elgalu/selenium
And looking in elgalu looks like you can change the browser versions.
Adding -e FIREFOX_VERSION=38.0.6 to the docker run command.

Codeception auto start and auto shutdown selenium server?

I'm using Codeception and I want to do Selenium tests.
Obviously, I need Selenium server running and I can spin it up with:
java -jar ./path/to/selenium/binary
However, I've used another testing framework in past which allowed me to specify this path in config file. Then, whenever I did something like codecept run, the framework automatically started selenium server and also shutted it down after all tests were completed.
Can I do this with Codeception? I tried to put exec() in _bootstrap file but it didn't work..
I'm using phantomjs - headless alternative to selenium. This extension starts phantomjs automatically with codecept run. Also phantomjs is faster than selenium.
You can write your own extension for running selenium - have a look at this file.
I start my tests with a bash script and then start and stop selenium via screen:
#!/usr/bin/env bash
# Start selenium in detached screen
screen -d -m -S "selenium" java -Dwebdriver.chrome.driver=./path/to/chromedriver -jar ./path/to/selenium/binary || true
./vendor/bin/codecept run -c codeception.yml --fail-fast --coverage --steps --coverage-html --html || error=true
# quit selenium
screen -S selenium -X quit || true
This might not fit the use-case but I can execute my code in my bash on Windows and Ubuntu as well as via my jenkins build process.

Nacl And Pnacl from terminal on chrome device

I've built hello world program by nacl and pnacl tools from NACL_SDK.
And now I want to test it.
I've mad a html page and js script which are working with my nexe and pexe and in browser everything is working fine.
But how can I launch my programs from console?
And how can I write stdout to file?
To run a nexe-program my-app.nexe from console and redirect output to file output.log use the following command:
$NACL_SDK/tools/sel_ldr.py my-app.nexe > output.log
sel_ldr.py is just a helper script. If you pass a --verbose option to it, you'll see a real command used to run your program. It's something like this:
$NACL_SDK/tools/nacl_helper_bootstrap_x86_64 $NACL_SDK/tools/sel_ldr_x86_64 \
--r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a \
-B $NACL_SDK/tools/irt_core_x86_64.nexe my-app.nexe