Skip to content

Commit fec2255

Browse files
Hardcode Cypress APP_URL (Kitware#3639)
Our Cypress tests currently attempt to dynamically set the baseUrl based on the APP_URL config ahead of time. This doesn't work when the APP_URL changes mid-run. We already have other mechanisms in place to ensure that Cypress and Dusk tests don't conflict, so this logic is no longer necessary. I believe this the root cause of much of the recent Cypress test flakiness.
1 parent f0c7322 commit fec2255

2 files changed

Lines changed: 1 addition & 19 deletions

File tree

tests/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
function(set_app_url)
2-
if(DEFINED ENV{APP_URL})
3-
set(APP_URL "$ENV{APP_URL}" PARENT_SCOPE)
4-
elseif(EXISTS ${CDash_SOURCE_DIR}/.env)
5-
file(STRINGS ${CDash_SOURCE_DIR}/.env env_vars)
6-
foreach(var IN LISTS env_vars)
7-
if(var MATCHES "^APP_URL=(.*)$")
8-
set(APP_URL "${CMAKE_MATCH_1}" PARENT_SCOPE)
9-
break()
10-
endif()
11-
endforeach()
12-
else()
13-
set(APP_URL "http://localhost:8080" PARENT_SCOPE)
14-
endif()
15-
endfunction()
16-
171
add_test(
182
NAME php_style_check
193
COMMAND ${CMAKE_SOURCE_DIR}/vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes

tests/cypress/e2e/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
function(add_cypress_e2e_test TestName)
2-
set_app_url()
3-
42
add_test(
53
NAME cypress/e2e/${TestName}
64
COMMAND ${NPX_EXE} cypress run
75
--e2e
86
--project ${CDash_SOURCE_DIR}
97
--spec ${CDash_SOURCE_DIR}/tests/cypress/e2e/${TestName}.cy.js
10-
--config baseUrl=${APP_URL}
8+
--config baseUrl=http://localhost:8080
119
)
1210
# Cypress tries to put stuff in our home directory, which doesn't work for /var/www.
1311
set_tests_properties(cypress/e2e/${TestName} PROPERTIES

0 commit comments

Comments
 (0)