diff --git a/README.md b/README.md index 8922b112b..402944670 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ![Build & test](https://github.com/SeleniumHQ/docker-selenium/workflows/Build%20&%20test/badge.svg?branch=trunk) ![Deployments](https://github.com/SeleniumHQ/docker-selenium/workflows/Deploys/badge.svg) +![Helm Charts](https://github.com/SeleniumHQ/docker-selenium/workflows/Lint%20and%20Test%20Helm%20Charts/badge.svg) # Docker images for the Selenium Grid Server diff --git a/charts/selenium-grid/TESTING.md b/charts/selenium-grid/TESTING.md index aee1c772b..d6e266713 100644 --- a/charts/selenium-grid/TESTING.md +++ b/charts/selenium-grid/TESTING.md @@ -18,6 +18,7 @@ All related testing to this helm chart will be documented in this file. | Browser Nodes | Node `nameOverride` is set | ✓ | | | Sanity tests in node | ✓ | | | Video recorder is enabled in node | ✗ | +| | Node `extraEnvironmentVariables` is set value | ✓ | ## Build & test Docker images with Helm charts Noted: These `make` commands are composed and tested on Linux x86_64. diff --git a/charts/selenium-grid/ci/NodeChrome-values.yaml b/charts/selenium-grid/ci/NodeChrome-values.yaml index f3c30c48d..131434058 100644 --- a/charts/selenium-grid/ci/NodeChrome-values.yaml +++ b/charts/selenium-grid/ci/NodeChrome-values.yaml @@ -2,6 +2,9 @@ # Configuration for chrome nodes chromeNode: nameOverride: my-chrome-name + extraEnvironmentVariables: + - name: SE_OPTS + value: "--enable-managed-downloads true" # Configuration for edge nodes edgeNode: enabled: false diff --git a/charts/selenium-grid/ci/NodeEdge-values.yaml b/charts/selenium-grid/ci/NodeEdge-values.yaml index 1d1c13f9c..aec663509 100644 --- a/charts/selenium-grid/ci/NodeEdge-values.yaml +++ b/charts/selenium-grid/ci/NodeEdge-values.yaml @@ -5,6 +5,9 @@ chromeNode: # Configuration for edge nodes edgeNode: nameOverride: my-edge-name + extraEnvironmentVariables: + - name: SE_OPTS + value: "--enable-managed-downloads true" # Configuration for firefox nodes firefoxNode: enabled: false diff --git a/charts/selenium-grid/ci/NodeFirefox-values.yaml b/charts/selenium-grid/ci/NodeFirefox-values.yaml index 418d00b8a..8ccc9bd41 100644 --- a/charts/selenium-grid/ci/NodeFirefox-values.yaml +++ b/charts/selenium-grid/ci/NodeFirefox-values.yaml @@ -8,3 +8,6 @@ edgeNode: # Configuration for firefox nodes firefoxNode: nameOverride: my-firefox-name + extraEnvironmentVariables: + - name: SE_OPTS + value: "--enable-managed-downloads true" diff --git a/tests/SeleniumTests/__init__.py b/tests/SeleniumTests/__init__.py index ef6e9bada..12ee94ede 100644 --- a/tests/SeleniumTests/__init__.py +++ b/tests/SeleniumTests/__init__.py @@ -63,29 +63,48 @@ def test_play_video(self): paused = video.get_property('paused') self.assertFalse(paused) + def test_download_file(self): + driver = self.driver + driver.get('https://the-internet.herokuapp.com/download') + wait = WebDriverWait(driver, 30) + file_link = wait.until( + EC.element_to_be_clickable((By.LINK_TEXT, 'some-file.txt')) + ) + file_link.click() + wait.until( + lambda d: len(d.get_downloadable_files()) > 0 + ) + self.assertTrue(len(driver.get_downloadable_files()) > 0) + def tearDown(self): self.driver.quit() class ChromeTests(SeleniumGenericTests): def setUp(self): + options = ChromeOptions() + options.enable_downloads = True self.driver = webdriver.Remote( - options=ChromeOptions(), + options=options, command_executor="http://%s:%s" % (SELENIUM_GRID_HOST,SELENIUM_GRID_PORT) ) class EdgeTests(SeleniumGenericTests): def setUp(self): + options = EdgeOptions() + options.enable_downloads = True self.driver = webdriver.Remote( - options=EdgeOptions(), + options=options, command_executor="http://%s:%s" % (SELENIUM_GRID_HOST,SELENIUM_GRID_PORT) ) class FirefoxTests(SeleniumGenericTests): def setUp(self): + options = FirefoxOptions() + options.enable_downloads = True self.driver = webdriver.Remote( - options=FirefoxOptions(), + options=options, command_executor="http://%s:%s" % (SELENIUM_GRID_HOST,SELENIUM_GRID_PORT) ) diff --git a/tests/docker-compose-v3-test-video.yml b/tests/docker-compose-v3-test-video.yml index e80c56b92..bbfb6f6ab 100644 --- a/tests/docker-compose-v3-test-video.yml +++ b/tests/docker-compose-v3-test-video.yml @@ -12,6 +12,7 @@ services: - SE_EVENT_BUS_HOST=selenium-hub - SE_EVENT_BUS_PUBLISH_PORT=4442 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + - SE_OPTS=--enable-managed-downloads true ports: - "6900:5900" diff --git a/tests/test.py b/tests/test.py index 16dbbbf30..7568d755b 100644 --- a/tests/test.py +++ b/tests/test.py @@ -136,6 +136,8 @@ def launch_container(container, **kwargs): 'SE_EVENT_BUS_PUBLISH_PORT': 4442, 'SE_EVENT_BUS_SUBSCRIBE_PORT': 4443 } + if container != 'Hub': + environment['SE_OPTS'] = "--enable-managed-downloads true" container_id = client.containers.run("%s/%s:%s" % (NAMESPACE, IMAGE_NAME_MAP[container], VERSION), detach=True, environment=environment,