From 2ad7d3fa41ce8185dde9f7829e8b7eae5c816e83 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 11 Aug 2022 14:00:21 +0200 Subject: [PATCH 1/4] MOBILE-4081 comments: Restore behat tests --- .../comments/tests/behat/basic_usage.feature | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/src/core/features/comments/tests/behat/basic_usage.feature b/src/core/features/comments/tests/behat/basic_usage.feature index 6f4c9ff3f..bd6d90a43 100644 --- a/src/core/features/comments/tests/behat/basic_usage.feature +++ b/src/core/features/comments/tests/behat/basic_usage.feature @@ -22,25 +22,13 @@ Feature: Test basic usage of comments in app And the following "activities" exist: | activity | name | intro | course | idnumber | comments | | data | Data | Data info | C1 | data1 | 1 | + And the following "mod_data > fields" exist: + | database | type | name | description | + | data1 | text | Test field name | Test field description | - # Skip in master until MDL-75353 is fixed - @lms_upto4.0 Scenario: Add comments & Delete comments (database) # Create database entry and comment as a teacher Given I entered the data activity "Data" on course "Course 1" as "teacher1" in the app - And I press "Information" in the app - # TODO Create and use a generator for database fields. - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I add a "Text input" field to "Data" database and I fill the form with: - | Field name | Test field name | - | Field description | Test field description | - And I press "Save" - And I close the browser tab opened by the app - And I close the popup in the app - - When I pull to refresh in the app And I press "Add entries" in the app And I set the field "Test field name" to "Test" in the app And I press "Save" in the app @@ -76,22 +64,8 @@ Feature: Test basic usage of comments in app When I press the back button in the app Then I should find "Comments (1)" in the app - # Skip in master until MDL-75353 is fixed - @lms_upto4.0 Scenario: Add comments offline & Delete comments offline & Sync comments (database) Given I entered the data activity "Data" on course "Course 1" as "teacher1" in the app - And I press "Information" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I add a "Text input" field to "Data" database and I fill the form with: - | Field name | Test field name | - | Field description | Test field description | - And I press "Save" - And I close the browser tab opened by the app - And I close the popup in the app - - When I pull to refresh in the app And I press "Add entries" in the app And I set the field "Test field name" to "Test" in the app And I press "Save" in the app From bd0c1c8c579fa61b12b30131c85156e3ed6ed1d5 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 11 Aug 2022 15:59:05 +0200 Subject: [PATCH 2/4] MOBILE-4081 courses: Remove LMS UI behat steps --- .../tests/behat/basic_usage-311.feature | 17 +++++------------ .../course/tests/behat/basic_usage.feature | 16 ++++------------ .../tests/behat/basic_usage-310.feature | 18 ++---------------- .../tests/behat/basic_usage-311.feature | 19 ++----------------- .../courses/tests/behat/basic_usage.feature | 18 ++---------------- 5 files changed, 15 insertions(+), 73 deletions(-) diff --git a/src/core/features/course/tests/behat/basic_usage-311.feature b/src/core/features/course/tests/behat/basic_usage-311.feature index dd88d8151..99d3f88c7 100755 --- a/src/core/features/course/tests/behat/basic_usage-311.feature +++ b/src/core/features/course/tests/behat/basic_usage-311.feature @@ -72,18 +72,11 @@ Feature: Test basic usage of one course in app | workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 | Scenario: Self enrol - Given I entered the course "Course 1" as "teacher1" in the app - And I press "Course summary" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I press "Actions menu" - And I follow "More..." - And I follow "Users" - And I follow "Enrolment methods" - And I click on "Enable" "icon" in the "Self enrolment (Student)" "table_row" - And I close the browser tab opened by the app - Given I entered the app as "student2" + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I add "Self enrolment" enrolment method with: + | Custom instance name | Student self enrolment | + And I entered the app as "student2" When I press "Site home" in the app And I press "Available courses" in the app And I press "Course 1" in the app diff --git a/src/core/features/course/tests/behat/basic_usage.feature b/src/core/features/course/tests/behat/basic_usage.feature index 322516ba9..c7fa7ff33 100755 --- a/src/core/features/course/tests/behat/basic_usage.feature +++ b/src/core/features/course/tests/behat/basic_usage.feature @@ -406,18 +406,10 @@ Feature: Test basic usage of one course in app @lms_from4.0 Scenario: Self enrol - Given I entered the course "Course 1" as "teacher1" in the app - And I press "Course summary" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I click on "Participants" "link" - And I select "Enrolment methods" from the "jump" singleselect - And I click on "Enable" "icon" in the "Self enrolment (Student)" "table_row" - And I close the browser tab opened by the app - And I close the popup in the app - - Given I entered the app as "student2" + Given I log in as "teacher1" + And I add "Self enrolment" enrolment method in "Course 1" with: + | Custom instance name | Student self enrolment | + And I entered the app as "student2" When I press "Site home" in the app And I press "Available courses" in the app And I press "Course 1" in the app diff --git a/src/core/features/courses/tests/behat/basic_usage-310.feature b/src/core/features/courses/tests/behat/basic_usage-310.feature index e34eb0b25..3b849a2c3 100755 --- a/src/core/features/courses/tests/behat/basic_usage-310.feature +++ b/src/core/features/courses/tests/behat/basic_usage-310.feature @@ -31,24 +31,10 @@ Feature: Test basic usage of courses in app | choice | Choice course 3 | Test choice description | C3 | choice1 | Option 1, Option 2, Option 3 | | choice | Choice course 4 | Test choice description | C4 | choice1 | Option 1, Option 2, Option 3 | And the following "activities" exist: - | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | - | assign | C1 | assign1 | assignment | Test assignment description | 1 | + | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | duedate | gradingduedate | + | assign | C1 | assign1 | assignment | Test assignment description | 1 | ##tomorrow## | ##tomorrow## | Scenario: Links to actions in Timeline work for teachers/students - # Configure assignment as teacher - Given I entered the assign activity "assignment" on course "Course 1" as "teacher1" in the app - When I press "Information" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I press "Actions menu" - And I follow "Edit settings" - And I press "Expand all" - And I click on "duedate[enabled]" "checkbox" - And I click on "gradingduedate[enabled]" "checkbox" - And I press "Save and return to course" - And I close the browser tab opened by the app - # Submit assignment as student Given I entered the app as "student1" When I press "Open block drawer" in the app diff --git a/src/core/features/courses/tests/behat/basic_usage-311.feature b/src/core/features/courses/tests/behat/basic_usage-311.feature index fd43cb910..8d6f7e6f8 100755 --- a/src/core/features/courses/tests/behat/basic_usage-311.feature +++ b/src/core/features/courses/tests/behat/basic_usage-311.feature @@ -31,8 +31,8 @@ Feature: Test basic usage of courses in app | choice | Choice course 3 | Test choice description | C3 | choice1 | Option 1, Option 2, Option 3 | | choice | Choice course 4 | Test choice description | C4 | choice1 | Option 1, Option 2, Option 3 | And the following "activities" exist: - | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | - | assign | C1 | assign1 | assignment | Test assignment description | 1 | + | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | duedate | gradingduedate | + | assign | C1 | assign1 | assignment | Test assignment description | 1 | ##tomorrow## | ##tomorrow## | Scenario: "Dashboard" tab displayed Given I entered the app as "student1" @@ -79,21 +79,6 @@ Feature: Test basic usage of courses in app @lms_from3.11 Scenario: Links to actions in Timeline work for teachers/students - # Configure assignment as teacher - Given I entered the course "Course 1" as "teacher1" in the app - When I press "assignment" in the app - And I press "Information" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I press "Actions menu" - And I follow "Edit settings" - And I press "Expand all" - And I click on "duedate[enabled]" "checkbox" - And I click on "gradingduedate[enabled]" "checkbox" - And I press "Save and return to course" - And I close the browser tab opened by the app - # Submit assignment as student Given I entered the app as "student1" When I press "Open block drawer" in the app diff --git a/src/core/features/courses/tests/behat/basic_usage.feature b/src/core/features/courses/tests/behat/basic_usage.feature index 803f091fa..ff9f939c2 100755 --- a/src/core/features/courses/tests/behat/basic_usage.feature +++ b/src/core/features/courses/tests/behat/basic_usage.feature @@ -34,8 +34,8 @@ Feature: Test basic usage of courses in app | choice | Choice course 3 | Test choice description | C3 | choice1 | Option 1, Option 2, Option 3 | | choice | Choice course 4 | Test choice description | C4 | choice1 | Option 1, Option 2, Option 3 | And the following "activities" exist: - | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | - | assign | C1 | assign1 | assignment | Test assignment description | 1 | + | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | duedate | gradingduedate | + | assign | C1 | assign1 | assignment | Test assignment description | 1 | ##tomorrow## | ##tomorrow## | @lms_from4.0 Scenario: "Dashboard" tab displayed @@ -113,21 +113,7 @@ Feature: Test basic usage of courses in app And I should find "Course 4" in the app @lms_from4.0 - # TODO remove LMS UI steps in app tests Scenario: Links to actions in Timeline work for teachers/students - # Configure assignment as teacher - Given I entered the assign activity "assignment" on course "Course 1" as "teacher1" in the app - When I press "Information" in the app - And I press "Open in browser" in the app - And I switch to the browser tab opened by the app - And I log in as "teacher1" - And I navigate to "Settings" in current page administration - And I click on "Expand all" "link" - And I click on "duedate[enabled]" "checkbox" - And I click on "gradingduedate[enabled]" "checkbox" - And I press "Save and return to course" - And I close the browser tab opened by the app - # Submit assignment as student Given I entered the app as "student1" When I press "Add submission" in the app From 0498f13a3d02a33542b72b763e3b28c0f5772adb Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 30 Aug 2022 16:50:07 +0200 Subject: [PATCH 3/4] MOBILE-4081 theme: Remove duplicated variable --- src/theme/theme.base.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index 4942e809c..9e6103704 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -608,7 +608,6 @@ body.core-iframe-fullscreen ion-router-outlet { --core-header-toolbar-color: white; --core-header-toolbar-background: black; --core-header-buttons-background: var(--core-header-toolbar-background); - --core-header-buttons-background: var(--core-header-toolbar-background); --core-header-buttons-color: var(--core-header-toolbar-color); --core-header-toolbar-border-width: 0px; From 8a0e0b0cc8eac830a08f827b2a260f929ac496ec Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 5 Sep 2022 10:38:02 +0200 Subject: [PATCH 4/4] MOBILE-4081 behat: Check site compatibility Whether the version of the moodle site is compatible should be checked automatically, however with the current implementation it's only checked once the app is launched. So in some scenarios, it may be necessary to explicitly tell behat to check the site. --- local_moodleappbehat/tests/behat/behat_app.php | 10 ++++++++++ .../course/tests/behat/basic_usage-311.feature | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/local_moodleappbehat/tests/behat/behat_app.php b/local_moodleappbehat/tests/behat/behat_app.php index 4b644d1f3..84f4f2220 100644 --- a/local_moodleappbehat/tests/behat/behat_app.php +++ b/local_moodleappbehat/tests/behat/behat_app.php @@ -558,6 +558,16 @@ class behat_app extends behat_app_helper { } } + /** + * Check whether the moodle site is compatible with the current feature file + * and skip it otherwise. This will be checked looking at tags such as @lms_uptoXXX + * + * @Given the Moodle site is compatible with this feature + */ + public function the_moodle_site_is_compatible_with_this_feature() { + $this->check_tags(); + } + /** * Clicks on / touches something that is visible in the app. * diff --git a/src/core/features/course/tests/behat/basic_usage-311.feature b/src/core/features/course/tests/behat/basic_usage-311.feature index 99d3f88c7..99b642baf 100755 --- a/src/core/features/course/tests/behat/basic_usage-311.feature +++ b/src/core/features/course/tests/behat/basic_usage-311.feature @@ -72,7 +72,8 @@ Feature: Test basic usage of one course in app | workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 | Scenario: Self enrol - Given I log in as "teacher1" + Given the Moodle site is compatible with this feature + And I log in as "teacher1" And I am on "Course 1" course homepage And I add "Self enrolment" enrolment method with: | Custom instance name | Student self enrolment |