diff --git a/app/cdash/tests/CMakeLists.txt b/app/cdash/tests/CMakeLists.txt index 13a9c8c16b..189feabcce 100644 --- a/app/cdash/tests/CMakeLists.txt +++ b/app/cdash/tests/CMakeLists.txt @@ -77,11 +77,27 @@ function(add_feature_test_in_transaction TestName) ) endfunction() +add_test( + NAME change_app_url_to_website + COMMAND sed -i "s#http://localhost:8080#http://website:8080#g" "${CDash_SOURCE_DIR}/.env" +) +set_tests_properties( + change_app_url_to_website + PROPERTIES FIXTURES_SETUP APP_URL_WEBSITE +) + +add_test( + NAME change_app_url_to_localhost + COMMAND sed -i "s#http://website:8080#http://localhost:8080#g" "${CDash_SOURCE_DIR}/.env" +) +set_tests_properties( + change_app_url_to_localhost + PROPERTIES FIXTURES_CLEANUP APP_URL_WEBSITE +) + function(add_browser_test TestName) add_feature_test(${TestName}) - set_property(TEST ${TestName} APPEND PROPERTY RESOURCE_LOCK - APP_URL # All browser tests need exclusive access to the APP_URL configuration setting - ) + set_property(TEST ${TestName} APPEND PROPERTY FIXTURES_REQUIRED APP_URL_WEBSITE) set_property(TEST ${TestName} APPEND PROPERTY PROCESSORS 2) endfunction() @@ -467,6 +483,7 @@ set_tests_properties(lotsofsubprojects PROPERTIES DEPENDS /CDash/XmlHandler/Upda ################################################################################################### set_property(TEST install_2 APPEND PROPERTY DEPENDS + change_app_url_to_localhost /CDash/Lib/Repository/GitHub /CDash/Messaging/Subscription/CommitAuthorSubscriptionBuilder /CDash/Messaging/Subscription/UserSubscriptionBuilder @@ -482,7 +499,6 @@ set_property(TEST install_2 APPEND PROPERTY DEPENDS /CDash/Messaging/Topic/MissingTestTopic /CDash/Messaging/Topic/TestFailureTopic /CDash/Messaging/Topic/TopicDecorator - cypress/e2e/user-profile image changeid consistenttestingday diff --git a/tests/BrowserTestCase.php b/tests/BrowserTestCase.php index 6f1d3d46e9..c14fd5e9af 100644 --- a/tests/BrowserTestCase.php +++ b/tests/BrowserTestCase.php @@ -7,7 +7,6 @@ use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Config; use Laravel\Dusk\Browser; use Laravel\Dusk\Dusk; use Laravel\Dusk\TestCase as BaseTestCase; @@ -21,33 +20,12 @@ abstract class BrowserTestCase extends BaseTestCase */ public function setUp(): void { - // The APP_URL must be set prior to config initialization so we can correctly generate test URLs. - $env_contents = file_get_contents('/cdash/.env'); - if ($env_contents === false) { - throw new Exception('Unable to read .env file.'); - } - $env_after_substitution = str_replace('APP_URL=http://localhost:8080', 'APP_URL=http://website:8080', $env_contents); - file_put_contents('/cdash/.env', $env_after_substitution); - parent::setUp(); Dusk::selectorHtmlAttribute('data-test'); Browser::$baseUrl = 'http://website:8080'; - Browser::$waitSeconds = 10; - } - - public function tearDown(): void - { - parent::tearDown(); - - $env_contents = file_get_contents(base_path('.env')); - if ($env_contents === false) { - throw new Exception('Unable to read .env file.'); - } - - $env_after_substitution = str_replace('APP_URL=http://website:8080', 'APP_URL=http://localhost:8080', $env_contents); - file_put_contents(base_path('.env'), $env_after_substitution); + Browser::$waitSeconds = 20; } /** diff --git a/tests/cypress/e2e/CMakeLists.txt b/tests/cypress/e2e/CMakeLists.txt index 70e1f04ebe..de11e6b844 100644 --- a/tests/cypress/e2e/CMakeLists.txt +++ b/tests/cypress/e2e/CMakeLists.txt @@ -13,7 +13,7 @@ function(add_cypress_e2e_test TestName) set_tests_properties(cypress/e2e/${TestName} PROPERTIES ENVIRONMENT "HOME=${CDash_BINARY_DIR};" DISABLED "$" - RESOURCE_LOCK "cypress;APP_URL" # Cypress can only run one at a time due to xvfb issues and needs a consistent APP_URL + RESOURCE_LOCK "cypress" # Cypress can only run one at a time due to xvfb issues PROCESSORS 2 ATTACHED_FILES_ON_FAIL "${CDash_SOURCE_DIR}/storage/logs/cdash.log" ) @@ -21,7 +21,7 @@ endfunction() # These tests have the correct dependencies set up add_cypress_e2e_test(user-profile) -set_tests_properties(cypress/e2e/user-profile PROPERTIES DEPENDS install_1) +set_tests_properties(cypress/e2e/user-profile PROPERTIES DEPENDS install_2) add_cypress_e2e_test(query-tests) set_tests_properties(cypress/e2e/query-tests PROPERTIES DEPENDS cypress/e2e/remove-build)