From a97d5b76e66eba1f2817e876cbdb717f749b5562 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 21 Oct 2024 18:11:32 -0500 Subject: [PATCH] Fix behat tests (#5880) * CI: Fix users name displayed in test to create session * CI: Fix behat test for matching question * CI: Fix behat test for oral expression question * CI: Fix behat test for Combination true/false/don't-know question * CI: Fix users name displayed in test to create session * Survey: Fix duplication --- main/survey/survey.lib.php | 2 +- tests/behat/features/sessionAccess.feature | 5 +++-- tests/behat/features/toolExercise.feature | 6 +++++- tests/behat/features/toolSurvey.feature | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index c780e69726..1f243f13c9 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -58,7 +58,7 @@ class SurveyManager */ public static function checkUniqueCode($surveyCode) { - if (empty($courseCode)) { + if (empty($surveyCode)) { return false; } $courseId = api_get_course_int_id(); diff --git a/tests/behat/features/sessionAccess.feature b/tests/behat/features/sessionAccess.feature index 3b05341eb8..5cfa671480 100644 --- a/tests/behat/features/sessionAccess.feature +++ b/tests/behat/features/sessionAccess.feature @@ -18,7 +18,7 @@ Feature: Session access Then I should see "Subscribe users to this session" Then I follow "Multiple registration" Then wait for the page to be loaded - Then I select "Warnier Yannick (ywarnier)" from "nosessionUsersList[]" + Then I select "Yannick Warnier (ywarnier)" from "nosessionUsersList[]" And I press "add_user" And I press "next" Then I should see "Session1" @@ -40,7 +40,8 @@ Feature: Session access Then I should see "Update successful" Then I should see "Subscribe users to this session" Then I follow "Multiple registration" - Then I select "Mosquera Guardamino Michela (mmosquera)" from "nosessionUsersList[]" + Then wait for the page to be loaded + Then I select "Michela Mosquera Guardamino (mmosquera)" from "nosessionUsersList[]" And I press "add_user" And I press "next" Then I should see "Session2" diff --git a/tests/behat/features/toolExercise.feature b/tests/behat/features/toolExercise.feature index 2044a16268..572dcf8542 100644 --- a/tests/behat/features/toolExercise.feature +++ b/tests/behat/features/toolExercise.feature @@ -106,6 +106,7 @@ Feature: Exercise tool And I fill in ckeditor field "option[2]" with "Option B" And I fill in select bootstrap static input "#matches_2" select "2" And I press "submitQuestion" + And wait for the page to be loaded Then I should see "Item added" Scenario: Add question "Open" to exercise created "Exercise 1" @@ -128,6 +129,7 @@ Feature: Exercise tool | questionName | Oral expression question | | weighting | 10 | And I press "submitQuestion" + And wait for the page to be loaded Then I should see "Item added" Scenario: Add question "Exact answers combination" to exercise created "Exercise 1" @@ -206,6 +208,7 @@ Feature: Exercise tool Then I fill in ckeditor field "comment[1]" with "Comment true" Then I fill in ckeditor field "comment[2]" with "Comment false" And I press "submitQuestion" + And wait for the page to be loaded Then I should see "Item added" Scenario: Add question "Global multiple answer" to exercise created "Exercise 1" @@ -353,7 +356,8 @@ Feature: Exercise tool And I press "next" Then I should see "Update successful" Then I follow "Multiple registration" - Then I select "Costea Andrea (acostea)" from "nosessionUsersList[]" + Then wait for the page to be loaded + Then I select "Andrea Costea (acostea)" from "nosessionUsersList[]" And I press "add_user" And I press "next" Then I should see "Update successful" diff --git a/tests/behat/features/toolSurvey.feature b/tests/behat/features/toolSurvey.feature index 7e992f31f5..43749d32a1 100644 --- a/tests/behat/features/toolSurvey.feature +++ b/tests/behat/features/toolSurvey.feature @@ -51,6 +51,7 @@ Feature: Survey tool Scenario: Duplicate survey Given I am on "/main/survey/survey_list.php?cidReq=TEMP" And I follow "Duplicate survey" + And I press "Copy survey" Then I should see "Survey copied" And I should see "Survey 1 Copy"