From 7e46d7e04bdec53cfe028acdbbcd09057e1a9bbb Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 17 Apr 2026 22:41:48 +0200 Subject: [PATCH 1/4] CI: Test Behat optimizations --- .github/workflows/behat.yml | 4 +- tests/behat/features/SpecialCase1.feature | 142 ------------------ tests/behat/features/actionInstall.feature | 3 - tests/behat/features/actionUserCheck.feature | 2 - tests/behat/features/actionUserLogin.feature | 1 - .../features/adminChamiloOrgBlock.feature | 10 -- tests/behat/features/adminCourseBlock.feature | 11 -- tests/behat/features/adminFillCourses.feature | 2 - tests/behat/features/adminFillUsers.feature | 1 - tests/behat/features/adminHealthBlock.feature | 3 - .../behat/features/adminPlatformBlock.feature | 19 --- .../behat/features/adminSecurityBlock.feature | 2 - .../behat/features/adminSessionBlock.feature | 13 -- tests/behat/features/adminSettings.feature | 3 - tests/behat/features/adminSkillsBlock.feature | 7 - tests/behat/features/adminSystemBlock.feature | 11 -- tests/behat/features/adminUserBlock.feature | 9 -- .../features/bootstrap/FeatureContext.php | 32 ++-- tests/behat/features/career.feature | 4 - tests/behat/features/class.feature | 2 - tests/behat/features/companyReports.feature | 7 - tests/behat/features/course.feature | 50 ------ tests/behat/features/courseCatalogue.feature | 11 -- tests/behat/features/courseCategory.feature | 3 - .../features/course_user_registration.feature | 5 - tests/behat/features/createUser.feature | 8 - tests/behat/features/createUserViaCSV.feature | 2 - tests/behat/features/extraFieldUser.feature | 1 - tests/behat/features/profile.feature | 2 - tests/behat/features/promotion.feature | 4 - tests/behat/features/questionPool.feature | 10 -- tests/behat/features/registration.feature | 1 - tests/behat/features/sessionAccess.feature | 6 - .../behat/features/sessionManagement.feature | 12 -- tests/behat/features/skill.feature | 11 -- tests/behat/features/socialGroup.feature | 1 - .../features/systemAnnouncements.feature | 2 - tests/behat/features/ticket.feature | 8 - tests/behat/features/toolAgenda.feature | 2 - tests/behat/features/toolAnnouncement.feature | 3 - tests/behat/features/toolAssessments.feature | 24 --- tests/behat/features/toolAssignment.feature | 10 -- tests/behat/features/toolAttendance.feature | 5 - tests/behat/features/toolChat.feature | 3 - .../features/toolCoursedescription.feature | 4 - tests/behat/features/toolDocument.feature | 8 - tests/behat/features/toolDropbox.feature | 2 - .../behat/features/toolExerciseAdmin.feature | 38 ----- .../features/toolExerciseTeacher.feature | 38 ----- tests/behat/features/toolForum.feature | 6 - tests/behat/features/toolGlossary.feature | 6 - tests/behat/features/toolGroup.feature | 50 ------ tests/behat/features/toolLink.feature | 5 - tests/behat/features/toolLp.feature | 15 -- tests/behat/features/toolNotebook.feature | 2 - tests/behat/features/toolPortfolio.feature | 1 - tests/behat/features/toolReporting.feature | 2 - tests/behat/features/toolThematic.feature | 4 - tests/behat/features/toolUsers.feature | 3 - tests/behat/features/toolWiki.feature | 2 - tests/behat/features/toolWork.feature | 4 - 61 files changed, 18 insertions(+), 644 deletions(-) diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml index 59fa3bc7a41..807e098de61 100644 --- a/.github/workflows/behat.yml +++ b/.github/workflows/behat.yml @@ -95,9 +95,6 @@ jobs: # https://github.com/marketplace/actions/setup-chromedriver - name: Start chromedriver uses: nanasess/setup-chromedriver@master - with: - # Optional: do not specify to match Chrome's version - chromedriver-version: '100.0.4896.60' - run: | export DISPLAY=:99 @@ -147,6 +144,7 @@ jobs: sed -i "s/APP_DEBUG='1'/APP_DEBUG='0'/g" .env printf '\nwhen@prod:\n framework:\n http_cache: true\n' >> config/packages/framework.yaml sudo php bin/console cache:clear + sudo php bin/console cache:warmup sudo chmod -R 777 var - name: Behat tests diff --git a/tests/behat/features/SpecialCase1.feature b/tests/behat/features/SpecialCase1.feature index d56eab7fc0c..b66a0f41245 100644 --- a/tests/behat/features/SpecialCase1.feature +++ b/tests/behat/features/SpecialCase1.feature @@ -5,11 +5,9 @@ Feature: Special admin settings flows Background: Given I am a platform administrator - And I wait very long for the page to be loaded Scenario: Initial platform searches and basic settings Given I am on "/admin" - And I wait very long for the page to be loaded # Diagnostic search When I fill in the following: @@ -41,10 +39,8 @@ Feature: Special admin settings flows # Additional check: the homepage must display "Diagnosis management" And I am on "/home" - And I wait very long for the page to be loaded Then I should see "Diagnosis management" And I am on "/admin" - And I wait very long for the page to be loaded # Multiple anonymous users When I fill in the following: @@ -67,11 +63,8 @@ Feature: Special admin settings flows # Additional check: on /home we must not see "Explore more courses" And I am on "/home" - And I wait very long for the page to be loaded Then I should not see "Explore more courses" - And I wait very long for the page to be loaded And I am on "/admin" - And I wait very long for the page to be loaded # Certificate links When I fill in the following: @@ -86,11 +79,9 @@ Feature: Special admin settings flows And I am not logged And I am logged as "acostea" And I am on "/home" - And I wait very long for the page to be loaded Then I should not see "My certificates" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | allow_general_certificate | @@ -249,9 +240,7 @@ Feature: Special admin settings flows # Login as first student and open messaging Given I am not logged Then I am logged as "studentone" - And I wait very long for the page to be loaded And I am on "resources/messages" - And I wait very long for the page to be loaded When I press "mdi-email-plus-outline" And I wait very long for the page to be loaded And I should not see an error @@ -266,7 +255,6 @@ Feature: Special admin settings flows Then I should not see an error And I am not logged Then I am logged as "admin" - And wait very long for the page to be loaded # Cookie, registration, terms and extra fields When I fill in the following: @@ -288,7 +276,6 @@ Feature: Special admin settings flows # Verify that, when logged out, the homepage offers a "Sign up" button to main/auth/registration.php Given I am not logged And I am on "/home" - And I wait very long for the page to be loaded Then I should see "Sign up" When I follow "Sign up" And I wait very long for the page to be loaded @@ -296,7 +283,6 @@ Feature: Special admin settings flows And I should not see an error And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | allow_registration_as_teacher | @@ -308,12 +294,10 @@ Feature: Special admin settings flows And I am not logged And I am on "/main/auth/registration.php" - And wait very long for the page to be loaded And I should see "Follow courses" And I should not see "Teach courses" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | allow_terms_conditions | @@ -332,7 +316,6 @@ Feature: Special admin settings flows # 1) Gender (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Genre | @@ -349,7 +332,6 @@ Feature: Special admin settings flows # 2) Date of birth (Date) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Date de naissance | @@ -364,7 +346,6 @@ Feature: Special admin settings flows # 3) Nationality (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Nationalité | @@ -379,7 +360,6 @@ Feature: Special admin settings flows # 4) Address (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Adresse | @@ -394,7 +374,6 @@ Feature: Special admin settings flows # 5) Postal code (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Code postal | @@ -409,7 +388,6 @@ Feature: Special admin settings flows # 6) City (Geolocalization) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Ville | @@ -424,7 +402,6 @@ Feature: Special admin settings flows # 7) Country of residence (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Pays de Résidence | @@ -439,7 +416,6 @@ Feature: Special admin settings flows # 8) Target learning language (Select) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Langue cible d'apprentissage | @@ -456,7 +432,6 @@ Feature: Special admin settings flows # 9) Currently, I am (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Actuellement, je suis | @@ -473,7 +448,6 @@ Feature: Special admin settings flows # 10) Field of study (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je suis actuellement dans une filière ou je suis diplômé(e) d’une filière | @@ -493,7 +467,6 @@ Feature: Special admin settings flows # 11) Last diploma obtained (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Dernier diplôme obtenu | @@ -508,7 +481,6 @@ Feature: Special admin settings flows # 12) Internship city (Geolocalization) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Ville du stage | @@ -523,7 +495,6 @@ Feature: Special admin settings flows # 13) If your field is not indicated... (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Si ta filière n’est pas indiquée ci-dessus, veux-tu la préciser ici ? | @@ -538,7 +509,6 @@ Feature: Special admin settings flows # 14) During this period... hours per week (Integer) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Pendant cette durée, je peux / je veux consacrer en moyenne en heures par semaine à mon apprentissage sur la plateforme. | @@ -553,7 +523,6 @@ Feature: Special admin settings flows # 15) My internship starts on (Date) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Mon stage commence le | @@ -568,7 +537,6 @@ Feature: Special admin settings flows # 16) and ends on (Date) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | et dure jusqu’au | @@ -583,7 +551,6 @@ Feature: Special admin settings flows # 17) During my internship... hours per week (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Pendant mon stage, je peux / je veux consacrer en moyenne en heures par semaine à mon apprentissage sur la plateforme. | @@ -598,7 +565,6 @@ Feature: Special admin settings flows # 18) I wish to continue... during my internship (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je souhaite poursuivre mon apprentissage sur la plateforme pendant mon stage. | @@ -615,7 +581,6 @@ Feature: Special admin settings flows # 19) Learning objective (Tag) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Objectif d'apprentissage | @@ -630,7 +595,6 @@ Feature: Special admin settings flows # 20) I like to work (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | J’aime travailler | @@ -647,7 +611,6 @@ Feature: Special admin settings flows # 21) I wish to be supported (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je souhaite etre accompagne(e) | @@ -664,7 +627,6 @@ Feature: Special admin settings flows # 22) termactivated (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | termactivated | @@ -679,7 +641,6 @@ Feature: Special admin settings flows # 23) I want to do the internship in this field (Radio) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je veux faire le stage dans cette filiere | @@ -696,7 +657,6 @@ Feature: Special admin settings flows # 24) PlatformUseConditions (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | PlatformUseConditions | @@ -713,7 +673,6 @@ Feature: Special admin settings flows # 25) DiagnosisCompleted (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | DiagnosisCompleted | @@ -728,7 +687,6 @@ Feature: Special admin settings flows # 26) Je ne connais pas encore mes dates de stage (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je ne connais pas encore mes dates de stage | @@ -743,7 +701,6 @@ Feature: Special admin settings flows # 27) En general, je suis plutot disponible (Select multiple) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | En general, je suis plutot disponible | @@ -758,7 +715,6 @@ Feature: Special admin settings flows # 28) Je suis deja sur place /mon stage/mon emploi a deja commence (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Je suis deja sur place /mon stage/mon emploi a deja commence | @@ -773,7 +729,6 @@ Feature: Special admin settings flows # 29) Un ordinateur fixe ou portable (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Un ordinateur fixe ou portable | @@ -790,7 +745,6 @@ Feature: Special admin settings flows # 30) Une tablette (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Une tablette | @@ -805,7 +759,6 @@ Feature: Special admin settings flows # 31) Un smartphone (Checkbox) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Un smartphone | @@ -820,7 +773,6 @@ Feature: Special admin settings flows # 32) Quel est le systeme d'exploitation ? (computer) (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Quel est le systeme d'exploitation ? | @@ -835,7 +787,6 @@ Feature: Special admin settings flows # 33) Quel est le systeme d'exploitation ? (tablet) (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Quel est le systeme d'exploitation ? | @@ -850,7 +801,6 @@ Feature: Special admin settings flows # 34) Quel est le systeme d'exploitation ? (smartphone) (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Quel est le systeme d'exploitation ? | @@ -865,7 +815,6 @@ Feature: Special admin settings flows # 35) Pour travailler sur la plateforme, j'utilise le browser suivant : (Select multiple) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Pour travailler sur la plateforme, j'utilise le browser suivant : | @@ -880,7 +829,6 @@ Feature: Special admin settings flows # 36) Autre (preciser) : (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Autre (preciser) : | @@ -895,7 +843,6 @@ Feature: Special admin settings flows # 37) Quelle est la version ? (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Quelle est la version ? | @@ -910,7 +857,6 @@ Feature: Special admin settings flows # 38) Hobbies (Tag) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Hobbies | @@ -925,7 +871,6 @@ Feature: Special admin settings flows # 39) State (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | State | @@ -940,7 +885,6 @@ Feature: Special admin settings flows # 40) Level (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Level | @@ -955,7 +899,6 @@ Feature: Special admin settings flows # 41) Quality (Text) And I am on "/main/admin/extra_fields.php?type=user" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #user_field_display_text | Quality | @@ -972,11 +915,9 @@ Feature: Special admin settings flows Scenario: Add minimal session extra fields Given I am a platform administrator - And I wait very long for the page to be loaded # 1) Je commence mon apprentissage sur la plateforme le (Date) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Je commence mon apprentissage sur la plateforme le | @@ -991,7 +932,6 @@ Feature: Special admin settings flows # 2) Je suis disponible jusqu'au (Date) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Je suis disponible jusqu'au | @@ -1008,7 +948,6 @@ Feature: Special admin settings flows # 3) Je souhaite m'inscrire dans une filière (Radio) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Je souhaite m'inscrire dans une filière | @@ -1025,7 +964,6 @@ Feature: Special admin settings flows # 4) Les îlots d'apprentissage (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Les îlots d'apprentissage sont conçus autour des trois grands domaines suivants. Numérote-les de 1 à 3 selon tes priorités et tes intérêts. | @@ -1042,7 +980,6 @@ Feature: Special admin settings flows # 5) Temps de travail (Integer) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Temps de travail | @@ -1057,7 +994,6 @@ Feature: Special admin settings flows # 6) Choisis 5 thèmes et objectifs (Tag) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Choisis 5 thèmes et objectifs et numérote-les de 1 à 5. | @@ -1072,7 +1008,6 @@ Feature: Special admin settings flows # 7) Ecouter (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Ecouter | @@ -1087,12 +1022,10 @@ Feature: Special admin settings flows And I press "user_field_submit" Then I should not see an error - And I wait very long for the page to be loaded # 8) Lire (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Lire | @@ -1109,7 +1042,6 @@ Feature: Special admin settings flows # 9) Participer a une conversation (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Participer à une conversation | @@ -1126,7 +1058,6 @@ Feature: Special admin settings flows # 10) S'exprimer oralement en continu (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | S'exprimer oralement en continu | @@ -1143,7 +1074,6 @@ Feature: Special admin settings flows # 11) Ecrire (Select multiple) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Ecrire | @@ -1160,7 +1090,6 @@ Feature: Special admin settings flows # 12) Thema (Tag) And I am on "/main/admin/extra_fields.php?type=session" - And I wait very long for the page to be loaded When I click the "i.mdi-plus-box" element And I fill in the following: | #session_field_display_text | Thema | @@ -1175,7 +1104,6 @@ Feature: Special admin settings flows Then I should not see an error - And I wait very long for the page to be loaded When I fill in the following: | search_keyword | required_extra_fields_in_inscription | And I press "search_search" @@ -1201,7 +1129,6 @@ Feature: Special admin settings flows And I should see "langue_cible" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded # Registration fields and messages When I fill in the following: @@ -1215,7 +1142,6 @@ Feature: Special admin settings flows And I am not logged And I am on "/main/auth/registration.php" - And I wait very long for the page to be loaded Then I should see "lastname" And I should see "firstname" And I should see "email" @@ -1239,7 +1165,6 @@ Feature: Special admin settings flows And I should see "langue_cible" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | send_inscription_msg_to_inbox | @@ -1261,11 +1186,9 @@ Feature: Special admin settings flows And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded Then I should see "My sessions" And I should not see "Platform administration" And I am on "/admin" - And I wait very long for the page to be loaded # Legal accept, captcha limits and session toggles When I fill in the following: @@ -1311,7 +1234,6 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/session/session_list.php" - And I wait very long for the page to be loaded Then I should see "Past session" And I should see "Present session" And I should see "Session in the future" @@ -1357,12 +1279,10 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/admin/session_list.php" - And I wait very long for the page to be loaded Then I should see "Students" And I should see "#sessions" And I should see "ID" And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | session_admins_access_all_content | @@ -1393,10 +1313,8 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/admin/session_list.php" - And I wait very long for the page to be loaded Then I should see "Custom" And I am on "/admin" - And I wait very long for the page to be loaded # Badges, skills and social When I fill in the following: @@ -1434,7 +1352,6 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "main/skills/skill_create.php" - And I wait very long for the page to be loaded When I fill in the following: | title | NewSkill | | short_code | NS | @@ -1445,7 +1362,6 @@ Feature: Special admin settings flows Then I should see "NewSkill" And I am on "main/skills/skill_create.php" - And I wait very long for the page to be loaded When I fill in the following: | title | SubSkill | | short_code | SS | @@ -1458,12 +1374,10 @@ Feature: Special admin settings flows # Assign parent skill and check subskill list appears for user And I am on "main/skills/assign.php?user=1" - And I wait very long for the page to be loaded When I select "NewSkill" from "skill" And I wait very long for the page to be loaded Then I should see "SubSkill" And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | social_enable_messages_feedback | @@ -1475,7 +1389,6 @@ Feature: Special admin settings flows And I am on "/main/social/home.php" - And I wait very long for the page to be loaded When I fill in the following: | post_text | This is a test post created by behat | And I press "submit" @@ -1484,7 +1397,6 @@ Feature: Special admin settings flows And I should see "Like" And I should see "Dislike" And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | disable_dislike_option | @@ -1495,12 +1407,10 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/social/home.php" - And I wait very long for the page to be loaded # (environment must have dislike disabled for this check) Then I should see "Like" And I should not see "Dislike" And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | social_show_language_flag_in_profile | @@ -1511,10 +1421,8 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/social/home.php" - And I wait very long for the page to be loaded Then I should not see "My communities" And I am on "/admin" - And I wait very long for the page to be loaded # Ticket settings When I fill in the following: @@ -1526,13 +1434,11 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded And I am on "/main/ticket/projects.php?project_id=1" - And I wait very long for the page to be loaded When I follow "Categories" And I wait very long for the page to be loaded Then I should see "Enrollment" And I should see "i.mdi-pencil" And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | ticket_allow_student_add | @@ -1543,14 +1449,11 @@ Feature: Special admin settings flows And I wait very long for the page to be loaded Given I am logged as "studentone" - And I wait very long for the page to be loaded And I am on "/main/ticket/new_ticket.php?project_id=1" - And I wait very long for the page to be loaded Then I should see "Send message" And I should not see an error And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | ticket_send_warning_to_all_admins | @@ -1646,14 +1549,12 @@ Feature: Special admin settings flows Given I am logged as "studentone" And I am on "/main/auth/profile.php" - And I wait very long for the page to be loaded Then I should see "language" And I should see "picture" And I should not see "firstname" And I should not see "lastname" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | visible_options | @@ -1669,14 +1570,12 @@ Feature: Special admin settings flows Then I am logged as "studentone" And I am on "/main/auth/profile.php" - And I wait very long for the page to be loaded Then I should see "official_code" And I should see "email" And I should see "picture" And I should see "language" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | use_users_timezone | @@ -1707,7 +1606,6 @@ Feature: Special admin settings flows And I am not logged And I am logged as "studentone" And I am on "/main/auth/profile.php" - And I wait very long for the page to be loaded Then I should see "firstname" And I should see "lastname" And I should see "picture" @@ -1715,7 +1613,6 @@ Feature: Special admin settings flows And I should see "terms_ville" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | allow_social_map_fields | @@ -1738,13 +1635,11 @@ Feature: Special admin settings flows And I am not logged Then I am logged as "studenttwo" And I am on "/main/auth/terms.php" - And I wait very long for the page to be loaded Then I should see "complete your profile before accepting the terms" And I should see "Accept" # Note: step to check the Accept button is disabled may require an extra step definition; we assert the message appears above. And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | load_term_conditions_section | @@ -1756,14 +1651,11 @@ Feature: Special admin settings flows And I am logged as "studenttwo" And I am on "/home" - And I wait very long for the page to be loaded Then I should not see "Terms and conditions" When I am on "/course/TEMPPRIVATE/home" - And I wait very long for the page to be loaded Then I should see "Terms and conditions" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: @@ -1777,13 +1669,11 @@ Feature: Special admin settings flows Given I am logged as "studentone" And I am on "/" - And I wait very long for the page to be loaded When I follow "Home" And I wait very long for the page to be loaded Then I should see "My sessions" And I am not logged And I am logged as "admin" - And I wait very long for the page to be loaded When I fill in the following: | platform_management_search | default_menu_entry_for_course_or_session | @@ -1797,16 +1687,13 @@ Feature: Special admin settings flows Then I should not see an error And I am logged as "studentthree" - And I wait very long for the page to be loaded Then I should see "My sessions" Scenario: Create courses, multilingual documents, exercises, forum, learning path and assessment activity Given I am a platform administrator - And I wait very long for the page to be loaded # Create courses When I am on "/main/admin/course_add.php" - And I wait very long for the page to be loaded When I fill in the following: | title | Testing course en | And I select "English" from "language" @@ -1815,7 +1702,6 @@ Feature: Special admin settings flows Then I should see "Testing course en" When I am on "/main/admin/course_add.php" - And I wait very long for the page to be loaded When I fill in the following: | title | Special | And I click the "#special_course" element @@ -1824,7 +1710,6 @@ Feature: Special admin settings flows Then I should see "Special" When I am on "/main/admin/course_add.php" - And I wait very long for the page to be loaded When I fill in the following: | title | Testing course fr | And I select "French" from "language" @@ -2010,11 +1895,9 @@ Feature: Special admin settings flows Scenario: Create teacher and configure "Present session" with settings and include course Given I am a platform administrator - And I wait very long for the page to be loaded # Create a teacher account When I am on "/main/admin/user_add.php" - And I wait very long for the page to be loaded And I fill in the following: | firstname | Teacher | | lastname | Teacher | @@ -2029,7 +1912,6 @@ Feature: Special admin settings flows # Create session Present session with start = 2026-01-20 and end = 2026-02-03 When I am on "/main/session/session_add.php" - And I wait very long for the page to be loaded And I fill in the following: | name | Present session | | start_date | 2026-01-20 | @@ -2043,18 +1925,15 @@ Feature: Special admin settings flows When I press "Advanced settings" And I wait very long for the page to be loaded And I select "In progress" from "status" - And I wait very long for the page to be loaded # Set extra fields for the session When I fill in the following: | domaine | vie-quotidienne | And I select "vie-quotidienne" from "domaine" - And I wait very long for the page to be loaded When I fill in the following: | filiere | art-et-culture | And I select "art-et-culture" from "filiere" - And I wait very long for the page to be loaded # theme_fr and theme_de: type and select the suggested option When I fill in "theme_fr" with "theme1" @@ -2073,7 +1952,6 @@ Feature: Special admin settings flows And I select "1" from "participer_a_une_conversation" And I select "1" from "s_exprimer_oralement_en_continu" And I select "1" from "ecrire" - And I wait very long for the page to be loaded # Go to next step and include Testing course fr When I press "Next step" @@ -2091,11 +1969,9 @@ Feature: Special admin settings flows Scenario: Create future session "Session in the futur" and include course Given I am a platform administrator - And I wait very long for the page to be loaded # Create session Session in the futur with start = 2026-02-03 and end = 2026-02-17 When I am on "/main/session/session_add.php" - And I wait very long for the page to be loaded And I fill in the following: | name | Session in the futur | | start_date | 2026-02-03 | @@ -2109,13 +1985,10 @@ Feature: Special admin settings flows When I press "Advanced settings" And I wait very long for the page to be loaded And I select "Planned" from "status" - And I wait very long for the page to be loaded # Set extra fields for the session And I select "arrivee-sur-mon-poste-de-travail" from "domaine" - And I wait very long for the page to be loaded And I select "art-et-culture" from "filiere" - And I wait very long for the page to be loaded # theme_fr and theme_de: type and select the suggested option When I fill in "theme_fr" with "theme1" @@ -2134,7 +2007,6 @@ Feature: Special admin settings flows And I select "1" from "participer_a_une_conversation" And I select "1" from "s_exprimer_oralement_en_continu" And I select "1" from "ecrire" - And I wait very long for the page to be loaded # Go to next step and include Testing course fr When I press "Next step" @@ -2152,11 +2024,9 @@ Feature: Special admin settings flows Scenario: Create past session "Past session" and include course Given I am a platform administrator - And I wait very long for the page to be loaded # Create session Past session with start = 2026-01-06 and end = 2026-01-20 When I am on "/main/session/session_add.php" - And I wait very long for the page to be loaded And I fill in the following: | name | Past session | | start_date | 2026-01-06 | @@ -2170,13 +2040,10 @@ Feature: Special admin settings flows When I press "Advanced settings" And I wait very long for the page to be loaded And I select "Finished" from "status" - And I wait very long for the page to be loaded # Set extra fields for the session And I select "competente-dans-mon-domaine-de-specialite" from "domaine" - And I wait very long for the page to be loaded And I select "art-et-culture" from "filiere" - And I wait very long for the page to be loaded # theme_fr and theme_de: type and select the suggested option (theme2) When I fill in "theme_fr" with "theme2" @@ -2195,7 +2062,6 @@ Feature: Special admin settings flows And I select "1" from "participer_a_une_conversation" And I select "1" from "s_exprimer_oralement_en_continu" And I select "1" from "ecrire" - And I wait very long for the page to be loaded # Go to next step and include Testing course fr When I press "Next step" @@ -2213,11 +2079,9 @@ Feature: Special admin settings flows Scenario: Create future English session "Session in the futur en" and include course Given I am a platform administrator - And I wait very long for the page to be loaded # Create session Session in the futur en with start = 2026-02-03 and end = 2026-02-17 When I am on "/main/session/session_add.php" - And I wait very long for the page to be loaded And I fill in the following: | name | Session in the futur en | | start_date | 2026-02-03 | @@ -2231,13 +2095,10 @@ Feature: Special admin settings flows When I press "Advanced settings" And I wait very long for the page to be loaded And I select "Planned" from "status" - And I wait very long for the page to be loaded # Set extra fields for the session And I select "arrivee-sur-mon-poste-de-travail" from "domaine" - And I wait very long for the page to be loaded And I select "art-et-culture" from "filiere" - And I wait very long for the page to be loaded # theme_fr and theme_de: type and select the suggested option When I fill in "theme_fr" with "theme1" @@ -2256,7 +2117,6 @@ Feature: Special admin settings flows And I select "1" from "participer_a_une_conversation" And I select "1" from "s_exprimer_oralement_en_continu" And I select "1" from "ecrire" - And I wait very long for the page to be loaded # Go to next step and include Testing course en When I press "Next step" @@ -2275,9 +2135,7 @@ Feature: Special admin settings flows Scenario: Tare Down Given I am a platform administrator - And I wait very long for the page to be loaded And I am on "/admin" - And I wait very long for the page to be loaded When I fill in the following: diff --git a/tests/behat/features/actionInstall.feature b/tests/behat/features/actionInstall.feature index 1f96aff8099..7a2f41a9a97 100644 --- a/tests/behat/features/actionInstall.feature +++ b/tests/behat/features/actionInstall.feature @@ -3,7 +3,6 @@ Feature: Install portal Scenario: Installation process Given I am on "/main/install/index.php" - And I wait for the page to be loaded when ready Then I should see "Step 1 - Installation Language" Then I press "Next" Then I should see "Step 2 - Requirements" @@ -13,7 +12,6 @@ Feature: Install portal Then I check "accept_licence" Then I press "license-next" Then I should see "Step 4 - Database settings" - Then wait for the page to be loaded Then I fill in the following: | dbUsernameForm | root | | dbPassForm | root | @@ -30,7 +28,6 @@ Feature: Install portal | mailerFromName | Chamilo Behat install | Then I press "step5" Then I should see "Step 6 - Last check before install" - When I wait for the page to be loaded And I press "button_step6" And I wait one minute for the page to be loaded Then I should see "Step 7" diff --git a/tests/behat/features/actionUserCheck.feature b/tests/behat/features/actionUserCheck.feature index 4c9a12ec772..8cd942ad65b 100644 --- a/tests/behat/features/actionUserCheck.feature +++ b/tests/behat/features/actionUserCheck.feature @@ -3,7 +3,6 @@ Feature: User check after installation Scenario: Check admin information Given I am a platform administrator And I am on "/main/admin/user_list.php?keyword=admin" - And wait for the page to be loaded Then I should see "admin" Then I follow "John" And wait for the page to be loaded @@ -12,7 +11,6 @@ Feature: User check after installation Scenario: Check anon information Given I am a platform administrator And I am on "/main/admin/user_list.php?keyword=anon" - Then wait very long for the page to be loaded Then I should see "anon" Then I should see "anon" diff --git a/tests/behat/features/actionUserLogin.feature b/tests/behat/features/actionUserLogin.feature index 70915e4731a..2ebedc5319f 100644 --- a/tests/behat/features/actionUserLogin.feature +++ b/tests/behat/features/actionUserLogin.feature @@ -2,7 +2,6 @@ Feature: Login user Scenario: Login as admin user successfully Given I am on "/login" - And wait very long for the page to be loaded Then I should see "Sign in" When I fill in "admin" for "login" And I fill in "admin" for "password" diff --git a/tests/behat/features/adminChamiloOrgBlock.feature b/tests/behat/features/adminChamiloOrgBlock.feature index 1cb502a532e..c6bae84a31c 100644 --- a/tests/behat/features/adminChamiloOrgBlock.feature +++ b/tests/behat/features/adminChamiloOrgBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Chamilo.org block navigation Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Chamilo homepage Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Chamilo homepage" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open User guides Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "User guides" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Chamilo forum Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Chamilo forum" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Installation guide Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Installation guide" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Changes in last version Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Changes in last version" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Contributors list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Contributors list" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Security guide Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Security guide" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Optimization guide Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Optimization guide" And I wait for the page to be loaded @@ -81,7 +72,6 @@ Feature: Admin Chamilo.org block navigation Scenario: Open Chamilo official services providers Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Chamilo official services providers" And I wait for the page to be loaded diff --git a/tests/behat/features/adminCourseBlock.feature b/tests/behat/features/adminCourseBlock.feature index 7136486bfe6..e01d4621033 100644 --- a/tests/behat/features/adminCourseBlock.feature +++ b/tests/behat/features/adminCourseBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Course management block Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Course list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Course list" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Course management block Scenario: Open Add course Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Add course" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin Course management block Scenario: Open Export courses Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Export courses" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin Course management block Scenario: Open Import courses list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import courses list" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin Course management block Scenario: Open Course categories Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Course categories" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin Course management block Scenario: Open Add a user to a course Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Add a user to a course" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin Course management block Scenario: Open Import users list (course block) Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import users list" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin Course management block Scenario: Open Manage extra fields for courses Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Manage extra fields for courses" And I wait for the page to be loaded @@ -73,7 +64,6 @@ Feature: Admin Course management block Scenario: Open Questions Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Questions" And I wait for the page to be loaded @@ -81,7 +71,6 @@ Feature: Admin Course management block Scenario: Open Resources sequencing Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Resources sequencing" And I wait for the page to be loaded diff --git a/tests/behat/features/adminFillCourses.feature b/tests/behat/features/adminFillCourses.feature index 509e6238758..64ced0c769c 100644 --- a/tests/behat/features/adminFillCourses.feature +++ b/tests/behat/features/adminFillCourses.feature @@ -5,9 +5,7 @@ Feature: Admin fill courses and subscribe users Scenario: Admin fills courses then subscribes a user to a course with long waits Given I am on "/main/admin/filler.php?fill=courses" - When wait very long for the page to be loaded When I am on "/main/admin/subscribe_user2course.php" - And wait very long for the page to be loaded And I select "ywarnier" from "UserList[]" And I select "(SOLARSYSTEM) Our solar system" from "CourseList[]" When I click the "button.btn--primary" element diff --git a/tests/behat/features/adminFillUsers.feature b/tests/behat/features/adminFillUsers.feature index 0dbd1dbd93a..259b7a1fd65 100644 --- a/tests/behat/features/adminFillUsers.feature +++ b/tests/behat/features/adminFillUsers.feature @@ -3,7 +3,6 @@ Feature: Fill users Scenario: Create tests users successfully Given I am a platform administrator Then I am on "/main/admin/filler.php?fill=users" - And I wait one minute for the page to be loaded Then I should see "Inserted" And I should not see an error diff --git a/tests/behat/features/adminHealthBlock.feature b/tests/behat/features/adminHealthBlock.feature index d42549dc6b4..107941a5f81 100644 --- a/tests/behat/features/adminHealthBlock.feature +++ b/tests/behat/features/adminHealthBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Health check block Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Health check Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Health check" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Health check block Scenario: See health warnings Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Health check" And I wait for the page to be loaded diff --git a/tests/behat/features/adminPlatformBlock.feature b/tests/behat/features/adminPlatformBlock.feature index 527debe6516..55a1325284e 100644 --- a/tests/behat/features/adminPlatformBlock.feature +++ b/tests/behat/features/adminPlatformBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Platform management block Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Configuration settings Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Configuration settings" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Platform management block Scenario: Open Languages Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Languages" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin Platform management block Scenario: Open Plugins Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Plugins" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin Platform management block Scenario: Open Regions Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Regions" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin Platform management block Scenario: Open Portal news Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Portal news" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin Platform management block Scenario: Open Global agenda Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Global agenda" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin Platform management block Scenario: Open Import course events Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import course events" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin Platform management block Scenario: Open Pages Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Pages" And I wait for the page to be loaded @@ -73,7 +64,6 @@ Feature: Admin Platform management block Scenario: Open Setting the registration page Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Setting the registration page" And I wait for the page to be loaded @@ -81,7 +71,6 @@ Feature: Admin Platform management block Scenario: Open Statistics Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Statistics" And I wait for the page to be loaded @@ -89,7 +78,6 @@ Feature: Admin Platform management block Scenario: Open Reports Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Reports" And I wait for the page to be loaded @@ -97,7 +85,6 @@ Feature: Admin Platform management block Scenario: Open Teachers time report Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Teachers time report" And I wait for the page to be loaded @@ -105,7 +92,6 @@ Feature: Admin Platform management block Scenario: Open Extra fields Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Extra fields" And I wait for the page to be loaded @@ -113,7 +99,6 @@ Feature: Admin Platform management block Scenario: Open Configure multiple access URL Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Configure multiple access URL" And I wait for the page to be loaded @@ -121,7 +106,6 @@ Feature: Admin Platform management block Scenario: Open Mail templates Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Mail templates" And I wait for the page to be loaded @@ -129,7 +113,6 @@ Feature: Admin Platform management block Scenario: Open External tools (LTI) Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "External tools (LTI)" And I wait for the page to be loaded @@ -137,7 +120,6 @@ Feature: Admin Platform management block Scenario: Open Contact form categories Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Contact form categories" And I wait for the page to be loaded @@ -145,7 +127,6 @@ Feature: Admin Platform management block Scenario: Open System templates Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "System templates" And I wait for the page to be loaded diff --git a/tests/behat/features/adminSecurityBlock.feature b/tests/behat/features/adminSecurityBlock.feature index 1f0e8bf8783..55865524589 100644 --- a/tests/behat/features/adminSecurityBlock.feature +++ b/tests/behat/features/adminSecurityBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Security block navigation Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Login attempts Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Login attempts" And I wait for the page to be loaded diff --git a/tests/behat/features/adminSessionBlock.feature b/tests/behat/features/adminSessionBlock.feature index 3865e986f0d..5039159342e 100644 --- a/tests/behat/features/adminSessionBlock.feature +++ b/tests/behat/features/adminSessionBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Sessions management block Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Training sessions list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Training sessions list" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Sessions management block Scenario: Open Add a training session Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Add a training session" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin Sessions management block Scenario: Open Sessions categories list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Sessions categories list" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin Sessions management block Scenario: Open Import sessions list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import sessions list" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin Sessions management block Scenario: Open Import list of HR directors into sessions Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import list of HR directors into sessions" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin Sessions management block Scenario: Open Export sessions list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Export sessions list" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin Sessions management block Scenario: Open Copy from course in session to another session Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Copy from course in session to another session" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin Sessions management block Scenario: Open Move users results from base course to a session Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Move users results from base course to a session" And I wait for the page to be loaded @@ -73,7 +64,6 @@ Feature: Admin Sessions management block Scenario: Open Careers and promotions Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Careers and promotions" And I wait for the page to be loaded @@ -81,7 +71,6 @@ Feature: Admin Sessions management block Scenario: Open Manage session fields Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Manage session fields" And I wait for the page to be loaded @@ -89,7 +78,6 @@ Feature: Admin Sessions management block Scenario: Open Resources sequencing (sessions) Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Resources sequencing" And I wait for the page to be loaded @@ -97,7 +85,6 @@ Feature: Admin Sessions management block Scenario: Open Export all results from an exercise Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Export all results from an exercise" And I wait for the page to be loaded diff --git a/tests/behat/features/adminSettings.feature b/tests/behat/features/adminSettings.feature index 5a7f924d4d3..7503f9836e4 100644 --- a/tests/behat/features/adminSettings.feature +++ b/tests/behat/features/adminSettings.feature @@ -6,7 +6,6 @@ Feature: Settings update Scenario: Update 'profile' setting Given I am a platform administrator And I am on "/admin/settings/search_settings?keyword=changeable_options" - And wait for the page to be loaded And I select "Name" from "form_changeable_options" And I additionally select "E-mail" from "form_changeable_options" And I additionally select "Official code" from "form_changeable_options" @@ -18,7 +17,6 @@ Feature: Settings update Scenario: Update 'allow_registration' setting Given I am a platform administrator And I am on "/admin/settings/search_settings?keyword=allow_registration" - And wait for the page to be loaded And I select "Yes" from "form_allow_registration" And I press "Save" And wait for the page to be loaded @@ -27,7 +25,6 @@ Feature: Settings update Scenario: Update 'allow_group_categories' setting Given I am a platform administrator And I am on "/admin/settings/search_settings?keyword=allow_group_categories" - And wait for the page to be loaded And I select "Yes" from "form_allow_group_categories" And I press "Save" And wait for the page to be loaded diff --git a/tests/behat/features/adminSkillsBlock.feature b/tests/behat/features/adminSkillsBlock.feature index 4eebe124e02..073e1d4d3e1 100644 --- a/tests/behat/features/adminSkillsBlock.feature +++ b/tests/behat/features/adminSkillsBlock.feature @@ -5,11 +5,9 @@ Feature: Admin Skills block navigation Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Skills wheel Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Skills wheel" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin Skills block navigation Scenario: Open Skills import Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Skills import" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin Skills block navigation Scenario: Open Manage skills Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Manage skills" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin Skills block navigation Scenario: Open Manage skills levels Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Manage skills levels" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin Skills block navigation Scenario: Open Skills ranking Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Skills ranking" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin Skills block navigation Scenario: Open Skills and assessments Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Skills and assessments" And I wait for the page to be loaded diff --git a/tests/behat/features/adminSystemBlock.feature b/tests/behat/features/adminSystemBlock.feature index ce30124adda..494b19e775b 100644 --- a/tests/behat/features/adminSystemBlock.feature +++ b/tests/behat/features/adminSystemBlock.feature @@ -5,11 +5,9 @@ Feature: Admin System block navigation Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open Clean temporary files Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Clean temporary files" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin System block navigation Scenario: Open Special exports Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Special exports" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin System block navigation Scenario: Open System status Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "System status" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin System block navigation Scenario: Open Data filler Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Data filler" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin System block navigation Scenario: Open E-mail tester Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "E-mail tester" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin System block navigation Scenario: Open Tickets Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Tickets" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin System block navigation Scenario: Open Update session status Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Update session status" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin System block navigation Scenario: Open Colors Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Colors" And I wait for the page to be loaded @@ -73,7 +64,6 @@ Feature: Admin System block navigation Scenario: Open File info Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "File info" And I wait for the page to be loaded @@ -81,7 +71,6 @@ Feature: Admin System block navigation Scenario: Open Resources by type Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Resources by type" And I wait for the page to be loaded diff --git a/tests/behat/features/adminUserBlock.feature b/tests/behat/features/adminUserBlock.feature index 9b04001306c..d6ebf770c0a 100644 --- a/tests/behat/features/adminUserBlock.feature +++ b/tests/behat/features/adminUserBlock.feature @@ -5,11 +5,9 @@ Feature: Admin User management block Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Open User list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "User list" And I wait for the page to be loaded @@ -17,7 +15,6 @@ Feature: Admin User management block Scenario: Open Add a user Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Add a user" And I wait for the page to be loaded @@ -25,7 +22,6 @@ Feature: Admin User management block Scenario: Open Export users list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Export users list" And I wait for the page to be loaded @@ -33,7 +29,6 @@ Feature: Admin User management block Scenario: Open Import users list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Import users list" And I wait for the page to be loaded @@ -41,7 +36,6 @@ Feature: Admin User management block Scenario: Open Edit users list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Edit users list" And I wait for the page to be loaded @@ -49,7 +43,6 @@ Feature: Admin User management block Scenario: Open Anonymise users list Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Anonymise users list" And I wait for the page to be loaded @@ -57,7 +50,6 @@ Feature: Admin User management block Scenario: Open Profiling Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Profiling" And I wait for the page to be loaded @@ -65,7 +57,6 @@ Feature: Admin User management block Scenario: Open Classes Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Classes" And I wait for the page to be loaded diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 1141d17a6c9..84e37da281e 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -91,7 +91,6 @@ public function courseIsDeleted($argument): void public function iAmOnCourseXHomepage($courseCode): void { $this->visit('/main/course_home/redirect.php?cidReq='.$courseCode); - $this->waitForThePageToBeLoaded(); //$this->visit('/courses/'.$courseCode.'/index.php'); $this->assertElementNotOnPage('.alert-danger'); } @@ -103,7 +102,6 @@ public function iAmOnCourseXHomepage($courseCode): void public function iAmOnCourseXHomepageInSessionY($courseCode, $sessionName): void { $this->visit('/main/course_home/redirect.php?cidReq='.$courseCode.'&session_name='.$sessionName); - $this->waitForThePageToBeLoaded(); $this->assertElementNotOnPage('.alert-danger'); } @@ -113,7 +111,6 @@ public function iAmOnCourseXHomepageInSessionY($courseCode, $sessionName): void public function iAmOnTheHomepageOfCourseX($courseId): void { $this->visit('/course/'.$courseId.'/home'); - $this->waitForThePageToBeLoaded(); //$this->visit('/courses/'.$courseCode.'/index.php'); $this->assertElementNotOnPage('.alert-danger'); } @@ -124,7 +121,6 @@ public function iAmOnTheHomepageOfCourseX($courseId): void public function iAmOnTheHomepageOfCourseXInSessionY($courseId, $sessionId): void { $this->visit('/course/'.$courseId.'&sid='.$sessionId); - $this->waitForThePageToBeLoaded(); $this->assertElementNotOnPage('.alert-danger'); } @@ -142,14 +138,12 @@ public function iAmAXUser($argument) */ public function iAmLoggedAs($username) { - //$this->visit('/logout'); + $this->visit('/logout'); $this->visit('/login'); - $this->waitForThePageToBeLoaded(); $this->fillField('login', $username); $this->fillField('password', $username); $this->pressButton('Sign in'); - $this->waitForThePageToBeLoaded(); - //$this->waitForThePageToBeLoaded(); + $this->waitForSelector('.app-topbar'); } /** @@ -525,28 +519,36 @@ public function iFillInSelectWithOptionValue($field, $value, $class) /** * @When /^(?:|I )wait for the page to be loaded$/ */ - public function waitForThePageToBeLoaded() + public function waitForThePageToBeLoaded(): void { - $this->getSession()->wait(8000); + $this->getSession()->wait(8000, "document.readyState === 'complete'"); } /** * @When /^(?:|I )wait very long for the page to be loaded$/ */ - public function waitVeryLongForThePageToBeLoaded() + public function waitVeryLongForThePageToBeLoaded(): void { - //$this->getSession()->wait(10000, "document.readyState === 'complete'"); - $this->getSession()->wait(14000); + $this->getSession()->wait(14000, "document.readyState === 'complete'"); } /** * @When /^(?:|I )wait for the page to be loaded when ready$/ */ - public function waitForThePageToBeLoadedWhenReady() + public function waitForThePageToBeLoadedWhenReady(): void { $this->getSession()->wait(9000, "document.readyState === 'complete'"); } + /** + * @When /^(?:|I )wait for the "([^"]*)" element$/ + */ + public function waitForSelector(string $css, int $timeoutMs = 8000): void + { + $escaped = addslashes($css); + $this->getSession()->wait($timeoutMs, "document.querySelector('$escaped') !== null"); + } + /** * @When /^(?:|I )wait one minute for the page to be loaded$/ */ @@ -692,7 +694,7 @@ public function iAmStudentSubscribedToXSession($sessionName) $this->pressButton('Next step'); $this->assertPageContainsText('Update successful'); $this->fillField('user_to_add', 'acostea'); - $this->waitForThePageToBeLoaded(); + $this->getSession()->wait(3000); // wait for autocomplete results, not page load $this->clickLink('Costea Andrea (acostea)'); $this->pressButton('Finish session creation'); $this->assertPageContainsText('Session overview'); diff --git a/tests/behat/features/career.feature b/tests/behat/features/career.feature index 8bab3267920..d016fbcdb91 100644 --- a/tests/behat/features/career.feature +++ b/tests/behat/features/career.feature @@ -8,7 +8,6 @@ Feature: Career And I am on "/main/admin/career_dashboard.php" Then I should not see an error And I am on "/main/admin/careers.php?action=add" - And wait for the page to be loaded When I fill in the following: | career_title | Developer | And I fill in editor field "description" with "Description" @@ -20,7 +19,6 @@ Feature: Career Scenario: Edit a career Given I am a platform administrator And I am on "/main/admin/careers.php" - And I wait for the page to be loaded Then I should not see an error And I should see "Developer" And I click the "i.mdi-pencil" element @@ -33,7 +31,6 @@ Feature: Career Scenario: Copy a career Given I am a platform administrator And I am on "/main/admin/careers.php" - And I wait for the page to be loaded And I should not see an error And I should see "Developer" When I click the "i.mdi-text-box-plus" element @@ -45,7 +42,6 @@ Feature: Career Scenario: Delete a career Given I am a platform administrator And I am on "/main/admin/careers.php" - And I wait for the page to be loaded Then I should not see an error And I should see "Developer" When I click the "i.mdi-delete" element diff --git a/tests/behat/features/class.feature b/tests/behat/features/class.feature index a223876899f..54523d85322 100644 --- a/tests/behat/features/class.feature +++ b/tests/behat/features/class.feature @@ -17,7 +17,6 @@ Feature: Classes Scenario: Update a class Given I am a platform administrator And I am on "/main/admin/usergroups.php" - And wait very long for the page to be loaded Then I should see "Class 1" And I click the "i.mdi-pencil" element And I wait for the page to be loaded @@ -31,7 +30,6 @@ Feature: Classes Scenario: Delete a class Given I am a platform administrator And I am on "/main/admin/usergroups.php" - And wait for the page to be loaded Then I should see "Class 1" When I click the "i.mdi-delete" element And I confirm the popup diff --git a/tests/behat/features/companyReports.feature b/tests/behat/features/companyReports.feature index 631fa7ba562..245786c00d0 100644 --- a/tests/behat/features/companyReports.feature +++ b/tests/behat/features/companyReports.feature @@ -7,41 +7,34 @@ Feature: Access to portal reports as admin Scenario: See the company reports link on the admin page Given I am a platform administrator And I am on "/main/admin/index.php" - And wait for the page to be loaded Then I should see "Reports" Scenario: Access the company report Given I am a platform administrator And I am on "/main/my_space/company_reports.php" - And I wait for the page to be loaded Then I should not see "not authorized" Scenario: Access the resumed version of the company report Given I am a platform administrator And I am on "/main/my_space/company_reports_resumed.php" - And I wait for the page to be loaded Then I should not see "not authorized" Scenario: See the company reports link on the admin page Given I am a platform administrator And I am on "/main/admin/teacher_time_report.php" - And I wait for the page to be loaded Then I should not see an error Scenario: See the company reports link on the admin page Given I am a platform administrator And I am on "/main/admin/teacher_time_report.php" - And I wait for the page to be loaded Then I should not see "not authorized" Scenario: See the company reports link on the admin page Given I am a platform administrator And I am on "/main/admin/teachers_time_by_session_report.php" - And I wait for the page to be loaded Then I should see "Teachers time report by session" Scenario: See the company reports link on the admin page Given I am a platform administrator And I am on "/main/admin/teachers_time_by_session_report.php" - And I wait for the page to be loaded Then I should not see "not authorized" diff --git a/tests/behat/features/course.feature b/tests/behat/features/course.feature index 19f652a8e5d..13822e2c81e 100644 --- a/tests/behat/features/course.feature +++ b/tests/behat/features/course.feature @@ -13,20 +13,16 @@ Feature: Course tools basic testing Scenario: See the courses list Given I am on "/admin/course-list" - And I wait for the page to be loaded And I should not see "not authorized" Scenario: See the course creation link on the admin page Given I am on "/main/admin/index.php" - And I wait for the page to be loaded - And I wait for the page to be loaded Then I should see "Add course" Scenario: Create a course before testing Given I am on "/main/admin/course_add.php" - And I wait for the page to be loaded And I fill in "title" with "TEMP" When I press "submit" And wait very long for the page to be loaded @@ -35,21 +31,17 @@ Feature: Course tools basic testing Scenario: Make sure the course exists Given I am on course "TEMP" homepage - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the course description tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/course_description/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the documents tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded When I follow "Documents" And I wait for the page to be loaded Then I should not see an error @@ -57,39 +49,30 @@ Feature: Course tools basic testing Scenario: Make sure the learning path tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/lp/lp_controller.php?action=list&cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the links tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/link/link.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the tests tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/exercise/exercise.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the announcements tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/announcements/announcements.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the assessments tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/gradebook/index.php?cid=1" And wait the page to be loaded when ready Then I should not see an error @@ -97,63 +80,48 @@ Feature: Course tools basic testing Scenario: Make sure the glossary tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/glossary/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the attendances tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the course progress tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/course_progress/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the agenda tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/calendar/agenda_js.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the forums tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/forum/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the dropbox tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/dropbox/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the users tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/user/user.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the groups tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/group/group.php?cid=1" - And I wait for the page to be loaded Then I should not see an error @@ -161,15 +129,12 @@ Feature: Course tools basic testing Scenario: Make sure the chat tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/resources/chat/?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the assignments tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And I wait for the page to be loaded Then I should not see an error @@ -177,31 +142,24 @@ Feature: Course tools basic testing Scenario: Make sure the surveys tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/survey/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the wiki tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/wiki/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the notebook tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/notebook/index.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the projects tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I click the "button.p-button-icon-only" element And I wait for the page to be loaded Then I follow "Blog" @@ -211,30 +169,23 @@ Feature: Course tools basic testing Scenario: Make sure the reporting tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/tracking/courseLog.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the settings tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/course_info/infocours.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Make sure the backup tool is available Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/course_info/maintenance.php?cid=1" - And I wait for the page to be loaded Then I should not see an error Scenario: Enter to public password-protected course Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I click the "button.p-button-icon-only" element And I wait for the page to be loaded Then I follow "Course settings" @@ -249,7 +200,6 @@ Feature: Course tools basic testing Scenario: Create a private course before testing Given I am on "/main/admin/course_add.php" - And I wait for the page to be loaded Then I should not see "not authorized" When I fill in "title" with "TEMP_PRIVATE" Then I check the "Private access (access authorized to group members only)" radio button diff --git a/tests/behat/features/courseCatalogue.feature b/tests/behat/features/courseCatalogue.feature index b0230bc53bb..01248b6ca27 100644 --- a/tests/behat/features/courseCatalogue.feature +++ b/tests/behat/features/courseCatalogue.feature @@ -8,21 +8,18 @@ Feature: Course catalogue and extra fields Scenario: Create three courses for catalogue testing Given I am on "/main/admin/course_add.php" - And I wait for the page to be loaded When I fill in "title" with "testcourse" And I press "submit" And I wait for the page to be loaded Then I should see "testcourse" Given I am on "/main/admin/course_add.php" - And I wait for the page to be loaded When I fill in "title" with "grammarcourse" And I press "submit" And I wait for the page to be loaded Then I should see "grammarcourse" Given I am on "/main/admin/course_add.php" - And I wait for the page to be loaded When I fill in "title" with "grammartest" And I press "submit" And I wait for the page to be loaded @@ -30,7 +27,6 @@ Feature: Course catalogue and extra fields Scenario: Search courses in catalogue by title Given I am on "/catalogue/courses" - And I wait for the page to be loaded When I fill in "search_catalogue" with "test" And I wait for the page to be loaded Then I should see "testcourse" @@ -40,7 +36,6 @@ Feature: Course catalogue and extra fields Scenario: Search courses in catalogue by title (search "course") Given I am on "/catalogue/courses" - And I wait for the page to be loaded When I fill in "search_catalogue" with "course" And I wait for the page to be loaded Then I should see "testcourse" @@ -49,7 +44,6 @@ Feature: Course catalogue and extra fields Scenario: Search courses in catalogue by title (search "course" via filters) Given I am on "/catalogue/courses" - And I wait for the page to be loaded Then I click the "span.pi-sliders-h" element And I wait for the page to be loaded When I fill in "search_by_title" with "course" @@ -61,7 +55,6 @@ Feature: Course catalogue and extra fields Scenario: Search courses in catalogue by title (search "test" via filters) Given I am on "/catalogue/courses" - And I wait for the page to be loaded Then I click the "span.pi-sliders-h" element And I wait for the page to be loaded When I fill in "search_by_title" with "test" @@ -74,7 +67,6 @@ Feature: Course catalogue and extra fields Scenario: Add an extra field "Duration" for courses Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I wait for the page to be loaded And I zoom out to maximum @@ -95,7 +87,6 @@ Feature: Course catalogue and extra fields Scenario: Update course extra field value Given I am on "/admin" - And I wait for the page to be loaded And I zoom out to maximum And I follow "Course list" And I wait for the page to be loaded @@ -108,7 +99,6 @@ Feature: Course catalogue and extra fields Scenario: Update catalogue settings to include extra field in search form Given I am on "/admin/settings/catalog" - And I wait for the page to be loaded When I fill in "form_course_catalog_settings" with "{\"extra_fields_in_search_form\":[\"duration\"]}" And I zoom out to maximum And I press "Save settings" @@ -117,7 +107,6 @@ Feature: Course catalogue and extra fields Scenario: Search courses in catalogue by extra field (Duration = "22:22:22") Given I am on "/catalogue/courses" - And I wait for the page to be loaded Then I click the "span.pi-sliders-h" element And I wait for the page to be loaded When I fill in "extra_duration" with "22:22:22" diff --git a/tests/behat/features/courseCategory.feature b/tests/behat/features/courseCategory.feature index 3a5219a3ba1..ff76e34c5d1 100644 --- a/tests/behat/features/courseCategory.feature +++ b/tests/behat/features/courseCategory.feature @@ -5,7 +5,6 @@ Feature: Course category Scenario: Add a course category Given I am on "/main/admin/course_category.php?action=add" - And I wait for the page to be loaded And I should see "Add category" When I fill in the following: | code | COURSE_CATEGORY | @@ -18,7 +17,6 @@ Feature: Course category Scenario: Edit a course category Given I am on "/main/admin/course_category.php" - And I wait for the page to be loaded Then I should see "Course category" And I click the "i.mdi-pencil" element And I wait for the page to be loaded @@ -33,7 +31,6 @@ Feature: Course category Scenario: Delete course category Given I am on "/main/admin/course_category.php" - And I wait for the page to be loaded Then I should see "Course category edited" Then I click the "i.mdi-delete" element Then confirm the popup diff --git a/tests/behat/features/course_user_registration.feature b/tests/behat/features/course_user_registration.feature index 91b6917a3d4..3598f259560 100644 --- a/tests/behat/features/course_user_registration.feature +++ b/tests/behat/features/course_user_registration.feature @@ -5,7 +5,6 @@ Feature: Subscribe users to the course Scenario: Subscribe "amann" as student to the course "TEMP" Given I am on "/main/user/subscribe_user.php?keyword=amann&type=5&cid=1" - And wait for the page to be loaded Then I should see "Aimee" Then I follow "Register" And wait very long for the page to be loaded @@ -13,7 +12,6 @@ Feature: Subscribe users to the course Scenario: Unsubscribe user "amann" the course "TEMP" Given I am on "/main/user/user.php?cid=1" - And I wait for the page to be loaded Then I should see "Aimee" Then I follow "Unsubscribe" And I confirm the popup @@ -22,7 +20,6 @@ Feature: Subscribe users to the course Scenario: Subscribe "acostea" as student to the course "TEMP" (leave it subscribed for further tests) Given I am on "/main/user/subscribe_user.php?keyword=acostea&type=5&cid=1" - And wait for the page to be loaded Then I should see "Andrea" Then I follow "Register" And wait very long for the page to be loaded @@ -30,7 +27,6 @@ Feature: Subscribe users to the course Scenario: Subscribe "fapple" as student to the course "TEMP" (leave it subscribed for further tests) Given I am on "/main/user/subscribe_user.php?keyword=fapple&type=5&cid=1" - And wait for the page to be loaded Then I should see "Fiona" Then I follow "Register" And wait very long for the page to be loaded @@ -38,7 +34,6 @@ Feature: Subscribe users to the course Scenario: Subscribe "amann" again as student to the course "TEMP" (leave it subscribed for further tests) Given I am on "/main/user/subscribe_user.php?keyword=amann&type=5&cid=1" - And wait for the page to be loaded Then I should see "Aimee" Then I follow "Register" And wait very long for the page to be loaded diff --git a/tests/behat/features/createUser.feature b/tests/behat/features/createUser.feature index ab41cb7a0d4..531b699d81d 100644 --- a/tests/behat/features/createUser.feature +++ b/tests/behat/features/createUser.feature @@ -9,13 +9,11 @@ Feature: Users management as admin Scenario: See the users list link on the admin page Given I am on "/main/admin/index.php" - And wait very long for the page to be loaded Then I should see "Users list" And I should see "Add a user" Scenario: Create a user with only basic info And I am on "/main/admin/user_add.php" - And I wait very long for the page to be loaded And I fill in the following: | firstname | Sammy | | lastname | Marshall | @@ -29,7 +27,6 @@ Feature: Users management as admin Scenario: Create a user with wrong username And I am on "/main/admin/user_add.php" - And I wait very long for the page to be loaded And I fill in the following: | firstname | NIÑO | | lastname | NIÑO | @@ -44,7 +41,6 @@ Feature: Users management as admin Scenario: Create a user with wrong email And I am on "/main/admin/user_add.php" - And I wait very long for the page to be loaded And I fill in the following: | firstname | Juls | | lastname | Juls | @@ -70,7 +66,6 @@ Feature: Users management as admin Scenario: Delete a user Given I am on "/main/admin/user_list.php?keyword=smarshall" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait very long for the page to be loaded @@ -78,7 +73,6 @@ Feature: Users management as admin Scenario: Create a HRM user Given I am on "/main/admin/user_add.php" - And wait very long for the page to be loaded And I fill in the following: | firstname | HRM firstname| | lastname | HRM lastname | @@ -95,7 +89,6 @@ Feature: Users management as admin Scenario: Create a teacher user And I am on "/main/admin/user_add.php" - And I wait for the page to be loaded And I fill in the following: | firstname | teacher firstname| | lastname | teacher lastname | @@ -111,7 +104,6 @@ Feature: Users management as admin Scenario: Create a student user Given I am on "/main/admin/user_add.php" - And I wait very long for the page to be loaded And I fill in the following: | firstname | student firstname| | lastname | student lastname | diff --git a/tests/behat/features/createUserViaCSV.feature b/tests/behat/features/createUserViaCSV.feature index d3bd866ea94..a923565c97b 100644 --- a/tests/behat/features/createUserViaCSV.feature +++ b/tests/behat/features/createUserViaCSV.feature @@ -4,11 +4,9 @@ Feature: Users creation via CSV Scenario: Import user via CSV Given I am a platform administrator And I am on "/main/admin/user_import.php" - And I wait for the page to be loaded Then I attach the file "/public/main/admin/example.csv" to "import_file" Then I press "Import" And wait very long for the page to be loaded Then I should not see an error Then I am on "main/admin/user_list.php?keyword=drbrown@example.net" - And wait very long for the page to be loaded Then I should see "emmert" diff --git a/tests/behat/features/extraFieldUser.feature b/tests/behat/features/extraFieldUser.feature index bdc104f6b5f..3a8184ecdc2 100644 --- a/tests/behat/features/extraFieldUser.feature +++ b/tests/behat/features/extraFieldUser.feature @@ -6,7 +6,6 @@ Feature: User extra fields Scenario: Create a text extra field Given I am a platform administrator And I am on "/main/admin/extra_fields.php?type=user&action=add" - And I wait for the page to be loaded When I fill in the following: | user_field_display_text | Behat extra field | | variable | behat_extra_field | diff --git a/tests/behat/features/profile.feature b/tests/behat/features/profile.feature index 72deac791eb..604681e4cb5 100644 --- a/tests/behat/features/profile.feature +++ b/tests/behat/features/profile.feature @@ -6,7 +6,6 @@ Feature: Profile page Scenario: Change user first name with Andrew then restore to Andrea Given I am on "/account/home" - And I wait for the page to be loaded And I press "Edit profile" And I wait for the page to be loaded And I fill in the following: @@ -18,7 +17,6 @@ Feature: Profile page And I wait for the page to be loaded Then I should see "Andrew" And I should see "Doe" - And I wait for the page to be loaded And I fill in the following: | profile_firstname | Andrea | | profile_lastname | Costea | diff --git a/tests/behat/features/promotion.feature b/tests/behat/features/promotion.feature index 44fe7fd2d7d..8a4cad129eb 100644 --- a/tests/behat/features/promotion.feature +++ b/tests/behat/features/promotion.feature @@ -6,7 +6,6 @@ Feature: Promotions Scenario: Create a promotion Given I am a platform administrator And I am on "/main/admin/promotions.php?action=add" - And wait for the page to be loaded When I fill in the following: | title | Developer | And I fill in editor field "description" with "Promotion Description" @@ -19,7 +18,6 @@ Feature: Promotions Scenario: Edit a promotion Given I am a platform administrator And I am on "/main/admin/promotions.php" - And I wait very long for the page to be loaded Then I should not see an error And I should see "Developer" And I click the "i.mdi-pencil" element @@ -32,7 +30,6 @@ Feature: Promotions Scenario: Copy a promotion Given I am a platform administrator And I am on "/main/admin/promotions.php" - And I wait for the page to be loaded Then I should not see an error And I should see "Developer" And I click the "i.mdi-text-box-plus" element @@ -44,7 +41,6 @@ Feature: Promotions Scenario: Delete a promotion Given I am a platform administrator And I am on "/main/admin/promotions.php" - And I wait for the page to be loaded Then I should not see an error And I should see "Developer" And I click the "i.mdi-delete" element diff --git a/tests/behat/features/questionPool.feature b/tests/behat/features/questionPool.feature index df6405397c0..9ba708dd975 100644 --- a/tests/behat/features/questionPool.feature +++ b/tests/behat/features/questionPool.feature @@ -4,11 +4,9 @@ Feature: Question pool management for QP scenarios Background: Given I am logged as "admin" - And wait very long for the page to be loaded Scenario: Create course QP1 Given I am on "/courses" - And wait very long for the page to be loaded When I click the "span.mdi-plus" element And wait very long for the page to be loaded And I fill in the following: @@ -19,7 +17,6 @@ Feature: Question pool management for QP scenarios Scenario: Create course QP2 Given I am on "/courses" - And wait very long for the page to be loaded When I click the "span.mdi-plus" element And wait very long for the page to be loaded And I fill in the following: @@ -30,7 +27,6 @@ Feature: Question pool management for QP scenarios Scenario: Create a test and add question QPQUESTION1 (then delete) Given I am on course "QP1" homepage - And wait very long for the page to be loaded When I follow "Tests" And wait very long for the page to be loaded And I click the "i.mdi-order-bool-ascending-variant" element @@ -52,7 +48,6 @@ Feature: Question pool management for QP scenarios Scenario: Upload answer (QPQUESTION2) and check recycle behavior Given I am on course "QP1" homepage - And wait very long for the page to be loaded When I follow "Tests" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -81,7 +76,6 @@ Feature: Question pool management for QP scenarios Scenario: Admin reviews question pool and filters by course Given I am on "/admin" - And wait very long for the page to be loaded When I follow "Questions" And wait very long for the page to be loaded And I press "admin_question_submit" @@ -102,7 +96,6 @@ Feature: Question pool management for QP scenarios Scenario: Admin deletes course QP2 from course maintenance Given I am on course "QP1" homepage - And wait very long for the page to be loaded And I click the "span.mdi-cog" element And wait very long for the page to be loaded And I follow "Course maintenance" @@ -119,7 +112,6 @@ Feature: Question pool management for QP scenarios Scenario: Admin removes questions and database entries for QP1 Given I am on course "QP1" homepage - And wait very long for the page to be loaded When I follow "Tests" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -139,11 +131,9 @@ Feature: Question pool management for QP scenarios And wait very long for the page to be loaded And I press "delete" And I confirm the popup - And wait very long for the page to be loaded Scenario: Admin deletes course QP1 via Course maintenance and checks QP2 absence Given I am on course "QP1" homepage - And wait very long for the page to be loaded When I click the "span.mdi-cog" element And wait very long for the page to be loaded And I follow "Course maintenance" diff --git a/tests/behat/features/registration.feature b/tests/behat/features/registration.feature index d5a271f407e..f2bf80e0ac9 100644 --- a/tests/behat/features/registration.feature +++ b/tests/behat/features/registration.feature @@ -8,7 +8,6 @@ Feature: User registration Then I should see "Sign up" Then I follow "Sign up" Then I should see "Registration" - And I wait for the page to be loaded And I fill in the following: | firstname | user registration first name | | lastname | user registration last name | diff --git a/tests/behat/features/sessionAccess.feature b/tests/behat/features/sessionAccess.feature index 4fb902ced73..b1eaeb434fe 100644 --- a/tests/behat/features/sessionAccess.feature +++ b/tests/behat/features/sessionAccess.feature @@ -25,7 +25,6 @@ Feature: Session access Scenario: Check if same session exists. Given I am a platform administrator And I am on "/main/session/session_add.php" - And I wait very long for the page to be loaded When I fill in the following: | name | Session1 | And I fill in select2 input "#coach_username" with id "1" and value "admin" @@ -37,7 +36,6 @@ Feature: Session access Scenario: Create session 2 Given I am a platform administrator And I am on "/main/session/session_add.php" - And I wait for the page to be loaded When I fill in the following: | name | Session2 | And I fill in select2 input "#coach_username" with id "1" and value "admin" @@ -67,7 +65,6 @@ Feature: Session access Given I am not logged Given I am logged as "ywarnier" Then I am on course "TEMPPRIVATE" homepage in session "Session2" - And I wait for the page to be loaded Then I should see "not allowed" Scenario: ywarnier connect to course TEMPPRIVATE inside a session that doesn't exists @@ -87,7 +84,6 @@ Feature: Session access Scenario: mmosquera connect to Session 2 Given I am not logged Given I am logged as "mmosquera" - And wait for the page to be loaded Then I am on course "TEMPPRIVATE" homepage in session "Session2" And wait the page to be loaded when ready Then I should not see "You are not allowed" @@ -95,7 +91,6 @@ Feature: Session access Scenario: Delete session "Session2" Given I am a platform administrator And I am on "/main/session/session_list.php?keyword=Session2" - And wait for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait for the page to be loaded @@ -104,7 +99,6 @@ Feature: Session access Scenario: Delete session "Session1" Given I am a platform administrator And I am on "/main/session/session_list.php?keyword=Session1" - And wait for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait for the page to be loaded diff --git a/tests/behat/features/sessionManagement.feature b/tests/behat/features/sessionManagement.feature index 5f2800adf9f..67b951c02f1 100644 --- a/tests/behat/features/sessionManagement.feature +++ b/tests/behat/features/sessionManagement.feature @@ -7,7 +7,6 @@ Feature: Session management tool Scenario: Create a session category Given I am on "/main/session/session_category_add.php" - And I wait for the page to be loaded When I fill in the following: | name | category_1 | And I press "Add category" @@ -18,7 +17,6 @@ Feature: Session management tool @javascript Scenario: Create a session Given I am on "/main/session/session_add.php" - And I wait for the page to be loaded When I fill in the following: | title | Session 1 | And I fill in select2 input "#coach_username" with id "1" and value "admin" @@ -34,7 +32,6 @@ Feature: Session management tool @javascript Scenario: Create a session with description Given I am on "/main/session/session_add.php" - And I wait for the page to be loaded When I fill in the following: | title | Temp Session | And I press "advanced_params" @@ -51,13 +48,11 @@ Feature: Session management tool Scenario: Check session description is not present Given I am on "/sessions" - And I wait for the page to be loaded Then I should see "Temp Session" And I should not see "Description for Temp Session" Scenario: Edit session description setting Given I am on "/main/session/session_list.php?keyword=Temp+session" - And I wait for the page to be loaded When I follow "Temp Session" And I wait for the page to be loaded And I click the "i.mdi-pencil" element @@ -72,7 +67,6 @@ Feature: Session management tool Scenario: Check session description with platform setting off Given I am on "/admin/settings/search_settings?keyword=show_session_description" - And I wait for the page to be loaded When I select "No" from "form_show_session_description" And I press "Save settings" And I wait for the page to be loaded @@ -80,13 +74,11 @@ Feature: Session management tool And I should see "No" And I should not see an error Then I am on "/sessions" - And I wait for the page to be loaded Then I should see "Temp Session" And I should not see "Description for Temp Session" Scenario: Check session description with platform setting on Given I am on "/admin/settings/search_settings?keyword=show_session_description" - And I wait for the page to be loaded When I select "Yes" from "form_show_session_description" And I press "Save settings" And I wait for the page to be loaded @@ -94,13 +86,11 @@ Feature: Session management tool And I should see "Yes" And I should not see an error Then I am on "/sessions" - And I wait for the page to be loaded Then I should see "Temp Session" And I should see "Description for Temp Session" Scenario: Delete session Given I am on "/main/session/session_list.php?keyword=Temp+session" - And I wait for the page to be loaded When I click the "i.mdi-delete" element And I confirm the popup And I wait for the page to be loaded @@ -109,7 +99,6 @@ Feature: Session management tool Scenario: Delete session "Session 1" Given I am on "/main/session/session_list.php?keyword=Session+1" - And I wait for the page to be loaded When I click the "i.mdi-delete" element And I confirm the popup And I wait for the page to be loaded @@ -118,7 +107,6 @@ Feature: Session management tool Scenario: Delete session category Given I am on "/main/session/session_category_list.php" - And I wait for the page to be loaded When I click the "i.mdi-delete" element And I confirm the popup And I wait for the page to be loaded diff --git a/tests/behat/features/skill.feature b/tests/behat/features/skill.feature index ab56b2b7781..f42b4a02ed8 100644 --- a/tests/behat/features/skill.feature +++ b/tests/behat/features/skill.feature @@ -7,7 +7,6 @@ Feature: Skills Scenario: Create a skill skill1 Given I am a platform administrator And I am on "main/skills/skill_create.php" - And wait very long for the page to be loaded When I fill in the following: | title | skill1 | | short_code | s1 | @@ -20,7 +19,6 @@ Feature: Skills Scenario: Create a second level skill Given I am a platform administrator And I am on "main/skills/skill_create.php" - And wait very long for the page to be loaded When I fill in the following: | title | skill11 | | short_code | s11 | @@ -34,7 +32,6 @@ Feature: Skills Scenario: Create a skill skilldis Given I am a platform administrator And I am on "main/skills/skill_create.php" - And wait very long for the page to be loaded When I fill in the following: | title | skilldis | | short_code | sdis | @@ -54,10 +51,8 @@ Feature: Skills Scenario: Disable a skill skilldis Given I am a platform administrator And I am on "main/skills/skill_list.php" - And wait for the page to be loaded Then I should see "skilldis" Then I am on "/main/skills/skill_list.php?id=4&action=disable" - And wait for the page to be loaded Then I should not see an error @@ -70,10 +65,8 @@ Feature: Skills Scenario: Enable a skill skilldis Given I am a platform administrator And I am on "main/skills/skill_list.php" - And wait for the page to be loaded Then I should see "skilldis" Then I am on "/main/skills/skill_list.php?id=4&action=enable" - And wait for the page to be loaded Then I should not see an error @@ -82,7 +75,6 @@ Feature: Skills Scenario: Update a skill skill1 Given I am a platform administrator And I am on "main/skills/skill_list.php" - And wait for the page to be loaded Then I should see "skill1" Then I follow "Edit" And wait very long for the page to be loaded @@ -108,7 +100,6 @@ Feature: Skills Scenario: Reassign skill11 to user 1 Given I am a platform administrator And I am on "main/skills/assign.php?user=1" - And I wait for the page to be loaded When I select "skill11" from "skill" And wait very long for the page to be loaded Then I fill in the following: @@ -122,7 +113,6 @@ Feature: Skills Scenario: View assigned skill skill11 to user 1 Given I am a platform administrator And I am on "/badge/3/user/1" - And I wait for the page to be loaded Then I should see "Skill acquired" And I should see "John Doe" @@ -132,7 +122,6 @@ Feature: Skills Scenario: Set a badge to a skill Given I am a platform administrator And I am on "main/skills/skill_list.php" - And wait for the page to be loaded Then I should see "skill11" Then I click the "i.mdi-shield-star" element And I wait for the page to be loaded diff --git a/tests/behat/features/socialGroup.feature b/tests/behat/features/socialGroup.feature index 35b046e36db..dfe32a66bab 100644 --- a/tests/behat/features/socialGroup.feature +++ b/tests/behat/features/socialGroup.feature @@ -7,7 +7,6 @@ Feature: Social Group Scenario: Create a social group Given I am a platform administrator And I am on "/main/social/group_add.php" - And I wait for the page to be loaded When I fill in the following: | title | Behat Test Group | Then I fill in editor field "description" with "This is a group created by Behat" diff --git a/tests/behat/features/systemAnnouncements.feature b/tests/behat/features/systemAnnouncements.feature index 04d26b2dad9..6dcbf15b07b 100644 --- a/tests/behat/features/systemAnnouncements.feature +++ b/tests/behat/features/systemAnnouncements.feature @@ -8,7 +8,6 @@ Feature: System Announcements Scenario: Create a system announcement Given I am on "/main/admin/system_announcements.php?action=add" - And wait for the page to be loaded When I fill in the following: | title | Announcement system test | And I fill in editor field "content" with "Announcement system description" @@ -20,7 +19,6 @@ Feature: System Announcements Scenario: Delete system announcement Given I am on "/main/admin/system_announcements.php" - And I wait for the page to be loaded When I click the "i.mdi-delete" element Then I confirm the popup And wait for the page to be loaded diff --git a/tests/behat/features/ticket.feature b/tests/behat/features/ticket.feature index 2e7b3a9386b..5150f6917a0 100644 --- a/tests/behat/features/ticket.feature +++ b/tests/behat/features/ticket.feature @@ -9,31 +9,26 @@ Feature: Ticket Scenario: Check ticket categories Given I am on "/main/ticket/categories.php?project_id=1" - And I wait for the page to be loaded Then I should see "Enrollment" Scenario: Check ticket projects Given I am on "/main/ticket/projects.php?project_id=1" - And I wait for the page to be loaded Then I should see "Ticket System" Scenario: Check ticket status Given I am on "/main/ticket/status.php" - And I wait for the page to be loaded Then I should see "New" Scenario: Check ticket priorities Given I am on "/main/ticket/priorities.php" - And I wait very long for the page to be loaded Then I should see "Normal" Scenario: Create a ticket Given I am on "/main/ticket/new_ticket.php?project_id=1" - And I wait for the page to be loaded When I fill in the following: | subject | First ticket | And I fill in editor field "content" with "Ticket description" @@ -46,7 +41,6 @@ Feature: Ticket # Scenario: Create ticket project Given I am on "/main/ticket/projects.php?action=add" - And I wait for the page to be loaded When I fill in the following: | name | Project 2 | And I fill in editor field "description" with "Project description" @@ -57,7 +51,6 @@ Feature: Ticket # Scenario: Create ticket status Given I am on "/main/ticket/status.php?action=add" - And I wait for the page to be loaded When I fill in the following: | name | Status 1 | And I fill in editor field "description" with "Status" @@ -68,7 +61,6 @@ Feature: Ticket # Scenario: Create priority Given I am on "/main/ticket/priorities.php?action=add" - And I wait for the page to be loaded When I fill in the following: | name | Priority 1 | And I fill in editor field "description" with "Priority" diff --git a/tests/behat/features/toolAgenda.feature b/tests/behat/features/toolAgenda.feature index b2667ffb523..20ac729535e 100644 --- a/tests/behat/features/toolAgenda.feature +++ b/tests/behat/features/toolAgenda.feature @@ -7,7 +7,6 @@ Feature: Agenda tool Scenario: Create a personal event Given I am on "/main/calendar/agenda.php?action=add&type=personal" - And I wait for the page to be loaded When I fill in the following: | title | Event 1 | And I focus "date_range" @@ -21,7 +20,6 @@ Feature: Agenda tool Scenario: Create an event inside course TEMP Given I am on "/main/calendar/agenda.php?action=add&type=course&cid=1" - And I wait for the page to be loaded When I fill in the following: | title | Event in course | Then I fill in editor field "content" with "Description event" diff --git a/tests/behat/features/toolAnnouncement.feature b/tests/behat/features/toolAnnouncement.feature index d60bcf35407..a256ed5e0f6 100644 --- a/tests/behat/features/toolAnnouncement.feature +++ b/tests/behat/features/toolAnnouncement.feature @@ -8,7 +8,6 @@ Feature: Announcement tool Scenario: Create an announcement for admin user Given I am on "/main/announcements/announcements.php?action=add&cid=1" - And I wait for the page to be loaded When I fill in the following: | title | Announcement test | And I press "choose_recipients" @@ -25,7 +24,6 @@ Feature: Announcement tool Scenario: Create an announcement for all users Given I am on "/main/announcements/announcements.php?action=add&cid=1" - And I wait for the page to be loaded When I fill in the following: | title | Announcement test | And I fill in editor field "content" with "Announcement description" @@ -38,7 +36,6 @@ Feature: Announcement tool Scenario: Delete all announcements Given I am on "/main/announcements/announcements.php?cid=1" - And I wait for the page to be loaded Then I click the "th.ui-th-ltr" element And I click the "span.mdi-trash-can-outline" element And I press "Delete" diff --git a/tests/behat/features/toolAssessments.feature b/tests/behat/features/toolAssessments.feature index b40480e9c7d..cc7f1853d93 100644 --- a/tests/behat/features/toolAssessments.feature +++ b/tests/behat/features/toolAssessments.feature @@ -3,9 +3,7 @@ Feature: Assessments tool Scenario: Set certification minimum score to 50 in course TEMP Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "i.mdi-pencil" element @@ -18,9 +16,7 @@ Feature: Assessments tool Scenario: Create an evaluation "exam" in course TEMP Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "i.mdi-table-plus" element @@ -41,9 +37,7 @@ Feature: Assessments tool Scenario: Create a work Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded Then I click the "span.mdi-folder-plus" element @@ -54,9 +48,7 @@ Feature: Assessments tool Scenario: Edit maximum score Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded And I click the "a.text-blue-600" element @@ -71,9 +63,7 @@ Feature: Assessments tool Scenario: Send work as student (acostea) Given I am a student - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded And I click the "a.text-blue-600" element @@ -85,9 +75,7 @@ Feature: Assessments tool Scenario: Add a comment and a attachment to the work previously uploaded by student Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded And I click the "a.text-blue-600" element @@ -103,15 +91,12 @@ Feature: Assessments tool Scenario: Link an Assignment to the evaluation and edit its min score Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "i.mdi-link-plus" element And I wait for the page to be loaded When I select "Assignments" from "create_link_select_link" - And wait very long for the page to be loaded When I fill in the following: | weight_mask | 50 | | minimum score | 3 | @@ -127,9 +112,7 @@ Feature: Assessments tool Scenario: Edit a result and verify it in chart view Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded And I follow "exam" @@ -147,9 +130,7 @@ Feature: Assessments tool Scenario: Open certificate from list view in Assessments Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "i.mdi-format-list-text" element @@ -162,9 +143,7 @@ Feature: Assessments tool Scenario: Admin exports all to PDF Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "i.mdi-account" element @@ -174,9 +153,7 @@ Feature: Assessments tool Scenario: Deletes selected assessments Given I am a platform administrator - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assessments" And wait very long for the page to be loaded Then I click the "a.btn--action" element @@ -192,7 +169,6 @@ Feature: Assessments tool Scenario: Admin deletes Work 1 from assignments list Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded And I click the "input.p-checkbox-input" element diff --git a/tests/behat/features/toolAssignment.feature b/tests/behat/features/toolAssignment.feature index b615407a10f..65ea6708477 100644 --- a/tests/behat/features/toolAssignment.feature +++ b/tests/behat/features/toolAssignment.feature @@ -5,7 +5,6 @@ Feature: Work tool Scenario: Create a work Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -20,7 +19,6 @@ Feature: Work tool Scenario: Edit a work Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -39,7 +37,6 @@ Feature: Work tool Scenario: Edit maximum score Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -59,7 +56,6 @@ Feature: Work tool Given I am a platform administrator And I am not logged And I am a student - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -77,7 +73,6 @@ Feature: Work tool Given I am not logged Given I am a platform administrator And I am not logged - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -89,14 +84,12 @@ Feature: Work tool Scenario: Add a comment and a attachment to the work previously uploaded by student Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded And I click the "a.text-blue-600" element And wait very long for the page to be loaded Then I should see "Assignment name" - And wait very long for the page to be loaded Then I click the "span.mdi-reply-all" element And I wait for the page to be loaded When I fill in the following: @@ -112,7 +105,6 @@ Feature: Work tool Scenario: Admin views submission list for Work 1 Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -140,7 +132,6 @@ Feature: Work tool Scenario: Admin views graded score for Work 1 Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded @@ -152,7 +143,6 @@ Feature: Work tool Scenario: Admin deletes Work 1 from assignments list Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Assignments" And wait very long for the page to be loaded diff --git a/tests/behat/features/toolAttendance.feature b/tests/behat/features/toolAttendance.feature index afc6a087f53..6523edc6bc8 100644 --- a/tests/behat/features/toolAttendance.feature +++ b/tests/behat/features/toolAttendance.feature @@ -5,7 +5,6 @@ Feature: Attendance tool Scenario: Create Given I am on "/main/attendance/index.php?cid=1&action=attendance_add" - And I wait for the page to be loaded Then I fill in the following: | title |Attendance 1| Then I fill in editor field "description" with "Description for attendance" @@ -16,7 +15,6 @@ Feature: Attendance tool Scenario: Read Given I am on "/main/attendance/index.php?cid=1" - And I wait for the page to be loaded Then I should see "Attendance 1" Then I follow "Attendance 1" And I wait for the page to be loaded @@ -24,9 +22,7 @@ Feature: Attendance tool Scenario: Update Given I am on "/main/attendance/index.php?cid=1&action=attendance_edit&attendance_id=1" - And I wait for the page to be loaded Then I should see "Edit" - And I wait for the page to be loaded When I fill in the following: | title | Attendance 1 edited | Then I fill in editor field "description" with "Description edited" @@ -36,7 +32,6 @@ Feature: Attendance tool Scenario: Delete Given I am on "/main/attendance/index.php?cid=1&sid=0" - And I wait for the page to be loaded Then I should see "Attendance 1 edited" Then I follow "Delete" And I wait for the page to be loaded diff --git a/tests/behat/features/toolChat.feature b/tests/behat/features/toolChat.feature index fecb238fce2..44c5e15c64a 100644 --- a/tests/behat/features/toolChat.feature +++ b/tests/behat/features/toolChat.feature @@ -6,7 +6,6 @@ Feature: Chat tool Scenario: Admin sends public and private messages, Andrea checks them Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum Then I follow "Chat" And wait for the page to be loaded @@ -23,13 +22,11 @@ Feature: Chat tool Then I fill in the following: | chat-writer | HelloAndrea | Then I click the "button#chat-send-message" element - And wait for the page to be loaded Scenario: Now switch to Andrea (student) and verify messages Given I am a student And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum Then I follow "Chat" And wait for the page to be loaded diff --git a/tests/behat/features/toolCoursedescription.feature b/tests/behat/features/toolCoursedescription.feature index 49494e1f59b..0e7cd116e4a 100644 --- a/tests/behat/features/toolCoursedescription.feature +++ b/tests/behat/features/toolCoursedescription.feature @@ -7,12 +7,10 @@ Feature: Course description tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin edits the course description and sees the content Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Course description" And I wait for the page to be loaded @@ -26,9 +24,7 @@ Feature: Course description tool Scenario: Student views the course description Given I am a student - And I wait for the page to be loaded Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Course description" And I wait for the page to be loaded Then I should see "surface web" diff --git a/tests/behat/features/toolDocument.feature b/tests/behat/features/toolDocument.feature index 2657646f3c1..41617b25d8f 100644 --- a/tests/behat/features/toolDocument.feature +++ b/tests/behat/features/toolDocument.feature @@ -5,7 +5,6 @@ Feature: Document tool Scenario: Create a folder Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I click the "span.mdi-folder-plus" element @@ -19,7 +18,6 @@ Feature: Document tool Scenario: Create a folder that already exists Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I click the "span.mdi-folder-plus" element @@ -32,7 +30,6 @@ Feature: Document tool Scenario: Create a text document Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I click the "span.mdi-file-plus" element @@ -44,12 +41,10 @@ Feature: Document tool And wait for the page to be loaded Then I should see "created" And I should see "My first document" - And wait for the page to be loaded Scenario: Create a HTML document Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I click the "span.mdi-file-plus" element @@ -65,7 +60,6 @@ Feature: Document tool Scenario: Upload a document Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I click the "span.mdi-file-upload" element @@ -80,7 +74,6 @@ Feature: Document tool Scenario: Search for "My second document" and edit it Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Documents" And wait for the page to be loaded Then I should see "My second document" @@ -95,7 +88,6 @@ Feature: Document tool Scenario: Search for "My first document" and delete it Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded Then I follow "Document" And wait for the page to be loaded Then I should see "My first document" diff --git a/tests/behat/features/toolDropbox.feature b/tests/behat/features/toolDropbox.feature index 5b272516b70..2664fd864ad 100644 --- a/tests/behat/features/toolDropbox.feature +++ b/tests/behat/features/toolDropbox.feature @@ -7,12 +7,10 @@ Feature: Dropbox tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin opens Dropbox and sees the upload action Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Dropbox" And I wait for the page to be loaded diff --git a/tests/behat/features/toolExerciseAdmin.feature b/tests/behat/features/toolExerciseAdmin.feature index 6de540cd913..848e71e6deb 100644 --- a/tests/behat/features/toolExerciseAdmin.feature +++ b/tests/behat/features/toolExerciseAdmin.feature @@ -4,12 +4,10 @@ Feature: Exercise tool Background: Given I am a platform administrator - And wait very long for the page to be loaded Scenario: Create a question category Given I am on "/main/exercise/tests_category.php?action=addcategory&cid=1" - And wait very long for the page to be loaded When I fill in the following: | category_name | Category 1 | And I fill in editor field "category_description" with "Category 1 description" @@ -19,7 +17,6 @@ Feature: Exercise tool Scenario: Create a second question category Given I am on "/main/exercise/tests_category.php?action=addcategory&cid=1" - And wait very long for the page to be loaded When I fill in the following: | category_name | Category 2 | And I fill in editor field "category_description" with "Category 2 description" @@ -29,7 +26,6 @@ Feature: Exercise tool Scenario: Create an exercise Given I am on "/main/exercise/exercise_admin.php?cid=1" - And wait very long for the page to be loaded And I press advanced settings When I fill in the following: | exercise_title | Exercise 1 | @@ -39,8 +35,6 @@ Feature: Exercise tool Scenario: Edit an exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded - And I wait for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -54,7 +48,6 @@ Feature: Exercise tool Scenario: Add question "Multiple choice" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -79,7 +72,6 @@ Feature: Exercise tool Scenario: Add question "Multiple answer" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -105,7 +97,6 @@ Feature: Exercise tool Scenario: Add question "Fill in blanks" to "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -121,7 +112,6 @@ Feature: Exercise tool Scenario: Add question "Matching" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -141,7 +131,6 @@ Feature: Exercise tool Scenario: Add question "Open" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -157,7 +146,6 @@ Feature: Exercise tool Scenario: Add question "Oral expression" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -172,7 +160,6 @@ Feature: Exercise tool Scenario: Add question "Exact answers combination" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -192,7 +179,6 @@ Feature: Exercise tool Scenario: Add question "Unique answer with unknown" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -216,7 +202,6 @@ Feature: Exercise tool Scenario: Add question "Multiple answer true/false/don't know" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -246,7 +231,6 @@ Feature: Exercise tool Scenario: Add question "Combination true/false/don't-know" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -269,7 +253,6 @@ Feature: Exercise tool Scenario: Add question "Global multiple answer" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -298,17 +281,14 @@ Feature: Exercise tool Scenario: Duplicate exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-disc" element And I confirm the popup And wait very long for the page to be loaded Then I should see "copied" - And wait very long for the page to be loaded And I should see "Exercise 1 - Copy" Scenario: Import exercise to test questions categories Given I am on "/main/exercise/upload_exercise.php?cid=1" - And wait very long for the page to be loaded And I should see "Import quiz from Excel" And I attach the file "/tests/fixtures/exercise.xls" to "upload_user_upload_quiz" When I press "Upload" @@ -317,7 +297,6 @@ Feature: Exercise tool # Scenario: Import exercise from excel Given I am on "/main/exercise/upload_exercise.php?cid=1" - And wait very long for the page to be loaded Then I should see "Import quiz from Excel" Then I attach the file "/public/main/exercise/quiz_template.xls" to "upload_user_upload_quiz" And I press "Upload" @@ -326,7 +305,6 @@ Feature: Exercise tool Scenario: Try exercise "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I follow "Start test" @@ -396,14 +374,12 @@ Feature: Exercise tool Scenario: Check exercise result Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element And wait very long for the page to be loaded And I follow "Results and feedback" Then I should see "Learner score" - And wait very long for the page to be loaded And I check the "semantics" radio button And I press "Next question" And wait very long for the page to be loaded @@ -422,7 +398,6 @@ Feature: Exercise tool And I select "A" from "choice_id_7_1" And I select "B" from "choice_id_7_2" And I select "C" from "choice_id_7_3" - And wait very long for the page to be loaded And I press "Next question" And wait very long for the page to be loaded And I check "1" @@ -441,19 +416,14 @@ Feature: Exercise tool Scenario: Teacher looks at exercise results by categories Given I am on "/main/index/user_portal.php" - And wait very long for the page to be loaded And I am on "/sessions" - And wait very long for the page to be loaded Then I should see "Session Exercise" - And wait very long for the page to be loaded And I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise for Behat test" And wait very long for the page to be loaded And I click the "i.mdi-chart-box" element And wait very long for the page to be loaded Then I should see "Learner score" - And wait very long for the page to be loaded And I click the "i.mdi-checkbox-marked-circle-plus-outline" element And wait very long for the page to be loaded Then I should see "Score for the test: 190 / 190" @@ -465,37 +435,29 @@ Feature: Exercise tool | Total | 190 / 190 | 100% | Scenario: Delete an exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "Exercise 1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "Exercise for Behat test" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "IQ test" Scenario: Delete an exercise category Given I am on "/main/exercise/tests_category.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Category 1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Category 2" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Categoryname2" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Categoryname1" Scenario: Delete session Given I am on "/main/session/session_list.php?keyword=Session+Exercise" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait for the page to be loaded diff --git a/tests/behat/features/toolExerciseTeacher.feature b/tests/behat/features/toolExerciseTeacher.feature index a735a2b7bb3..0f61565ac4c 100644 --- a/tests/behat/features/toolExerciseTeacher.feature +++ b/tests/behat/features/toolExerciseTeacher.feature @@ -4,12 +4,10 @@ Feature: Exercise tool Background: Given I am logged as "ywarnier" - And wait very long for the page to be loaded Scenario: Create a question category Given I am on "/main/exercise/tests_category.php?action=addcategory&cid=1" - And wait very long for the page to be loaded When I fill in the following: | category_name | Category 1 | And I fill in editor field "category_description" with "Category 1 description" @@ -19,7 +17,6 @@ Feature: Exercise tool Scenario: Create a second question category Given I am on "/main/exercise/tests_category.php?action=addcategory&cid=1" - And wait very long for the page to be loaded When I fill in the following: | category_name | Category 2 | And I fill in editor field "category_description" with "Category 2 description" @@ -29,7 +26,6 @@ Feature: Exercise tool Scenario: Create an exercise Given I am on "/main/exercise/exercise_admin.php?cid=1" - And wait very long for the page to be loaded And I press advanced settings When I fill in the following: | exercise_title | Exercise 1 | @@ -39,8 +35,6 @@ Feature: Exercise tool Scenario: Edit an exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded - And I wait for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -54,7 +48,6 @@ Feature: Exercise tool Scenario: Add question "Multiple choice" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -79,7 +72,6 @@ Feature: Exercise tool Scenario: Add question "Multiple answer" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -105,7 +97,6 @@ Feature: Exercise tool Scenario: Add question "Fill in blanks" to "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -121,7 +112,6 @@ Feature: Exercise tool Scenario: Add question "Matching" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -141,7 +131,6 @@ Feature: Exercise tool Scenario: Add question "Open" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -157,7 +146,6 @@ Feature: Exercise tool Scenario: Add question "Oral expression" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -172,7 +160,6 @@ Feature: Exercise tool Scenario: Add question "Exact answers combination" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -192,7 +179,6 @@ Feature: Exercise tool Scenario: Add question "Unique answer with unknown" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -216,7 +202,6 @@ Feature: Exercise tool Scenario: Add question "Multiple answer true/false/don't know" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -246,7 +231,6 @@ Feature: Exercise tool Scenario: Add question "Combination true/false/don't-know" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -269,7 +253,6 @@ Feature: Exercise tool Scenario: Add question "Global multiple answer" to exercise created "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element @@ -298,17 +281,14 @@ Feature: Exercise tool Scenario: Duplicate exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-disc" element And I confirm the popup And wait very long for the page to be loaded Then I should see "copied" - And wait very long for the page to be loaded And I should see "Exercise 1 - Copy" Scenario: Import exercise to test questions categories Given I am on "/main/exercise/upload_exercise.php?cid=1" - And wait very long for the page to be loaded And I should see "Import quiz from Excel" And I attach the file "/tests/fixtures/exercise.xls" to "upload_user_upload_quiz" When I press "Upload" @@ -317,7 +297,6 @@ Feature: Exercise tool # Scenario: Import exercise from excel Given I am on "/main/exercise/upload_exercise.php?cid=1" - And wait very long for the page to be loaded Then I should see "Import quiz from Excel" Then I attach the file "/public/main/exercise/quiz_template.xls" to "upload_user_upload_quiz" And I press "Upload" @@ -326,7 +305,6 @@ Feature: Exercise tool Scenario: Try exercise "Exercise 1" Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I follow "Start test" @@ -396,14 +374,12 @@ Feature: Exercise tool Scenario: Check exercise result Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise 1" And wait very long for the page to be loaded And I click the "i.mdi-pencil" element And wait very long for the page to be loaded And I follow "Results and feedback" Then I should see "Learner score" - And wait very long for the page to be loaded And I check the "semantics" radio button And I press "Next question" And wait very long for the page to be loaded @@ -422,7 +398,6 @@ Feature: Exercise tool And I select "A" from "choice_id_7_1" And I select "B" from "choice_id_7_2" And I select "C" from "choice_id_7_3" - And wait very long for the page to be loaded And I press "Next question" And wait very long for the page to be loaded And I check "1" @@ -441,19 +416,14 @@ Feature: Exercise tool Scenario: Teacher looks at exercise results by categories Given I am on "/main/index/user_portal.php" - And wait very long for the page to be loaded And I am on "/sessions" - And wait very long for the page to be loaded Then I should see "Session Exercise" - And wait very long for the page to be loaded And I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I follow "Exercise for Behat test" And wait very long for the page to be loaded And I click the "i.mdi-chart-box" element And wait very long for the page to be loaded Then I should see "Learner score" - And wait very long for the page to be loaded And I click the "i.mdi-checkbox-marked-circle-plus-outline" element And wait very long for the page to be loaded Then I should see "Score for the test: 190 / 190" @@ -465,37 +435,29 @@ Feature: Exercise tool | Total | 190 / 190 | 100% | Scenario: Delete an exercise Given I am on "/main/exercise/exercise.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "Exercise 1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "Exercise for Behat test" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup Then I should not see "IQ test" Scenario: Delete an exercise category Given I am on "/main/exercise/tests_category.php?cid=1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Category 1" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Category 2" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Categoryname2" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element Then I should not see "Categoryname1" Scenario: Delete session Given I am on "/main/session/session_list.php?keyword=Session+Exercise" - And wait very long for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait for the page to be loaded diff --git a/tests/behat/features/toolForum.feature b/tests/behat/features/toolForum.feature index d048c5197fd..8c91b2e42f7 100644 --- a/tests/behat/features/toolForum.feature +++ b/tests/behat/features/toolForum.feature @@ -8,7 +8,6 @@ Feature: Forum tool Scenario: Create a forum category Given I am on "/main/forum/index.php?action=add_category&cid=1" - And I wait for the page to be loaded When I fill in the following: | forum_category_title | Forum Category Test | And I fill in editor field "forum_category_comment" with "This is the first forum category for test" @@ -19,7 +18,6 @@ Feature: Forum tool Scenario: Create a forum Given I am on "/main/forum/index.php?action=add_forum&cid=1" - And I wait for the page to be loaded When I fill in the following: | forum_title | Forum Test | And I fill in editor field "forum_comment" with "This is the first forum for test" @@ -30,7 +28,6 @@ Feature: Forum tool Scenario: Create a forum thread Given I am on "/main/forum/index.php?cid=1" - And I wait for the page to be loaded And I follow "Forum Test" And I wait for the page to be loaded And I click the "i.mdi-format-quote-open" element @@ -45,7 +42,6 @@ Feature: Forum tool Scenario: Reply to forum message Given I am on "/main/forum/index.php?cid=1" - And I wait for the page to be loaded And I follow "Forum Test" And I wait for the page to be loaded When I follow "Thread One" @@ -62,7 +58,6 @@ Feature: Forum tool Scenario: Delete a forum thread Given I am on "/main/forum/index.php?cid=1" - And I wait for the page to be loaded And I follow "Forum Test" And I wait for the page to be loaded Then I follow "Thread One" @@ -74,7 +69,6 @@ Feature: Forum tool Scenario: Quote a forum message Given I am on "/main/forum/viewthread.php?forum=1&thread=1&cid=1" - And I wait for the page to be loaded When I click the "i.mdi-comment-quote" element And I wait for the page to be loaded And I press "SubmitPost" diff --git a/tests/behat/features/toolGlossary.feature b/tests/behat/features/toolGlossary.feature index 8a42ce60316..b10c1dc0bc2 100644 --- a/tests/behat/features/toolGlossary.feature +++ b/tests/behat/features/toolGlossary.feature @@ -3,7 +3,6 @@ Feature: Glossary tool Scenario: Create glossary term in course TEMP Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Glossary" And wait very long for the page to be loaded Then I click the "span.mdi-plus" element @@ -17,7 +16,6 @@ Feature: Glossary tool Scenario: Add glossary link from Documents in course TEMP Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Documents" And wait very long for the page to be loaded Then I click the "span.mdi-file-plus" element @@ -33,7 +31,6 @@ Feature: Glossary tool Scenario: Enable glossary display in extra tools from admin settings Given I am a platform administrator And I am on "/admin/settings/glossary" - And I wait for the page to be loaded When I select "Learning path" from "form_show_glossary_in_extra_tools" And I press "Save" And I wait for the page to be loaded @@ -41,7 +38,6 @@ Feature: Glossary tool Scenario: Create Learning path named Glossary in course TEMP Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Learning paths" And wait very long for the page to be loaded Then I click the "i.mdi-dots-vertical" element @@ -59,13 +55,11 @@ Feature: Glossary tool Scenario: Export glossary then check generated file in Documents Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Glossary" And wait very long for the page to be loaded Then I click the "span.mdi-export" element And I wait for the page to be loaded Then I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Documents" And wait very long for the page to be loaded Then I should see "glossary_" diff --git a/tests/behat/features/toolGroup.feature b/tests/behat/features/toolGroup.feature index fa3d19ed602..3affc0a58fa 100644 --- a/tests/behat/features/toolGroup.feature +++ b/tests/behat/features/toolGroup.feature @@ -8,7 +8,6 @@ Feature: Group tool Scenario: Delete default category Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded Then I should see "Default groups" Then I click the "i.mdi-delete" element Then I confirm the popup @@ -17,7 +16,6 @@ Feature: Group tool Scenario: Create a group directory Given I am on "/main/group/group_category.php?cid=1&sid=0&action=add_category" - And I wait for the page to be loaded When I fill in the following: | title | Group category 1 | And I press "Add" @@ -27,7 +25,6 @@ Feature: Group tool Scenario: Create 4 groups Given I am on "/main/group/group_creation.php?cid=1&sid=0" - And I wait for the page to be loaded Then I fill in the following: | number_of_groups | 5 | And I press "submit" @@ -40,15 +37,10 @@ Feature: Group tool | group_3_places | 1 | | group_4_places | 2 | And I select "Group category 1" from "category_0" - And I wait for the page to be loaded And I select "Group category 1" from "category_1" - And I wait for the page to be loaded And I select "Group category 1" from "category_2" - And I wait for the page to be loaded And I select "Group category 1" from "category_3" - And I wait for the page to be loaded And I select "Group category 1" from "category_4" - And I wait for the page to be loaded And I press "submit" And I wait for the page to be loaded Then I should not see an error @@ -125,7 +117,6 @@ Feature: Group tool And I wait for the page to be loaded Then I should see "Are you sure to delete" Then I follow "delete_item" - And I wait for the page to be loaded Scenario: Delete directory Given I am on "/main/group/group.php?cid=1&sid=0" @@ -139,11 +130,9 @@ Feature: Group tool And I wait for the page to be loaded Then I should see "Are you sure to delete" Then I follow "delete_item" - And I wait for the page to be loaded Scenario: Add fapple to the Group 0001 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0001" And I wait for the page to be loaded Then I should see "Group 0001" @@ -153,7 +142,6 @@ Feature: Group tool Then I click the "i.mdi-account" element And I wait for the page to be loaded Then I select "Fiona Apple Maggart (fapple)" from "group_members" - And I wait for the page to be loaded Then I press "group_members_rightSelected" And I wait for the page to be loaded Then I press "Save settings" @@ -165,7 +153,6 @@ Feature: Group tool Scenario: Add fapple to the Group 0003 not allowed because group category allows 1 user per group Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -175,7 +162,6 @@ Feature: Group tool Then I click the "i.mdi-account" element And I wait for the page to be loaded Then I select "Fiona Apple Maggart (fapple)" from "group_members" - And I wait for the page to be loaded Then I press "group_members_rightSelected" And I wait for the page to be loaded Then I press "Save settings" @@ -188,19 +174,16 @@ Feature: Group tool # Group category overwrites all other groups settings. Scenario: Change Group category to allow multiple inscription of the user Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Edit this category" And I wait for the page to be loaded Then I should see "Edit group category: Group category 1" And I select "10" from "groups_per_user" - And I wait for the page to be loaded Then I press "Edit" And I wait for the page to be loaded Then I should see "Group settings have been modified" Scenario: Change Group 0003 settings to make announcements private Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -214,7 +197,6 @@ Feature: Group tool Scenario: Change Group 0004 settings to make it private Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0004" And I wait for the page to be loaded Then I should see "Group 0004" @@ -228,7 +210,6 @@ Feature: Group tool Scenario: Change Group 0005 settings to make announcements private between users Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0005" And I wait for the page to be loaded Then I should see "Group 0005" @@ -242,7 +223,6 @@ Feature: Group tool Scenario: Add fapple and acostea to Group 0005 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0005" And I wait for the page to be loaded Then I should see "Group 0005" @@ -252,9 +232,7 @@ Feature: Group tool Then I click the "i.mdi-account" element And I wait for the page to be loaded Then I additionally select "Fiona Apple Maggart (fapple)" from "group_members" - And I wait for the page to be loaded Then I additionally select "Andrea Costea (acostea)" from "group_members" - And I wait for the page to be loaded Then I press "group_members_rightSelected" And I wait for the page to be loaded Then I press "Save settings" @@ -267,7 +245,6 @@ Feature: Group tool Scenario: Add fapple to the Group 0003 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -277,7 +254,6 @@ Feature: Group tool Then I click the "i.mdi-account" element And I wait for the page to be loaded Then I select "Fiona Apple Maggart (fapple)" from "group_members" - And I wait for the page to be loaded Then I press "group_members_rightSelected" And I wait for the page to be loaded Then I press "Save settings" @@ -289,7 +265,6 @@ Feature: Group tool Scenario: Add acostea to the Group 0002 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0002" And I wait for the page to be loaded Then I should see "Group 0002" @@ -299,7 +274,6 @@ Feature: Group tool Then I click the "i.mdi-account" element And I wait for the page to be loaded Then I select "Andrea Costea (acostea)" from "group_members" - And I wait for the page to be loaded Then I press "group_members_rightSelected" And I wait for the page to be loaded Then I press "Save settings" @@ -311,7 +285,6 @@ Feature: Group tool Scenario: Create an announcement for everybody inside Group 0001 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0001" And I wait for the page to be loaded Then I should see "Group 0001" @@ -332,7 +305,6 @@ Feature: Group tool Scenario: Create an announcement for fapple inside Group 0001 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0001" And I wait for the page to be loaded Then I should see "Group 0001" @@ -344,7 +316,6 @@ Feature: Group tool Then I press "choose_recipients" And I wait for the page to be loaded Then I select "Fiona Apple Maggart" from "users" - And I wait for the page to be loaded Then I press "users_rightSelected" And I wait for the page to be loaded Then I fill in the following: @@ -359,7 +330,6 @@ Feature: Group tool Scenario: Create an announcement for everybody inside Group 0003 (private) Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -380,7 +350,6 @@ Feature: Group tool Scenario: Create an announcement for fapple inside Group 0003 Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -392,7 +361,6 @@ Feature: Group tool Then I press "choose_recipients" And I wait for the page to be loaded Then I select "Fiona Apple" from "users" - And I wait for the page to be loaded Then I press "users_rightSelected" And I wait for the page to be loaded Then I fill in the following: @@ -407,11 +375,8 @@ Feature: Group tool Scenario: Create an announcement as acostea and send only to fapple Given I am not logged - And I wait for the page to be loaded Then I am logged as "acostea" - And I wait for the page to be loaded Then I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0005" And I wait for the page to be loaded Then I should see "Group 0005" @@ -423,7 +388,6 @@ Feature: Group tool Then I press "choose_recipients" And I wait for the page to be loaded Then I select "Fiona Apple Maggart" from "users" - And I wait for the page to be loaded Then I press "users_rightSelected" And I wait for the page to be loaded Then I fill in the following: @@ -438,13 +402,9 @@ Feature: Group tool Scenario: Check fapple/acostea access of announcements Given I am not logged - And I wait for the page to be loaded Given I am logged as "fapple" - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0001" And I wait for the page to be loaded Then I should see "Group 0001" @@ -464,7 +424,6 @@ Feature: Group tool Then I save current URL with name "announcement_for_all_users_group_0001_public" Then I should see "Announcement description in Group 0001" And I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0003" And I wait for the page to be loaded Then I should see "Group 0003" @@ -484,7 +443,6 @@ Feature: Group tool Then I should see "Announcement description in Group 0003" Then I save current URL with name "announcement_for_all_users_group_0003_private" And I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded And I follow "Group 0005" And I wait for the page to be loaded Then I should see "Group 0005" @@ -497,13 +455,9 @@ Feature: Group tool ## Finish tests with fapple now check access with acostea ## Given I am not logged - And I wait for the page to be loaded Given I am logged as "acostea" - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded Then I should see "Group 0001" And I should see "Group 0002" And I should see "Group 0003" @@ -520,13 +474,9 @@ Feature: Group tool Given I am not logged - And I wait for the page to be loaded Given I am logged as "acostea" - And I wait for the page to be loaded And I am on course "TEMP" homepage - And I wait for the page to be loaded Given I am on "/main/group/group.php?cid=1&sid=0" - And I wait for the page to be loaded Then I should see "Group 0001" And I should see "Group 0002" And I should see "Group 0003" diff --git a/tests/behat/features/toolLink.feature b/tests/behat/features/toolLink.feature index 84d24acc425..1062c585365 100644 --- a/tests/behat/features/toolLink.feature +++ b/tests/behat/features/toolLink.feature @@ -8,7 +8,6 @@ Feature: Link tool Scenario: Create a link category Given I am on "/main/link/link.php?action=addcategory&cid=1" - And I wait for the page to be loaded When I fill in the following: | category_title | Category 1 | And I fill in editor field "description" with "Category description" @@ -19,7 +18,6 @@ Feature: Link tool Scenario: Create a link And I am on "/main/link/link.php?action=addlink&cid=1" - And I wait for the page to be loaded When I fill in the following: | url | http://www.chamilo.org | | title | Chamilo | @@ -30,7 +28,6 @@ Feature: Link tool Scenario: Create a link with category Given I am on "/main/link/link.php?action=addlink&cid=1" - And I wait for the page to be loaded When I fill in the following: | url | http://www.chamilo.org | | title | Chamilo in category 1 | @@ -41,7 +38,6 @@ Feature: Link tool Scenario: Delete link Given I am on "/main/link/link.php?cid=1" - And I wait for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait very long for the page to be loaded @@ -49,7 +45,6 @@ Feature: Link tool Scenario: Delete link category Given I am on "/main/link/link.php?cid=1" - And I wait for the page to be loaded And I click the "i.mdi-delete" element And I confirm the popup And wait very long for the page to be loaded diff --git a/tests/behat/features/toolLp.feature b/tests/behat/features/toolLp.feature index ea730692703..e783a73551c 100644 --- a/tests/behat/features/toolLp.feature +++ b/tests/behat/features/toolLp.feature @@ -8,7 +8,6 @@ Feature: LP tool Scenario: Create a LP category Given I am on "/main/lp/lp_controller.php?cid=1&action=add_lp_category" - And I wait for the page to be loaded When I fill in the following: | name | LP category 1 | And I press "submit" @@ -18,7 +17,6 @@ Feature: LP tool Scenario: Create a LP Given I am on "/main/lp/lp_controller.php?cid=1&action=add_lp" - And I wait for the page to be loaded When I fill in the following: | lp_name | LP 1 | # And I select "LP category 1" from "category_id" @@ -28,7 +26,6 @@ Feature: LP tool Scenario: Add document to LP Given I am on "/main/lp/lp_controller.php?cid=1&action=list" - And I wait for the page to be loaded And I press "LP 1" And I wait for the page to be loaded And I follow "Edit" @@ -44,7 +41,6 @@ Feature: LP tool Scenario: Add an exercise to LP Given I am on "/main/lp/lp_controller.php?cid=1&action=list" - And I wait very long for the page to be loaded And I press "LP 1" And I wait for the page to be loaded And I follow "Edit" @@ -57,7 +53,6 @@ Feature: LP tool Scenario: Enter LP Given I am on "/main/lp/lp_controller.php?cid=1&action=list" - And I wait for the page to be loaded And I press "LP 1" And wait very long for the page to be loaded Then I should see "LP 1" @@ -66,30 +61,24 @@ Feature: LP tool Scenario: Check the PDF export in LP list if hide SCORM PDF link is false Given I am on "/admin/settings/course" - And I wait for the page to be loaded And I check the "hide_scorm_pdf_link" radio button with "false" value And I press "Save settings" And I wait for the page to be loaded And I am on "/main/lp/lp_controller.php?cid=1&action=list&isStudentView=true" - And I wait for the page to be loaded Then I should see an icon with title "Export to PDF" Scenario: Check the PDF export in LP list if hide SCORM PDF link is true Given I am on "/admin/settings/course" - And I wait for the page to be loaded And I check the "hide_scorm_pdf_link" radio button with "true" value And I press "Save settings" And I wait for the page to be loaded And I am on "/main/lp/lp_controller.php?cid=1&action=list&isStudentView=true" - And I wait for the page to be loaded Then I should not see an icon with title "Export to PDF" Scenario: LP exists and LP category exists Given I am on course "TEMP" homepage - And I wait for the page to be loaded Then I should see "Learning path" Then I am on "/main/lp/lp_controller.php?cid=1&action=list" - And I wait for the page to be loaded Then I should see "LP 1" And I should see "LP category 1" @@ -97,9 +86,7 @@ Feature: LP tool Given I am not logged And I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I am on "/main/lp/lp_controller.php?cid=1&action=list" - And I wait for the page to be loaded Then I should see "LP 1" And I click the "i.mdi-dots-vertical" element And I follow "Delete" @@ -110,7 +97,6 @@ Feature: LP tool Scenario: Delete a LP category Given I am on "/main/lp/lp_controller.php?cid=1" - And I wait for the page to be loaded Then I should see "LP category 1" And I follow "Assessments" And wait very long for the page to be loaded @@ -118,4 +104,3 @@ Feature: LP tool And I press "dropdown695d2c916d195" And I follow "Delete selected" And I should not see "LP category 1" - And wait very long for the page to be loaded diff --git a/tests/behat/features/toolNotebook.feature b/tests/behat/features/toolNotebook.feature index 648bc16a732..9e31d522266 100644 --- a/tests/behat/features/toolNotebook.feature +++ b/tests/behat/features/toolNotebook.feature @@ -7,12 +7,10 @@ Feature: Notebook tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin creates a note and sees it Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Notebook" And I wait for the page to be loaded diff --git a/tests/behat/features/toolPortfolio.feature b/tests/behat/features/toolPortfolio.feature index 85a2d815789..5fe3d93a2cb 100644 --- a/tests/behat/features/toolPortfolio.feature +++ b/tests/behat/features/toolPortfolio.feature @@ -6,7 +6,6 @@ Feature: Portfolio tool Scenario: Create a portfolio item Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum Then I follow "Portfolio" And wait for the page to be loaded diff --git a/tests/behat/features/toolReporting.feature b/tests/behat/features/toolReporting.feature index dc017986324..15755281f60 100644 --- a/tests/behat/features/toolReporting.feature +++ b/tests/behat/features/toolReporting.feature @@ -7,12 +7,10 @@ Feature: Reporting tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin navigates reporting pages and checks them Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Reporting" And I wait for the page to be loaded diff --git a/tests/behat/features/toolThematic.feature b/tests/behat/features/toolThematic.feature index bfd3e29b5ae..ece773faf7d 100644 --- a/tests/behat/features/toolThematic.feature +++ b/tests/behat/features/toolThematic.feature @@ -5,7 +5,6 @@ Feature: Thematic tool Scenario: Create Given I am on "/main/course_progress/index.php?cid=1&action=thematic_add" - And I wait for the page to be loaded Then I fill in the following: | title | Thematic 1 | Then I fill in editor field "content" with "Description for thematic" @@ -15,7 +14,6 @@ Feature: Thematic tool Scenario: Read and add Thematic plan Given I am on "/main/course_progress/index.php?cid=1" - And I wait for the page to be loaded Then I should see "Thematic 1" Then I follow "Edit thematic section" And I wait for the page to be loaded @@ -29,7 +27,6 @@ Feature: Thematic tool Scenario: Update Given I am on "/main/course_progress/index.php?cid=1&action=thematic_edit&thematic_id=1" - And I wait for the page to be loaded Then I should see "Edit thematic section" Then I fill in the following: | title | Thematic 1 edited | @@ -40,7 +37,6 @@ Feature: Thematic tool Scenario: Delete Given I am on "/main/course_progress/index.php?cid=1&" - And I wait for the page to be loaded Then I should see "Thematic 1 edited" Then I click the "i.mdi-delete" element Then I confirm the popup diff --git a/tests/behat/features/toolUsers.feature b/tests/behat/features/toolUsers.feature index 0d16d29fe58..28e6d3f8977 100644 --- a/tests/behat/features/toolUsers.feature +++ b/tests/behat/features/toolUsers.feature @@ -7,12 +7,10 @@ Feature: Users tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin searches for 'amann' and unsubscribes the user Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Users" And I wait for the page to be loaded And I click the "i.mdi-account-plus" element @@ -28,7 +26,6 @@ Feature: Users tool Scenario: Admin uses a specific tab then searches for 'ywarnier' and unsubscribes Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Users" And I wait for the page to be loaded And I click the "a#tabs_69662037e3281-1" element diff --git a/tests/behat/features/toolWiki.feature b/tests/behat/features/toolWiki.feature index a7d79851ccc..03886827372 100644 --- a/tests/behat/features/toolWiki.feature +++ b/tests/behat/features/toolWiki.feature @@ -7,12 +7,10 @@ Feature: Wiki tool Background: Given I am a platform administrator - And I wait for the page to be loaded Scenario: Admin edits a wiki and sees the new content Given I am on course "TEMP" homepage - And I wait for the page to be loaded And I zoom out to maximum And I follow "Wiki" And I wait for the page to be loaded diff --git a/tests/behat/features/toolWork.feature b/tests/behat/features/toolWork.feature index 32c397bbf77..772a4becda4 100644 --- a/tests/behat/features/toolWork.feature +++ b/tests/behat/features/toolWork.feature @@ -5,7 +5,6 @@ Feature: Work tool Scenario: Create a work Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" Then I click the "span.mdi-folder-plus" element And I wait for the page to be loaded @@ -19,7 +18,6 @@ Feature: Work tool Scenario: Edit a work Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait very long for the page to be loaded And I follow "Work 1" @@ -38,7 +36,6 @@ Feature: Work tool Given I am not logged Given I am a student And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And I wait for the page to be loaded Then I should see "Work 1" @@ -57,7 +54,6 @@ Feature: Work tool Given I am not logged Given I am a platform administrator And I am on course "TEMP" homepage - And I wait for the page to be loaded And I follow "Assignments" And wait for the page to be loaded And I follow "Work 1" From 738d88866ad24e7a67655c67613c351c3cbb9c58 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 29 Apr 2026 08:21:31 +0200 Subject: [PATCH 2/4] Security: Fix eval() usage - refs GHSA-8rj2-88v5-mx6w --- .../inc/lib/pear/HTML/QuickForm/element.php | 32 ++++++++----------- .../main/inc/lib/pear/HTML/QuickForm/file.php | 32 ++++++++++--------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/public/main/inc/lib/pear/HTML/QuickForm/element.php b/public/main/inc/lib/pear/HTML/QuickForm/element.php index b122041835e..624ffacef8c 100644 --- a/public/main/inc/lib/pear/HTML/QuickForm/element.php +++ b/public/main/inc/lib/pear/HTML/QuickForm/element.php @@ -396,20 +396,8 @@ protected function _findValue(&$values) } } - /*$replacedName = str_replace( - array('\\', '\'', ']', '['), - array('\\\\', '\\\'', '', "']['"), - $elementName - ); - $myVar = "['$replacedName']"; - $result = eval("return (isset(\$values$myVar)) ? \$values$myVar : null;"); - //var_dump($result); - return $result;*/ - - // $elementName = extra_statusocial[extra_statusocial] ; preg_match('/(.*)\[(.*)\]/', $elementName, $matches); - // Getting extra_statusocial $elementKey = $matches[1]; $secondElementKey = ''; if (isset($matches[2])) { @@ -532,12 +520,20 @@ public function _prepareValue($value, $assoc) if (!strpos($name, '[')) { return array($name => $value); } else { - $valueAry = array(); - $myIndex = "['" . str_replace( - array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), - $name - ) . "']"; - eval("\$valueAry$myIndex = \$value;"); + $valueAry = []; + $parts = preg_split('/[\[\]]+/', $name, -1, PREG_SPLIT_NO_EMPTY); + $ref = &$valueAry; + $last = count($parts) - 1; + foreach ($parts as $i => $part) { + if ($i === $last) { + $ref[$part] = $value; + } else { + if (!isset($ref[$part]) || !is_array($ref[$part])) { + $ref[$part] = []; + } + $ref = &$ref[$part]; + } + } return $valueAry; } } diff --git a/public/main/inc/lib/pear/HTML/QuickForm/file.php b/public/main/inc/lib/pear/HTML/QuickForm/file.php index 24da2ae3cf6..a1cb11ac3bd 100644 --- a/public/main/inc/lib/pear/HTML/QuickForm/file.php +++ b/public/main/inc/lib/pear/HTML/QuickForm/file.php @@ -195,23 +195,25 @@ public function _findValue(&$values = null) if (isset($_FILES[$elementName])) { return $_FILES[$elementName]; } elseif (false !== ($pos = strpos($elementName, '['))) { - $base = str_replace( - array('\\', '\''), array('\\\\', '\\\''), - substr($elementName, 0, $pos) - ); - $idx = "['" . str_replace( - array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), - substr($elementName, $pos + 1, -1) - ) . "']"; - $props = array('name', 'type', 'size', 'tmp_name', 'error'); - $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" . - " return null;\n" . - "} else {\n" . - " \$value = array();\n"; + $base = substr($elementName, 0, $pos); + $keys = preg_split('/[\[\]]+/', substr($elementName, $pos + 1, -1), -1, PREG_SPLIT_NO_EMPTY); + if (!isset($_FILES[$base]['name'])) { + return null; + } + $props = ['name', 'type', 'size', 'tmp_name', 'error']; + $value = []; foreach ($props as $prop) { - $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n"; + $ref = $_FILES[$base][$prop] ?? null; + foreach ($keys as $key) { + if (!is_array($ref) || !array_key_exists($key, $ref)) { + $ref = null; + break; + } + $ref = $ref[$key]; + } + $value[$prop] = $ref; } - return eval($code . " return \$value;\n}\n"); + return isset($value['name']) ? $value : null; } else { return null; } From 313a1f7ad6918878a78cec1639638bea7b673780 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 29 Apr 2026 22:56:31 +0200 Subject: [PATCH 3/4] CI: Test Behat optimizations --- config/packages/framework.yaml | 3 +- tests/behat/behat.yml | 4 +- .../features/bootstrap/FeatureContext.php | 211 +++++++++++++----- tests/behat/features/career.feature | 8 + tests/behat/features/class.feature | 5 + tests/behat/features/course.feature | 4 +- tests/behat/features/createUser.feature | 33 ++- 7 files changed, 187 insertions(+), 81 deletions(-) diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index fbea9642cff..c9dcc5c9145 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -9,7 +9,8 @@ framework: # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. session: - handler_id: null + handler_id: 'session.handler.native_file' + save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%' cookie_secure: auto cookie_samesite: lax name: chamilo2 diff --git a/tests/behat/behat.yml b/tests/behat/behat.yml index a04298f2ddf..2bf2cdc5d52 100644 --- a/tests/behat/behat.yml +++ b/tests/behat/behat.yml @@ -1,11 +1,11 @@ default: extensions: Behat\MinkExtension: - base_url: http://localhost + base_url: http://my.chamilo.net default_session: selenium2 javascript_session: selenium2 selenium2: - wd_host: "http://127.0.0.1:4444" + wd_host: "http://127.0.0.1:4444/wd/hub" browser: chrome capabilities: browserName: chrome diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 84e37da281e..899cfa3a157 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -91,7 +91,8 @@ public function courseIsDeleted($argument): void public function iAmOnCourseXHomepage($courseCode): void { $this->visit('/main/course_home/redirect.php?cidReq='.$courseCode); - //$this->visit('/courses/'.$courseCode.'/index.php'); + // Course tools are loaded asynchronously via API after Vue mounts + $this->waitForSelector('#course-tools a', 10000); $this->assertElementNotOnPage('.alert-danger'); } @@ -102,6 +103,7 @@ public function iAmOnCourseXHomepage($courseCode): void public function iAmOnCourseXHomepageInSessionY($courseCode, $sessionName): void { $this->visit('/main/course_home/redirect.php?cidReq='.$courseCode.'&session_name='.$sessionName); + $this->waitForSelector('#course-tools a', 10000); $this->assertElementNotOnPage('.alert-danger'); } @@ -111,7 +113,7 @@ public function iAmOnCourseXHomepageInSessionY($courseCode, $sessionName): void public function iAmOnTheHomepageOfCourseX($courseId): void { $this->visit('/course/'.$courseId.'/home'); - //$this->visit('/courses/'.$courseCode.'/index.php'); + $this->waitForSelector('#course-tools a', 10000); $this->assertElementNotOnPage('.alert-danger'); } @@ -121,6 +123,7 @@ public function iAmOnTheHomepageOfCourseX($courseId): void public function iAmOnTheHomepageOfCourseXInSessionY($courseId, $sessionId): void { $this->visit('/course/'.$courseId.'&sid='.$sessionId); + $this->waitForSelector('#course-tools a', 10000); $this->assertElementNotOnPage('.alert-danger'); } @@ -138,12 +141,60 @@ public function iAmAXUser($argument) */ public function iAmLoggedAs($username) { - $this->visit('/logout'); - $this->visit('/login'); - $this->fillField('login', $username); - $this->fillField('password', $username); - $this->pressButton('Sign in'); - $this->waitForSelector('.app-topbar'); + $passwords = [ + 'admin' => 'admin11+', + ]; + $password = $passwords[$username] ?? $username; + + if ($this->getSession()->isStarted()) { + parent::visit($this->getMinkParameter('base_url').'/logout'); + $this->getSession()->reset(); + } + + // Visit login to establish a fresh PHP session (creates the session cookie) + parent::visit($this->getMinkParameter('base_url').'/login'); + $this->getSession()->wait(4000, "document.readyState === 'complete'"); + + // Clear stale auth data from previous sessions so Vue starts fresh + $this->getSession()->executeScript( + 'try { localStorage.clear(); sessionStorage.clear(); } catch(e) {}' + ); + + // Authenticate via synchronous XHR — bypasses the Vue form entirely, + // immune to race conditions, throttle counter resets after success. + $u = addslashes($username); + $p = addslashes($password); + // Retry up to 3 times — PHP session GC intermittently causes 500 when + // /var/lib/php/sessions is not accessible (Permission denied on gc cleanup). + $status = 0; + $body = ''; + for ($attempt = 0; $attempt < 3; $attempt++) { + if ($attempt > 0) { + $this->getSession()->wait(1000); + } + $result = $this->getSession()->evaluateScript( + "(function(){ + var x = new XMLHttpRequest(); + x.open('POST', '/login_json', false); + x.setRequestHeader('Content-Type', 'application/json'); + x.send(JSON.stringify({username:'$u', password:'$p'})); + return {status: x.status, body: x.responseText.substring(0, 300)}; + })()" + ); + $status = (int) ($result['status'] ?? 0); + $body = (string) ($result['body'] ?? ''); + if (200 === $status) { + break; + } + } + + if (200 !== $status) { + throw new \Exception("Login failed for '$username' after 3 attempts — HTTP $status. Body: $body"); + } + + // Warm up the legacy PHP session bridge: LegacyListener sets _user in session + $this->visit('/admin'); + $this->waitForThePageToBeLoaded(); } /** @@ -153,12 +204,28 @@ public function iAmLoggedAs($username) */ public function iShouldNotSeeAnError() { - $this->assertSession()->pageTextNotContains('Internal server error'); - $this->assertSession()->pageTextNotContains('error'); - $el = $this->getSession()->getPage()->find( - 'css', - '.alert-danger' + // Wait for page to have visible content before checking (avoids false empty-body reads) + $this->getSession()->wait( + 5000, + "document.readyState === 'complete' && document.body && (document.body.innerText || '').trim().length > 0" ); + // Use JS for text checks — atomic, avoids stale-element on Vue re-renders + $text = strtolower((string) $this->getSession()->evaluateScript( + 'return document.body ? (document.body.innerText || document.body.textContent || "") : ""' + )); + if (str_contains($text, 'internal server error')) { + throw new \Behat\Mink\Exception\ExpectationException( + 'Page contains "Internal server error"', + $this->getSession() + ); + } + if (str_contains($text, 'error')) { + throw new \Behat\Mink\Exception\ExpectationException( + 'Page contains "error"', + $this->getSession() + ); + } + $el = $this->getSession()->getPage()->find('css', '.alert-danger'); if (null !== $el) { $this->assertSession()->elementAttributeContains('css', '.alert-danger', 'style', 'display:none;'); } else { @@ -228,7 +295,9 @@ public function iHaveAPublicPasswordProtectedCourse($code, $password) */ public function iAmNotLogged() { - $this->visit('/logout'); + if ($this->getSession()->isStarted()) { + $this->getSession()->reset(); + } } /** @@ -389,52 +458,50 @@ public function iFillInAjaxSelectInputWithAndSelect($field, $id, $value) */ public function confirmPopup() { - $session = $this->getSession(); - // 1) accept_alert() (alert native) - try { - $driver = $session->getDriver(); + $session = $this->getSession(); - try { - $driver->getWebDriverSession()->accept_alert(); - return; - } catch (\Exception $e) {} - - } catch (\Exception $e) { - // ignore - } + // 1) Native browser alert + try { + $session->getDriver()->getWebDriverSession()->accept_alert(); + return; + } catch (\Exception $e) {} - // wait for the HTML modal - $session->wait(5000, "document.querySelector('.swal2-container') !== null"); + // 2) PrimeVue ConfirmDialog ("Yes" button with severity=secondary) + $session->wait(5000, "document.querySelector('.p-confirmdialog') !== null || document.querySelector('.swal2-container') !== null"); - // JS: attempt to click a visible confirmation button inside the modal $js = <<<'JS' (function(){ - function isVisible(el){ - if(!el) return false; - var rect = el.getBoundingClientRect(); - return !!(rect.width || rect.height) && window.getComputedStyle(el).visibility !== 'hidden' && window.getComputedStyle(el).display !== 'none'; - } - function clickEl(el){ - if(!el) return false; - try { el.style.pointerEvents = 'auto'; el.style.zIndex = 999999; } catch(e){} - try { if(el.focus) el.focus(); el.click(); return true; } catch(e){ - } - } - // attempt to click a visible confirmation button inside the modal - var modal = document.querySelector('.swal2-container'); - - var el = modal.querySelector('.swal2-confirm'); - if (el && isVisible(el)) { - if (clickEl(el)) return true; - } - return false; - })(); - JS; - try { - $clicked = (bool) $session->executeScript($js); - if ($clicked) - return; - } catch (\Exception $e) { + function click(el) { + if (!el) return false; + try { el.style.pointerEvents = 'auto'; el.style.zIndex = 999999; } catch(e){} + try { el.focus(); el.click(); return true; } catch(e){ return false; } + } + // PrimeVue ConfirmDialog: click the accept (Yes) button + var dlg = document.querySelector('.p-confirmdialog'); + if (dlg) { + // acceptProps severity=secondary → .p-button-secondary; or just find first button that says "Yes" + var btns = dlg.querySelectorAll('button'); + for (var i = 0; i < btns.length; i++) { + var t = (btns[i].textContent || '').trim(); + if (t === 'Yes' || t === 'Oui' || btns[i].classList.contains('p-button-secondary')) { + if (click(btns[i])) return true; + } + } + // fallback: first button in dialog + if (btns.length > 0 && click(btns[0])) return true; + } + // SweetAlert2 fallback + var swal = document.querySelector('.swal2-container'); + if (swal) { + var el = swal.querySelector('.swal2-confirm'); + if (el && click(el)) return true; + } + return false; + })(); + JS; + + $clicked = (bool) $session->executeScript($js); + if (!$clicked) { throw new \Exception('confirmPopup: no confirmation button found or clickable'); } } @@ -518,10 +585,18 @@ public function iFillInSelectWithOptionValue($field, $value, $class) /** * @When /^(?:|I )wait for the page to be loaded$/ + * @When /^wait the page to be loaded when ready$/ */ public function waitForThePageToBeLoaded(): void { - $this->getSession()->wait(8000, "document.readyState === 'complete'"); + // For Vue SPA pages, readyState alone is not enough: Vue renders after scripts run. + // We also wait until #app has at least one child (i.e. the app has mounted). + // Legacy PHP pages have no #app, so the second condition is vacuously true for them. + $this->getSession()->wait( + 8000, + "document.readyState === 'complete' && " . + "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0)" + ); } /** @@ -529,7 +604,11 @@ public function waitForThePageToBeLoaded(): void */ public function waitVeryLongForThePageToBeLoaded(): void { - $this->getSession()->wait(14000, "document.readyState === 'complete'"); + $this->getSession()->wait( + 14000, + "document.readyState === 'complete' && " . + "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0)" + ); } /** @@ -549,6 +628,17 @@ public function waitForSelector(string $css, int $timeoutMs = 8000): void $this->getSession()->wait($timeoutMs, "document.querySelector('$escaped') !== null"); } + /** + * @When /^I wait for jqGrid to load$/ + */ + public function waitForJqGridToLoad(): void + { + // Step 1: wait for jqGrid to initialize (fires in $(document).ready, same tick as readyState===complete) + $this->getSession()->wait(5000, "document.querySelector('.ui-jqgrid') !== null"); + // Step 2: wait for jqGrid's AJAX data fetch to complete + $this->getSession()->wait(8000, "typeof jQuery !== 'undefined' && jQuery.active === 0"); + } + /** * @When /^(?:|I )wait one minute for the page to be loaded$/ */ @@ -775,6 +865,12 @@ public function assertPageContainsTable($tableId, TableNode $tableData) */ public function iClickTheElement($selector) { + $this->waitForSelector($selector, 8000); + $escaped = addslashes($selector); + // Scroll element into view so it is interactable even when off-screen + $this->getSession()->executeScript( + "var el = document.querySelector('$escaped'); if (el) { el.scrollIntoView({behavior:'instant',block:'center'}); }" + ); $page = $this->getSession()->getPage(); $element = $page->find('css', $selector); @@ -854,7 +950,6 @@ public function zoomOutMax() public function visit($page): void { parent::visit($page); - $this->waitForThePageToBeLoaded(); } } diff --git a/tests/behat/features/career.feature b/tests/behat/features/career.feature index d016fbcdb91..ced98a4f873 100644 --- a/tests/behat/features/career.feature +++ b/tests/behat/features/career.feature @@ -13,12 +13,14 @@ Feature: Career And I fill in editor field "description" with "Description" And I press "submit" And I wait for the page to be loaded + And I wait for jqGrid to load Then I should see "Developer" And I should not see an error Scenario: Edit a career Given I am a platform administrator And I am on "/main/admin/careers.php" + And I wait for jqGrid to load Then I should not see an error And I should see "Developer" And I click the "i.mdi-pencil" element @@ -26,31 +28,37 @@ Feature: Career And I fill in editor field "description" with "Description edited" And I press "submit" And I wait for the page to be loaded + And I wait for jqGrid to load Then I should see "Developer" Scenario: Copy a career Given I am a platform administrator And I am on "/main/admin/careers.php" + And I wait for jqGrid to load And I should not see an error And I should see "Developer" When I click the "i.mdi-text-box-plus" element And I confirm the popup Then I wait for the page to be loaded + And I wait for jqGrid to load And I should not see an error And I should see "Developer Copy" Scenario: Delete a career Given I am a platform administrator And I am on "/main/admin/careers.php" + And I wait for jqGrid to load Then I should not see an error And I should see "Developer" When I click the "i.mdi-delete" element And I confirm the popup And I wait for the page to be loaded + And I wait for jqGrid to load Then I should not see an error When I click the "i.mdi-delete" element And I confirm the popup And I wait for the page to be loaded + And I wait for jqGrid to load Then I should not see an error And I should not see "Developer Copy" And I should not see "Developer" diff --git a/tests/behat/features/class.feature b/tests/behat/features/class.feature index 54523d85322..fd8ad3f4a1b 100644 --- a/tests/behat/features/class.feature +++ b/tests/behat/features/class.feature @@ -12,11 +12,13 @@ Feature: Classes Then I attach the file "/public/img/logo.png" to "picture" And I press "submit" And wait for the page to be loaded + And I wait for jqGrid to load Then I should not see an error Scenario: Update a class Given I am a platform administrator And I am on "/main/admin/usergroups.php" + And I wait for jqGrid to load Then I should see "Class 1" And I click the "i.mdi-pencil" element And I wait for the page to be loaded @@ -25,12 +27,15 @@ Feature: Classes Then I fill in editor field "description" with "description" And I press "submit" And wait for the page to be loaded + And I wait for jqGrid to load Then I should not see an error Scenario: Delete a class Given I am a platform administrator And I am on "/main/admin/usergroups.php" + And I wait for jqGrid to load Then I should see "Class 1" When I click the "i.mdi-delete" element And I confirm the popup + And I wait for jqGrid to load Then I should not see "Class 1" diff --git a/tests/behat/features/course.feature b/tests/behat/features/course.feature index 13822e2c81e..623ea6a8f8d 100644 --- a/tests/behat/features/course.feature +++ b/tests/behat/features/course.feature @@ -18,7 +18,7 @@ Feature: Course tools basic testing Scenario: See the course creation link on the admin page Given I am on "/main/admin/index.php" - Then I should see "Add course" + Then I should see "Courses" Scenario: Create a course before testing @@ -26,7 +26,7 @@ Feature: Course tools basic testing And I fill in "title" with "TEMP" When I press "submit" And wait very long for the page to be loaded - Then I should see "TEMP" + Then I should not see an error Scenario: Make sure the course exists diff --git a/tests/behat/features/createUser.feature b/tests/behat/features/createUser.feature index 531b699d81d..f343c71b2ce 100644 --- a/tests/behat/features/createUser.feature +++ b/tests/behat/features/createUser.feature @@ -8,8 +8,9 @@ Feature: Users management as admin Given I am a platform administrator Scenario: See the users list link on the admin page - Given I am on "/main/admin/index.php" - Then I should see "Users list" + Given I am on "/admin" + And I wait for the ".p-menuitem-text" element + Then I should see "User list" And I should see "Add a user" Scenario: Create a user with only basic info @@ -55,17 +56,15 @@ Feature: Users management as admin Scenario: Search a user - Given I am on "/main/admin/user_list.php" - And wait the page to be loaded when ready - And I fill in "keyword" with "smarshall" - And I press "submit" - And wait for the page to be loaded + Given I am on "/admin/user-list?keyword=smarshall" + And I wait for the "tr[data-index]" element Then I should see "Sammy" And I should see "Marshall" Scenario: Delete a user - Given I am on "/main/admin/user_list.php?keyword=smarshall" + Given I am on "/admin/user-list?keyword=smarshall" + And I wait for the "tr[data-index]" element And I click the "i.mdi-delete" element And I confirm the popup And wait very long for the page to be loaded @@ -95,8 +94,7 @@ Feature: Users management as admin | email | teacher@example.com | | username | teacher | | password | teacher00! | -# And I fill in select bootstrap static input "#status_select" select "1" - And I select "Trainer" from "status_select" + And I select "Teacher" from "Roles" And I click the "input#send_mail_no" element And I press "submit" And wait very long for the page to be loaded @@ -110,19 +108,18 @@ Feature: Users management as admin | email | student@example.com | | username | student | | password | student00! | -# And I fill in select bootstrap static input "#status_select" select "5" - And I select "Learner" from "status_select" + And I select "Learner" from "Roles" And I click the "input#send_mail_no" element And I press "submit" And wait very long for the page to be loaded Then I should not see an error Scenario: HRM follows teacher - Given I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" - And wait the page to be loaded when ready + Given I am on "/admin/user-list?keyword=hrm" + And I wait for the "tr[data-index]" element And I should see "HRM lastname" And I should see "Human Resources Manager" - And I click the "i.mdi-account-child" element + And I click the ".mdi-account-child" element And wait the page to be loaded when ready And I select "teacher firstname teacher lastname" from "NoAssignedUsersList[]" And I press "add_user_button" @@ -131,11 +128,11 @@ Feature: Users management as admin Then I should not see an error Scenario: HRM follows student - Given I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" - And wait the page to be loaded when ready + Given I am on "/admin/user-list?keyword=hrm" + And I wait for the "tr[data-index]" element And I should see "HRM lastname" And I should see "Human Resources Manager" - And I click the "i.mdi-account-child" element + And I click the ".mdi-account-child" element And wait the page to be loaded when ready And I select "student firstname student lastname" from "NoAssignedUsersList[]" And I press "add_user_button" From 19afb38813fe089194252f4cdbbf89bb8a951fc1 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 7 May 2026 11:09:22 +0200 Subject: [PATCH 4/4] CI: Improve speed, extend and fix createUsers Behat test --- tests/behat/behat.yml | 2 + .../features/bootstrap/FeatureContext.php | 470 +++++++++++++++++- tests/behat/features/createUser.feature | 89 ++-- 3 files changed, 484 insertions(+), 77 deletions(-) diff --git a/tests/behat/behat.yml b/tests/behat/behat.yml index 2bf2cdc5d52..13fa1119cb0 100644 --- a/tests/behat/behat.yml +++ b/tests/behat/behat.yml @@ -17,6 +17,8 @@ default: - "--disable-dev-shm-usage" - "--disable-gpu" - "--window-size=1920,1080" + "goog:loggingPrefs": + browser: "ALL" files_path: "%paths.base%/../../" suites: default: diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 899cfa3a157..cac67e6fe91 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -16,6 +16,48 @@ public function __construct() { } + /** + * Clean up test users created by createUser.feature before the feature runs. + * Prevents stale state from a previous aborted run from causing cascading failures. + * + * @BeforeFeature @administration + */ + public static function cleanUpTestUsers(\Behat\Behat\Hook\Scope\BeforeFeatureScope $scope): void + { + $testUsernames = ['smarshall', 'hrm', 'teacher', 'student']; + // Locate .env (two directories up from bootstrap/) + $envFile = __DIR__.'/../../../../.env'; + $cfg = ['DATABASE_HOST' => 'localhost', 'DATABASE_PORT' => '3306', 'DATABASE_NAME' => '', 'DATABASE_USER' => '', 'DATABASE_PASSWORD' => '']; + if (is_file($envFile)) { + foreach (file($envFile) as $line) { + $line = trim($line); + if ('' === $line || str_starts_with($line, '#')) { + continue; + } + foreach (array_keys($cfg) as $key) { + if (str_starts_with($line, $key.'=')) { + $val = substr($line, strlen($key) + 1); + $cfg[$key] = trim($val, "\"' \t"); + } + } + } + } + if ('' === $cfg['DATABASE_NAME']) { + return; + } + try { + $pdo = new \PDO( + "mysql:host={$cfg['DATABASE_HOST']};port={$cfg['DATABASE_PORT']};dbname={$cfg['DATABASE_NAME']};charset=utf8mb4", + $cfg['DATABASE_USER'], + $cfg['DATABASE_PASSWORD'] + ); + $placeholders = implode(',', array_fill(0, count($testUsernames), '?')); + $pdo->prepare("DELETE FROM user WHERE username IN ($placeholders)")->execute($testUsernames); + } catch (\Throwable $e) { + echo "\n[BeforeFeature] Could not clean up test users: ".$e->getMessage()."\n"; + } + } + /** * @Given /^I am a platform administrator$/ */ @@ -24,6 +66,77 @@ public function iAmAPlatformAdministrator() $this->iAmLoggedAs('admin'); } + /** + * Directly creates a USER_RELATION_TYPE_RRHH (type 7) relationship so an HRM + * user can "login as" the target user. Bypasses the legacy PHP dual-list UI + * which is brittle (option text includes "(username)" suffix that Mink can't match). + * + * @Given /^"([^"]*)" follows "([^"]*)" as HRM$/ + */ + public function userFollowsAsHrm(string $hrmUsername, string $targetUsername): void + { + $pdo = $this->getTestPdo(); + $stmt = $pdo->prepare( + 'SELECT id FROM user WHERE username = ?' + ); + $stmt->execute([$hrmUsername]); + $hrmId = $stmt->fetchColumn(); + $stmt->execute([$targetUsername]); + $targetId = $stmt->fetchColumn(); + if (!$hrmId || !$targetId) { + throw new \RuntimeException("Could not find hrm='$hrmUsername' (id=$hrmId) or target='$targetUsername' (id=$targetId)."); + } + // USER_RELATION_TYPE_RRHH = 7. + // Direction matches UserManager::subscribeUsersToUser: user_id=target, friend_user_id=HRM + // (getUsersFollowedByUser queries WHERE friend_user_id = HRM_ID) + $pdo->prepare( + 'INSERT IGNORE INTO user_rel_user (user_id, friend_user_id, relation_type) VALUES (?, ?, 7)' + )->execute([$targetId, $hrmId]); + } + + /** + * Navigate directly to the myStudents tracking page for a given username. + * Looks up the user ID from the database so tests don't need to hard-code IDs. + * + * @Given /^I am on the tracking page for "([^"]*)"$/ + */ + public function iAmOnTrackingPageFor(string $username): void + { + $pdo = $this->getTestPdo(); + $stmt = $pdo->prepare('SELECT id FROM user WHERE username = ?'); + $stmt->execute([$username]); + $userId = $stmt->fetchColumn(); + if (!$userId) { + throw new \RuntimeException("User '$username' not found in database."); + } + $this->visit('/main/my_space/myStudents.php?student='.(int) $userId); + $this->waitForThePageToBeLoaded(); + } + + private function getTestPdo(): \PDO + { + $envFile = __DIR__.'/../../../../.env'; + $cfg = ['DATABASE_HOST' => 'localhost', 'DATABASE_PORT' => '3306', 'DATABASE_NAME' => '', 'DATABASE_USER' => '', 'DATABASE_PASSWORD' => '']; + if (is_file($envFile)) { + foreach (file($envFile) as $line) { + $line = trim($line); + if ('' === $line || str_starts_with($line, '#')) { + continue; + } + foreach (array_keys($cfg) as $key) { + if (str_starts_with($line, $key.'=')) { + $cfg[$key] = trim(substr($line, strlen($key) + 1), "\"' \t"); + } + } + } + } + return new \PDO( + "mysql:host={$cfg['DATABASE_HOST']};port={$cfg['DATABASE_PORT']};dbname={$cfg['DATABASE_NAME']};charset=utf8mb4", + $cfg['DATABASE_USER'], + $cfg['DATABASE_PASSWORD'] + ); + } + /** * @Given /^I am a teacher$/ */ @@ -466,42 +579,64 @@ public function confirmPopup() return; } catch (\Exception $e) {} - // 2) PrimeVue ConfirmDialog ("Yes" button with severity=secondary) + // 2) PrimeVue ConfirmDialog: wait for dialog to appear AND animation to finish $session->wait(5000, "document.querySelector('.p-confirmdialog') !== null || document.querySelector('.swal2-container') !== null"); + // Wait until dialog is present AND its enter animation is complete + $session->wait(2000, + "(function(){ var d = document.querySelector('.p-confirmdialog'); " . + "return d && !d.classList.contains('p-dialog-enter-active') && !d.classList.contains('p-dialog-enter-from'); })()" + ); $js = <<<'JS' (function(){ function click(el) { if (!el) return false; try { el.style.pointerEvents = 'auto'; el.style.zIndex = 999999; } catch(e){} - try { el.focus(); el.click(); return true; } catch(e){ return false; } + try { + el.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true, view: window})); + return true; + } catch(e) {} + try { el.click(); return true; } catch(e) { return false; } } - // PrimeVue ConfirmDialog: click the accept (Yes) button + // PrimeVue ConfirmDialog: target accept button by its specific class var dlg = document.querySelector('.p-confirmdialog'); if (dlg) { - // acceptProps severity=secondary → .p-button-secondary; or just find first button that says "Yes" + var acceptBtn = dlg.querySelector('.p-confirmdialog-accept-button'); + if (click(acceptBtn)) return true; + // Fallback: button with text "Yes" or "Oui" var btns = dlg.querySelectorAll('button'); for (var i = 0; i < btns.length; i++) { - var t = (btns[i].textContent || '').trim(); - if (t === 'Yes' || t === 'Oui' || btns[i].classList.contains('p-button-secondary')) { + if ((btns[i].textContent||'').trim() === 'Yes' || (btns[i].textContent||'').trim() === 'Oui') { if (click(btns[i])) return true; } } - // fallback: first button in dialog - if (btns.length > 0 && click(btns[0])) return true; } // SweetAlert2 fallback var swal = document.querySelector('.swal2-container'); if (swal) { var el = swal.querySelector('.swal2-confirm'); - if (el && click(el)) return true; + if (click(el)) return true; } return false; })(); JS; - $clicked = (bool) $session->executeScript($js); - if (!$clicked) { + // executeScript may return null if the accept handler navigates away (form.submit()). + // In that case the confirmation DID succeed, so we treat null as "clicked". + try { + $result = $session->executeScript($js); + } catch (\Exception $e) { + // Page navigation during script execution — confirmation was accepted + return; + } + + if (null === $result) { + // Page navigated away during script execution — confirmation was accepted + return; + } + + if (!(bool) $result) { + // Dialog was still present but nothing was clickable — true failure throw new \Exception('confirmPopup: no confirmation button found or clickable'); } } @@ -589,13 +724,14 @@ public function iFillInSelectWithOptionValue($field, $value, $class) */ public function waitForThePageToBeLoaded(): void { - // For Vue SPA pages, readyState alone is not enough: Vue renders after scripts run. - // We also wait until #app has at least one child (i.e. the app has mounted). - // Legacy PHP pages have no #app, so the second condition is vacuously true for them. + // Brief sleep allows any in-flight navigation (form submit, redirect) to start + // before we begin polling; without it, the condition can fire on the old page. + $this->getSession()->wait(300); $this->getSession()->wait( 8000, "document.readyState === 'complete' && " . - "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0)" + "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0) && " . + "(document.querySelector('#sectionMainContent') === null || document.querySelector('#sectionMainContent').style.display !== 'none')" ); } @@ -604,10 +740,15 @@ public function waitForThePageToBeLoaded(): void */ public function waitVeryLongForThePageToBeLoaded(): void { + // Sleep gives the browser time to start any in-flight navigation (form submit, + // redirect) before we begin polling; without it the condition fires immediately + // on the old page (which already satisfies readyState=complete). + $this->getSession()->wait(1500); $this->getSession()->wait( 14000, "document.readyState === 'complete' && " . - "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0)" + "(document.querySelector('#app') === null || document.querySelector('#app').children.length > 0) && " . + "(document.querySelector('#sectionMainContent') === null || document.querySelector('#sectionMainContent').style.display !== 'none')" ); } @@ -628,6 +769,227 @@ public function waitForSelector(string $css, int $timeoutMs = 8000): void $this->getSession()->wait($timeoutMs, "document.querySelector('$escaped') !== null"); } + /** + * @When /^(?:|I )wait until the URL contains "([^"]*)"$/ + */ + public function waitUntilUrlContains(string $fragment): void + { + $escaped = addslashes($fragment); + $this->getSession()->wait(10000, "window.location.href.indexOf('$escaped') !== -1"); + } + + /** + * Trigger a Vue Router push to the current URL. + * Fixes the issue where lazy route components don't render on initial full-page load + * because the component factory is never called until a SPA navigation occurs. + * Uses a roundtrip via /home (eagerly loaded) to avoid NavigationDuplicated. + * + * @When /^I trigger Vue SPA navigation$/ + */ + public function triggerVueSpaNavigation(): void + { + $this->getSession()->executeScript( + '(function(){ + window.__vueSpaNavDone__ = false; + window.__vueSpaNavError__ = null; + var app = document.getElementById("app"); + var vueApp = app && app.__vue_app__; + if (!vueApp) { window.__vueSpaNavDone__ = true; return; } + var router = vueApp.config.globalProperties.$router; + if (!router) { window.__vueSpaNavDone__ = true; return; } + var targetPath = router.currentRoute.value.fullPath; + // Use force:true to bypass NavigationDuplicated and trigger a real re-navigation + router.push({ path: targetPath, force: true }).then(function() { + // Wait for nextTick to ensure DOM is committed after vnode update + var nextTick = vueApp.config.globalProperties.$nextTick || Promise.resolve.bind(Promise); + return nextTick(); + }).then(function() { + window.__vueSpaNavDone__ = true; + }).catch(function(err) { + window.__vueSpaNavError__ = err ? (err.message || String(err)) : "unknown"; + window.__vueSpaNavDone__ = true; + }); + })()' + ); + $result = $this->getSession()->wait(20000, "window.__vueSpaNavDone__ === true"); + if (!$result) { + throw new \RuntimeException('Vue SPA navigation did not complete within 20 seconds.'); + } + $error = $this->getSession()->evaluateScript('return window.__vueSpaNavError__'); + if ($error) { + echo "\n[Vue nav notice]: $error\n"; + } + // Wait for Vue DOM updates to commit (scheduler flushes async) + usleep(3000000); + } + + /** + * @When /^I wait (\d+) seconds for the "([^"]*)" element$/ + */ + public function waitSecondsForSelector(int $seconds, string $css): void + { + $this->waitForSelector($css, $seconds * 1000); + } + + /** + * Dump browser console logs (errors, warnings) captured by ChromeDriver. + * + * @When /^I dump browser console logs$/ + */ + public function iDumpBrowserConsoleLogs(): void + { + $driver = $this->getSession()->getDriver(); + if (!$driver instanceof \Behat\Mink\Driver\Selenium2Driver) { + echo "\n[console logs] Driver is not Selenium2\n"; + return; + } + try { + $logs = $driver->getWebDriverSession()->log('browser'); + echo "\n=== BROWSER CONSOLE LOGS (" . count($logs) . " entries) ===\n"; + foreach ($logs as $entry) { + $level = $entry['level'] ?? '?'; + $msg = $entry['message'] ?? ''; + echo "[$level] $msg\n"; + } + echo "=== END CONSOLE LOGS ===\n"; + } catch (\Throwable $e) { + echo "\n[console logs] Could not retrieve: " . $e->getMessage() . "\n"; + } + } + + /** + * Wait until the page's visible text contains the given string (polls until timeout). + * Use this instead of waitForSelector+assertPageContainsText when the content + * arrives asynchronously (Vue SPAs, lazy-loaded data) to avoid race conditions + * where the element exists but its text hasn't been populated yet. + * + * @When /^I wait until I see "([^"]*)"$/ + * @When /^wait until I see "([^"]*)"$/ + */ + public function iWaitUntilISee(string $text): void + { + $escaped = addslashes($text); + $result = $this->getSession()->wait( + 45000, + "(document.body ? (document.body.innerText || document.body.textContent || '') : '').indexOf('$escaped') !== -1" + ); + if (!$result) { + // Debug: dump final state before throwing + $debug = (string) $this->getSession()->evaluateScript( + '(function(){ + var app = document.getElementById("app"); + var vueApp = app && app.__vue_app__; + if (!vueApp) return "no vueApp"; + var router = vueApp.config.globalProperties.$router; + var route = router ? router.currentRoute.value.name : "no router"; + var pinia = vueApp.config.globalProperties.$pinia; + var isAdmin = false; + var isLoading = "?"; + if (pinia && pinia.state.value.security) { + var s = pinia.state.value.security; + isLoading = s.isLoading; + isAdmin = !!(s.user && s.user.roles && (s.user.roles.indexOf("ROLE_ADMIN") !== -1 || s.user.roles.indexOf("ROLE_GLOBAL_ADMIN") !== -1)); + } + var adminIdx = document.querySelector(".admin-index"); + var chunks = window.webpackChunkChamilo ? window.webpackChunkChamilo.length : "N/A"; + var bodyText = document.body ? (document.body.innerText || "").substring(0, 300) : "nobody"; + return "route="+route+" isAdmin="+isAdmin+" isLoading="+isLoading+" chunks="+chunks+" adminIdx="+(!!adminIdx)+" body="+bodyText; + })()' + ); + echo "\n[iWaitUntilISee debug] $debug\n"; + throw new \RuntimeException("Text '$text' did not appear on the page within 12 seconds."); + } + } + + /** + * @When /^I dump the page body text$/ + */ + public function iDumpThePageBodyText(): void + { + $text = (string) $this->getSession()->evaluateScript( + 'return document.body ? (document.body.innerText || document.body.textContent || "BODY_EMPTY") : "NO_BODY"' + ); + echo "\n=== PAGE BODY TEXT (first 2000 chars) ===\n"; + echo mb_substr($text, 0, 2000) . "\n"; + echo "=== URL: " . $this->getSession()->getCurrentUrl() . " ===\n"; + + $debug = (string) $this->getSession()->evaluateScript( + 'return (function() { + var info = {}; + info.url = window.location.href; + info.chunks = window.webpackChunkChamilo ? window.webpackChunkChamilo.length : "N/A"; + var app = document.getElementById("app"); + var vueApp = app && app.__vue_app__; + if (!vueApp) { info.vue = "no vueApp"; return JSON.stringify(info); } + var router = vueApp.config.globalProperties.$router; + if (router) { + info.route = router.currentRoute.value.name; + info.path = router.currentRoute.value.fullPath; + info.matched = router.currentRoute.value.matched.length; + // Check what component factories the matched records have + info.matchedComponents = router.currentRoute.value.matched.map(function(r) { + var c = r.components && r.components.default; + return typeof c === "function" ? "lazy:"+c.name : (typeof c === "object" ? "eager" : typeof c); + }); + } + var pinia = vueApp.config.globalProperties.$pinia; + if (pinia) { + var stores = Object.keys(pinia.state.value); + info.stores = stores; + if (pinia.state.value.security) { + info.isAuthenticated = !!(pinia.state.value.security.user && pinia.state.value.security.user.id); + info.isLoading = pinia.state.value.security.isLoading; + } + if (pinia.state.value.platformConfig) { + info.platformIsLoading = pinia.state.value.platformConfig.isLoading; + } + } + var adminIndex = document.querySelector(".admin-index"); + info.adminIndexExists = !!adminIndex; + // Check for AdminBlock/PrimeVue elements + info.pPanelCount = document.querySelectorAll(".p-panel, .p-card, [class*=admin]").length; + // Check app-main + var appMain = document.querySelector(".app-main"); + info.appMainChildCount = appMain ? appMain.childNodes.length : 0; + // Dump the full app-main innerHTML for analysis + info.appMainFull = appMain ? appMain.innerHTML.substring(0, 500) : "null"; + // Walk Vue component tree to find RouterView and inspect its state + try { + var root = vueApp._instance; + var treeLines = []; + function walkTree(vnode, depth) { + if (!vnode || depth > 15) return; + var typeName = "?"; + if (!vnode.type) typeName = "null"; + else if (typeof vnode.type === "string") typeName = "<"+vnode.type+">"; + else if (typeof vnode.type === "symbol") typeName = "Fragment"; + else if (vnode.type.__name) typeName = vnode.type.__name; + else if (vnode.type.name) typeName = vnode.type.name; + else typeName = typeof vnode.type; + var indent = " ".repeat(depth); + var extra = ""; + if (vnode.component && vnode.component.setupState) { + var ss = vnode.component.setupState; + if (ss.matchedRouteRef !== undefined) { + extra += " [RV matched="+(ss.matchedRouteRef && ss.matchedRouteRef.value ? (ss.matchedRouteRef.value.path || "ok") : "null")+"]"; + } + } + treeLines.push(indent + typeName + extra); + if (vnode.component) { + walkTree(vnode.component.subTree, depth + 1); + } else if (Array.isArray(vnode.children)) { + vnode.children.forEach(function(c) { walkTree(c, depth + 1); }); + } + } + walkTree(root.subTree, 0); + info.tree = treeLines.join("\n"); + } catch(e) { info.tree = "error: "+e.message; } + return JSON.stringify(info); + })()' + ); + echo "=== VUE STATE ===\n" . json_encode(json_decode($debug), JSON_PRETTY_PRINT) . "\n"; + } + /** * @When /^I wait for jqGrid to load$/ */ @@ -867,14 +1229,23 @@ public function iClickTheElement($selector) { $this->waitForSelector($selector, 8000); $escaped = addslashes($selector); - // Scroll element into view so it is interactable even when off-screen + // Scroll element into view so it is interactable even when off-screen, + // then use JavaScript click - avoids sticky-header occlusion issues with WebDriver physical clicks. + $exists = $this->getSession()->evaluateScript( + "!!document.querySelector('$escaped')" + ); + if (!$exists) { + throw new \RuntimeException("Element '$selector' not found on page."); + } $this->getSession()->executeScript( - "var el = document.querySelector('$escaped'); if (el) { el.scrollIntoView({behavior:'instant',block:'center'}); }" + "(function(){ + var el = document.querySelector('$escaped'); + el.scrollIntoView({behavior:'instant',block:'center'}); + // If the element is inside a button, click the button so Vue event handlers fire. + var clickTarget = el.closest('button') || el.closest('a') || el; + clickTarget.click(); + })();" ); - $page = $this->getSession()->getPage(); - $element = $page->find('css', $selector); - - $element->click(); } /** @@ -947,6 +1318,61 @@ public function zoomOutMax() return true; } + public function fillField($field, $value): void + { + $field = $this->fixStepArgument($field); + $value = $this->fixStepArgument($value); + + $usedNative = false; + try { + $this->getSession()->getPage()->fillField($field, $value); + $usedNative = true; + } catch (\Exception $e) { + if (false === strpos($e->getMessage(), 'interactable') && false === strpos($e->getMessage(), 'ElementNotInteractable')) { + throw $e; + } + } + + // After native fill, verify the value was actually set (Selenium sendKeys can silently + // drop non-ASCII characters like accented letters). If mismatch, fall through to JS. + if ($usedNative) { + $element = $this->getSession()->getPage()->findField($field); + if ($element) { + $actualValue = $element->getValue(); + if ($actualValue === $value) { + return; + } + } else { + return; + } + } + + // PrimeVue float-label elements have the