Launch browser from gitlab shell ci


#1

I’m trying to configure CI for my project. We use robotframework to create automated tests. It’s python+selenium based solution. I have configured my .gitlab-ci.yml this way:

stages:

  • test

test:
stage: test
script:

  • set PATH=%PATH%;C:/Python27/Scripts
  • cd C:/Users/lestivalet/integracao/novoaud/novoaud-angular/test/tests
  • ‘“C:/Python27/Scripts/robot” -d …/results --variable BROWSER:firefox -e exception_path -e not_ready "AUD-001 - Carregar Pauta de Audiencia.robot’

The last line opens Firefox and starts the automated test. If I run it in Windows command line it works. But using the gitlab ci shell option, the browser is not opened.

Anybody with experience with this scenario? I’m using Windows environment.


#2

I’m trying to launch firefox in headless mode for my automated tests, But I got “WebDriverException: Message: Process unexpectedly closed with status: 0”

Running exactly the same command in windows command line it works. No idea what is going on with gitlab shell runner

[0KRunning with gitlab-runner 10.5.0 (80b03db9)
e[0;me[0K on SETIC-20233 effcb90f
e[0;me[0KUsing Shell executor…
e[0;msection_start:1519838299:prepare_script
e[0KRunning on SETIC-20233…
section_end:1519838299:prepare_script
e[0Ksection_start:1519838299:get_sources
e[0Ke[32;1mFetching changes…e[0;m
HEAD is now at 3153c86 teste headless
From https://gitlab.trt4.gov.br/setic/cds/sds1/novoaud
3153c86…91e5404 integracao -> origin/integracao
e[32;1mChecking out 91e5404b as integracao…e[0;m
e[32;1mSkipping Git submodules setupe[0;m
section_end:1519838301:get_sources
e[0Ksection_start:1519838301:restore_cache
e[0Ksection_end:1519838301:restore_cache
e[0Ksection_start:1519838301:download_artifacts
e[0Ksection_end:1519838301:download_artifacts
e[0Ksection_start:1519838301:build_script
e[0Ke[32;1m$ set PATH=%PATH%;C:/Python27/Scripts;C:/Program Files/Mozilla Firefoxe[0;m
e[32;1m$ cd C:/Users/lestivalet/dev/novoaud/novoaud-angular/test/testse[0;m
e[32;1m$ “C:/Python27/Scripts/robot” -d …/results --variable BROWSER:firefox -e exception_path -e not_ready "headless.robot"e[0;m

Headless

Cen�rio 00: testar modo headless | FAIL |
WebDriverException: Message: Process unexpectedly closed with status: 0

Headless | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed

Output: C:\Users\lestivalet\dev\novoaud\novoaud-angular\test\results\output.xml
Log: C:\Users\lestivalet\dev\novoaud\novoaud-angular\test\results\log.html
Report: C:\Users\lestivalet\dev\novoaud\novoaud-angular\test\results\report.html
section_end:1519838316:build_script
e[0Ksection_start:1519838316:after_script
e[0Ksection_end:1519838316:after_script
e[0Ke[31;1mERROR: Job failed: exit status 1
e[0;m


#3

I have the same problem, did you solve it?


#4

I have found a solution:

Download psexec and then I’ve run the program like this:
psexec \\[domain] -u [admin] -p [password] -accepteula -h -i [program]