From 226dce1c9237439b18b015b4d35c0f88bd524131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20S=C3=A1nchez?= Date: Wed, 14 Dec 2022 20:13:35 +0100 Subject: [PATCH 01/14] System: Fix Behat scenario 'Enter to public password-protected course' - refs GH#1678 --- main/course_info/infocours.php | 2 +- .../behat/features/bootstrap/FeatureContext.php | 4 +++- tests/behat/features/course.feature | 17 +++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index 1808e13462d..a3ff2723974 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -271,7 +271,7 @@ function is_settings_editable() $group2[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); $group2[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); -$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); +$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save_access', true); $group3[] = $form->createElement( 'radio', diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 31ddbb92ae0..8a6b75b355b 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -188,9 +188,11 @@ public function iHaveAPublicPasswordProtectedCourse($code, $password) ); $this->pressButton('submit'); $this->visit('/main/course_info/infocours.php?cidReq='.$code); + $this->clickLink('Course access'); + $this->waitForThePageToBeLoaded(); $this->assertPageContainsText('Course registration password'); $this->fillField('course_registration_password', $password); - $this->pressButton('submit_save'); + $this->pressButton('update_course_submit_save_access'); $this->assertFieldContains('course_registration_password', $password); } diff --git a/tests/behat/features/course.feature b/tests/behat/features/course.feature index 549fc790b2d..53352ef4485 100644 --- a/tests/behat/features/course.feature +++ b/tests/behat/features/course.feature @@ -158,13 +158,10 @@ Feature: Course tools basic testing And I am on "/main/course_info/maintenance.php" Then I should not see an ".alert-danger" element -# Scenario: Enter to public password-protected course -# Given I have a public password-protected course named "PASSWORDPROTECTED" with password "123456" -# And I am not logged -# And I am on "/courses/PASSWORDPROTECTED/index.php" -# When I fill in "course_password" with "123456" -# And I press "submit" -# Then I should not see "The course password is incorrect" - - - + Scenario: Enter to public password-protected course + Given I have a public password-protected course named "PASSWORDPROTECTED" with password "123456" + And I am not logged + And I am on "/courses/PASSWORDPROTECTED/index.php" + When I fill in "course_password" with "123456" + And I press "submit" + Then I should not see "The course password is incorrect" \ No newline at end of file From d2e2aa1f8bf44a80398c887ef530c936dcaeba79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20S=C3=A1nchez?= Date: Thu, 12 Jan 2023 13:20:15 +0100 Subject: [PATCH 02/14] System: Upgrade chromedriver-version to '108.0.5359.71' --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c46b3e798a2..c957898be9a 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -111,7 +111,7 @@ jobs: uses: nanasess/setup-chromedriver@master with: # Optional: do not specify to match Chrome's version - chromedriver-version: '88.0.4324.96' + chromedriver-version: '108.0.5359.71' - run: | export DISPLAY=:99 From 7c315977db5d66f7f3ba24c814339a1ee2937f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20S=C3=A1nchez?= Date: Thu, 12 Jan 2023 15:52:02 +0100 Subject: [PATCH 03/14] System: Change selenium screen resolution --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c957898be9a..dcd46a0a986 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -116,7 +116,7 @@ jobs: - run: | export DISPLAY=:99 chromedriver --url-base=/wd/hub & - sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional + sudo Xvfb -ac :99 -screen 0 1920x1080x24 > /dev/null 2>&1 & # optional # wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip --quiet && unzip chromedriver_linux64.zip # sudo mv chromedriver /usr/bin From 23b0dde459a4d0c45a3f09779677b151a7c12908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20S=C3=A1nchez?= Date: Thu, 12 Jan 2023 16:26:48 +0100 Subject: [PATCH 04/14] System: Change field to find --- tests/behat/features/bootstrap/FeatureContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 8a6b75b355b..0634deb172f 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -191,7 +191,7 @@ public function iHaveAPublicPasswordProtectedCourse($code, $password) $this->clickLink('Course access'); $this->waitForThePageToBeLoaded(); $this->assertPageContainsText('Course registration password'); - $this->fillField('course_registration_password', $password); + $this->fillField('update_course_course_registration_password', $password); $this->pressButton('update_course_submit_save_access'); $this->assertFieldContains('course_registration_password', $password); } From 45d9c1f05015d8d1168e6715ea65b43c1d8be7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20S=C3=A1nchez?= Date: Thu, 12 Jan 2023 17:52:28 +0100 Subject: [PATCH 05/14] System: Change field to find --- main/inc/lib/formvalidator/FormValidator.class.php | 2 +- tests/behat/features/bootstrap/FeatureContext.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index cc6be204565..056adb32ddb 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -1020,7 +1020,7 @@ public function addPanelOption($name, $title, $groupList) '