diff --git a/docker/docker-compose.dev.yaml b/docker/docker-compose.dev.yaml index 38fb58d68a..a4d0632cfd 100644 --- a/docker/docker-compose.dev.yaml +++ b/docker/docker-compose.dev.yaml @@ -109,7 +109,7 @@ services: # --- Tests: chrome.catroweb: - image: zenika/alpine-chrome:100 + image: zenika/alpine-chrome:124 container_name: chrome.catroweb restart: on-failure shm_size: '512mb' diff --git a/docker/docker-compose.test.yaml b/docker/docker-compose.test.yaml index 89855a651f..9ed6a29427 100644 --- a/docker/docker-compose.test.yaml +++ b/docker/docker-compose.test.yaml @@ -24,7 +24,7 @@ services: # --- Tests: chrome.catroweb: - image: zenika/alpine-chrome:100 + image: zenika/alpine-chrome:124 container_name: chrome.catroweb shm_size: '512mb' restart: on-failure diff --git a/src/System/Testing/Behat/Context/ApiContext.php b/src/System/Testing/Behat/Context/ApiContext.php index b771191e22..49c4170510 100644 --- a/src/System/Testing/Behat/Context/ApiContext.php +++ b/src/System/Testing/Behat/Context/ApiContext.php @@ -443,6 +443,27 @@ public function theResponseStatusCodeShouldBe(string $status_code): void ); } + /** + * @Then /^the response Location header should be "([^"]*)"$/ + * + * @throws \Exception + */ + public function theResponseLocationHeaderShouldBe(string $expected_url): void + { + $location_header = $this->getKernelBrowser()->getResponse()->headers->get('Location'); + Assert::assertSame($expected_url, $location_header); + } + + /** + * @Given /^I do not follow redirects$/ + * + * @throws \Exception + */ + public function iDoNotFollowRedirects(): void + { + $this->getKernelBrowser()->followRedirects(false); + } + /** * @Then /^the response should be in json format$/ * diff --git a/tests/BehatFeatures/web/general/help.feature b/tests/BehatFeatures/web/general/help.feature index 1c9ff26fdc..878c1d4f73 100644 --- a/tests/BehatFeatures/web/general/help.feature +++ b/tests/BehatFeatures/web/general/help.feature @@ -1,14 +1,20 @@ @web @help Feature: Help page redirect + # Note: assert via HTTP redirect (Location header), not browser navigation. + # Browser navigation triggered Chrome OOM crashes when loading the heavy + # external catrobat.org/docs/ page in CI. + Scenario: Navigating to "/app/help" should redirect to the wiki - When I switch the language to "English" - And I go to "/app/help" - And I wait for the page to be loaded - Then I should be on "https://catrobat.org/docs/" + Given I do not follow redirects + When I set request language to "English" + And I GET "/app/help" + Then the response status code should be "302" + And the response Location header should be "https://catrobat.org/docs/" Scenario: Navigating to "/app/help" should redirect to a german page - When I switch the language to "Deutsch" - And I go to "/app/help" - And I wait for the page to be loaded - Then I should be on "https://catrobat.org/de/dokumentation/" \ No newline at end of file + Given I do not follow redirects + When I set request language to "Deutsch" + And I GET "/app/help" + Then the response status code should be "302" + And the response Location header should be "https://catrobat.org/de/dokumentation/"