Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions app/cdash/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 1 addition & 23 deletions tests/BrowserTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ function(add_cypress_e2e_test TestName)
set_tests_properties(cypress/e2e/${TestName} PROPERTIES
ENVIRONMENT "HOME=${CDash_BINARY_DIR};"
DISABLED "$<STREQUAL:${CDASH_IMAGE},ubi>"
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"
)
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)
Expand Down
Loading