Patch #34269

Allow system tests to run on remote Selenium hub (eg: Docker)

Added by Marius BALTEANU 10 months ago. Updated 8 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.0

Description

The current setup of system tests forces you to have your Selenium/ChromeDriver on your localhost. This is ok if you have a classic setup with everything on your localhost, but if you are using Docker or you want to configure the tests to run on CI you need to install ChromeDriver and all the dependencies on the same image with Redmine.

The attached patch adds 4 environment variables that allow you to configure the system tests to run using a remote Selenium URL:
CAPYBARA_SERVER_HOST: to configure the default server to run on a custom IP which can be, for example, your remote Selenium IP or 0.0.0.0 to listen an all connections
CAPYBARA_SERVER_PORT: to configure the default server port
SELENIUM_REMOTE_URL: remote Selenium IP
CAPYBARA_APP_HOST: by default, the tests expect to have the application running on your localhost. Using this variable, you can set a custom URL.

With the attached patch, I was able to configure my Gitlab CI setup (#30069) to run the system tests (https://gitlab.com/redmine-org/redmine/-/jobs/852801841).

0001-Adds-CAPYBARA_SERVER_HOST-CAPYBARA_SERVER_PORT-SELEN.patch Magnifier (3.43 KB) Marius BALTEANU, 2020-11-17 20:26

0002-Adds-GOOGLE_CHROME_OPTS_ARGS-environment-variable-to.patch Magnifier (2.62 KB) Marius BALTEANU, 2021-01-09 11:42

Associated revisions

Revision 20428
Added by Go MAEDA 10 months ago

Adds CAPYBARA_SERVER_HOST, CAPYBARA_SERVER_PORT, SELENIUM_REMOTE_URL and CAPYBARA_APP_HOST to allow running system tests on a remote Selenium hub (on CI using Docker images) (#34269).

Patch by Marius BALTEANU.

Revision 20490
Added by Go MAEDA 10 months ago

Fix RuboCop Performance/RedundantMerge due to r20428 (#34269).

Revision 20491
Added by Go MAEDA 10 months ago

Fix RuboCop Style/MultilineIfModifier due to r20428 (#34269).

Revision 20708
Added by Go MAEDA 8 months ago

Adds GOOGLE_CHROME_OPTS_ARGS environment variable to define Google Chrome options arguments (#34269).

Patch by Marius BALTEANU.

History

#1 Updated by Go MAEDA 10 months ago

The change looks nice.

Would you consider adding description about those four environment variables to source:trunk/doc/RUNNING_TESTS?

#2 Updated by Marius BALTEANU 10 months ago

Go MAEDA wrote:

The change looks nice.

Would you consider adding description about those four environment variables to source:trunk/doc/RUNNING_TESTS?

Yes, I forgot about docs. Thanks for pointing this out. I will update the patch soon.

#3 Updated by Marius BALTEANU 10 months ago

  • File deleted (0001-Adds-CAPYBARA_SERVER_HOST-CAPYBARA_SERVER_PORT-SELEN.patch)

#4 Updated by Marius BALTEANU 10 months ago

Here it is the updated version.

#5 Updated by Go MAEDA 10 months ago

  • Target version set to 4.2.0

Setting the target version to 4.2.0.

#6 Updated by Go MAEDA 10 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch (r20428). Thank you for your contribution.

#7 Updated by Marius BALTEANU 10 months ago

Go MAEDA wrote:

Committed the patch (r20428). Thank you for your contribution.

Thanks Go Maeda for fixing the RuboCop violations.

#8 Updated by Marius BALTEANU 9 months ago

One more environment variable that allows to set the Google Chrome Options arguments as a comma-delimited string. Useful to set some required arguments to run the tests on headless Chrome.

GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" 

#9 Updated by Marius BALTEANU 9 months ago

  • Status changed from Closed to Reopened

#10 Updated by Go MAEDA 8 months ago

  • Status changed from Reopened to Closed

Marius BALTEANU wrote:

One more environment variable that allows to set the Google Chrome Options arguments as a comma-delimited string. Useful to set some required arguments to run the tests on headless Chrome.

[...]

Committed the patch. Thank you.

Also available in: Atom PDF