Skip to content

Commit 94c0329

Browse files
committed
Display failing URL in E2E crawling test
Try to debug how the failing page looked like in CI. This is only relevant for CI as locally we can reproduce the test or set the environment variable.
1 parent 14c5e00 commit 94c0329

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

webapp/tests/E2E/Controller/ControllerRolesTraversalTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,16 @@ public function visitWithNoContest(string $url, bool $dropdown): void
224224
$response = $this->client->getResponse();
225225
self::assertNotEquals(500, $response->getStatusCode(), sprintf('Failed at %s', $url));
226226
if ($dropdown && !str_contains($url, '/public')) {
227-
self::assertSelectorExists('a#navbarDropdownContests:contains("no contest")');
227+
try {
228+
self::assertSelectorExists('a#navbarDropdownContests:contains("no contest")', "Failed at: " . $url);
229+
} catch (\Exception $e) {
230+
$gitlabArtifacts = getenv('GITLABARTIFACTS');
231+
if ($gitlabArtifacts != '') {
232+
$fileHandler = fopen(sprintf("%s/%s", $gitlabArtifacts, str_replace('/', '_s_', $url)), 'w');
233+
fwrite($fileHandler, $response->getContent());
234+
}
235+
throw $e;
236+
}
228237
}
229238
}
230239

0 commit comments

Comments
 (0)