From b7ccb47f5b148c54edbc0b3336e391a21a04d585 Mon Sep 17 00:00:00 2001 From: Alexander Kellner Date: Fri, 20 Dec 2024 16:41:25 +0100 Subject: [PATCH] [TASK] Adjust some configuration for the tests --- Makefile | 2 +- .../_support/Helper/MiscellaneousHelper.php | 46 +++++++++++++++++++ Tests/Acceptance/acceptance.suite.yml | 2 +- .../Backend/AnalyseDashboardCest.php | 36 +++++++++++++++ ...dLoginCest.php => ModulesExistingCest.php} | 2 +- 5 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 Tests/Acceptance/_support/Helper/MiscellaneousHelper.php create mode 100644 Tests/Acceptance/acceptance/Backend/AnalyseDashboardCest.php rename Tests/Acceptance/acceptance/Backend/{BackendLoginCest.php => ModulesExistingCest.php} (93%) diff --git a/Makefile b/Makefile index 9c7bdad0..b954f2ed 100644 --- a/Makefile +++ b/Makefile @@ -239,7 +239,7 @@ test-acceptance: .selenium-start sleep 2 && \ ./.Build/bin/codecept clean && \ ./.Build/bin/codecept build && \ - ./.Build/bin/codecept run acceptance" + ./.Build/bin/codecept run acceptance --debug" echo "$(EMOJI_broom) Cleaning up selenium services"; \ make .selenium-stop; \ exit $${EXIT_CODE:-0} diff --git a/Tests/Acceptance/_support/Helper/MiscellaneousHelper.php b/Tests/Acceptance/_support/Helper/MiscellaneousHelper.php new file mode 100644 index 00000000..6e6be6c1 --- /dev/null +++ b/Tests/Acceptance/_support/Helper/MiscellaneousHelper.php @@ -0,0 +1,46 @@ +getModule('WebDriver') + ->moduleContainer + ->getModule('VisualCeption') + ->_reconfigure(['fullScreenShot' => true]); + } + + /** + * This function allows to disable the fullScreenShot feature + * for a specific test. + * + * The configuration is only valid vor the test where the function is called. + * After the test the configuration is restored to the default. + * + * + * @throws \Codeception\Exception\ModuleConfigException + * @throws \Codeception\Exception\ModuleException + */ + public function disableFullScreenShot() + { + $this + ->getModule('WebDriver') + ->moduleContainer + ->getModule('VisualCeption') + ->_reconfigure(['fullScreenShot' => false]); + } +} diff --git a/Tests/Acceptance/acceptance.suite.yml b/Tests/Acceptance/acceptance.suite.yml index cc31a024..6163af55 100644 --- a/Tests/Acceptance/acceptance.suite.yml +++ b/Tests/Acceptance/acceptance.suite.yml @@ -7,9 +7,9 @@ modules: host: seleniarm-hub port: 4444 path: '/wd/hub' + window_size: 1920x1080 connection_timeout: 5 restart: true - window_size: maximize capabilities: browserName: "chrome" acceptInsecureCerts: true diff --git a/Tests/Acceptance/acceptance/Backend/AnalyseDashboardCest.php b/Tests/Acceptance/acceptance/Backend/AnalyseDashboardCest.php new file mode 100644 index 00000000..6b6003ef --- /dev/null +++ b/Tests/Acceptance/acceptance/Backend/AnalyseDashboardCest.php @@ -0,0 +1,36 @@ +loginToBackend($I); + } + + public function loginToBackendSuccessfully(AcceptanceTester $I) + { + $I->click('Analyse'); + + // Warte auf den Container, in dem die AJAX-Inhalte geladen werden + $I->waitForElement('.panel-heading', 30); + + // Alternative Methoden zum Warten: + $I->waitForText('Top 10', 30); // Wartet bis zu 30 Sekunden auf den Text + // ODER + $I->waitForAjax(30); // Wartet auf AJAX-Requests + + // Jetzt erst nach dem Text suchen + $I->see('Top 10'); + + // Optional: Debug-Hilfen + $I->makeScreenshot('after_ajax_load'); + + // Weitere Tests... + //$I->see('Seitenaufrufe'); + //$I->selectOption('#time', ['value' => '1']); + } +} diff --git a/Tests/Acceptance/acceptance/Backend/BackendLoginCest.php b/Tests/Acceptance/acceptance/Backend/ModulesExistingCest.php similarity index 93% rename from Tests/Acceptance/acceptance/Backend/BackendLoginCest.php rename to Tests/Acceptance/acceptance/Backend/ModulesExistingCest.php index d5d8a371..d827dde1 100644 --- a/Tests/Acceptance/acceptance/Backend/BackendLoginCest.php +++ b/Tests/Acceptance/acceptance/Backend/ModulesExistingCest.php @@ -4,7 +4,7 @@ use In2code\Lux\Tests\AcceptanceTester; -class BackendLoginCest +class ModulesExistingCest { public function _before(AcceptanceTester $I) {