diff --git a/local_moodleappbehat/tests/behat/behat_app.php b/local_moodleappbehat/tests/behat/behat_app.php index 6eb1d6b7e..cfb235690 100644 --- a/local_moodleappbehat/tests/behat/behat_app.php +++ b/local_moodleappbehat/tests/behat/behat_app.php @@ -1102,4 +1102,15 @@ class behat_app extends behat_app_helper { $this->zone_js("navigator.navigateToSitePath('/calendar/index', $options)"); } + /** + * Change the viewport size in the browser running the Moodle App. + * + * @Given /^I change viewport size to "(?P\d+)x(?P\d+)" in the app$/ + * @param int $width Width + * @param int $height Height + */ + public function i_change_viewport_size_in_the_app(int $width, int $height) { + $this->resize_app_window($width, $height); + } + } diff --git a/local_moodleappbehat/tests/behat/behat_app_helper.php b/local_moodleappbehat/tests/behat/behat_app_helper.php index f30572b01..70235a55c 100644 --- a/local_moodleappbehat/tests/behat/behat_app_helper.php +++ b/local_moodleappbehat/tests/behat/behat_app_helper.php @@ -600,9 +600,7 @@ EOF; /** * Resize window to have app dimensions. */ - protected function resize_app_window() { - $width = 500; - $height = 720; + protected function resize_app_window(int $width = 500, int $height = 720) { $offset = $this->evaluate_script("{ x: window.outerWidth - document.body.offsetWidth, y: window.outerHeight - window.innerHeight, diff --git a/src/addons/competency/tests/behat/navigation.feature b/src/addons/competency/tests/behat/navigation.feature index f0f5932d1..21002f034 100644 --- a/src/addons/competency/tests/behat/navigation.feature +++ b/src/addons/competency/tests/behat/navigation.feature @@ -299,7 +299,7 @@ Feature: Test competency navigation Scenario: Tablet navigation (student) Given I entered the course "Course 1" as "student1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Course competencies When I press "Competencies" in the app @@ -384,7 +384,7 @@ Feature: Test competency navigation Scenario: Tablet navigation (teacher) Given I entered the course "Course 1" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Participant competencies When I press "Participants" in the app diff --git a/src/addons/mod/assign/tests/behat/navigation.feature b/src/addons/mod/assign/tests/behat/navigation.feature index 487a9c34d..356cb8427 100644 --- a/src/addons/mod/assign/tests/behat/navigation.feature +++ b/src/addons/mod/assign/tests/behat/navigation.feature @@ -151,7 +151,7 @@ Feature: Test assignments navigation Scenario: Tablet navigation on assignment Given I entered the course "Course 1" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Initial status When I press "Assignment" in the app diff --git a/src/addons/mod/chat/tests/behat/navigation.feature b/src/addons/mod/chat/tests/behat/navigation.feature index 75b06cd18..a79f05f30 100644 --- a/src/addons/mod/chat/tests/behat/navigation.feature +++ b/src/addons/mod/chat/tests/behat/navigation.feature @@ -29,7 +29,7 @@ Feature: Test chat navigation Scenario: Tablet navigation on chat Given I entered the course "Course 1" as "student2" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Sessions When I press "Test chat name" in the app diff --git a/src/addons/mod/feedback/tests/behat/navigation.feature b/src/addons/mod/feedback/tests/behat/navigation.feature index d0e9e61fc..3d6646654 100644 --- a/src/addons/mod/feedback/tests/behat/navigation.feature +++ b/src/addons/mod/feedback/tests/behat/navigation.feature @@ -380,7 +380,7 @@ Feature: Test feedback navigation Scenario: Tablet navigation Given I entered the course "Course 1" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Preview When I press "Feedback" in the app diff --git a/src/addons/mod/forum/tests/behat/basic_usage.feature b/src/addons/mod/forum/tests/behat/basic_usage.feature index d1fe3a64d..0a463b880 100755 --- a/src/addons/mod/forum/tests/behat/basic_usage.feature +++ b/src/addons/mod/forum/tests/behat/basic_usage.feature @@ -41,7 +41,7 @@ Feature: Test basic usage of forum activity in app Scenario: New discussion automatically opened in tablet Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app When I press "Add discussion topic" in the app And I set the field "Subject" to "My happy subject" in the app diff --git a/src/addons/mod/forum/tests/behat/groups.feature b/src/addons/mod/forum/tests/behat/groups.feature index b542c22c0..bd02d7162 100755 --- a/src/addons/mod/forum/tests/behat/groups.feature +++ b/src/addons/mod/forum/tests/behat/groups.feature @@ -323,7 +323,7 @@ Feature: Test usage of forum activity with groups in app Scenario: New discussion not opened in tablet if not visible Given I entered the forum activity "Separate groups forum" on course "Course 1" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app When I press "Separate groups" in the app And I press "Group 1" in the app diff --git a/src/addons/mod/forum/tests/behat/navigation.feature b/src/addons/mod/forum/tests/behat/navigation.feature index 89dae9dee..4c3512113 100644 --- a/src/addons/mod/forum/tests/behat/navigation.feature +++ b/src/addons/mod/forum/tests/behat/navigation.feature @@ -143,7 +143,7 @@ Feature: Test forum navigation Scenario: Tablet navigation on forum Given I entered the course "Course 1" as "student1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # By last reply When I press "Forum" in the app diff --git a/src/addons/mod/glossary/tests/behat/navigation.feature b/src/addons/mod/glossary/tests/behat/navigation.feature index 4700884e6..4b09df7db 100644 --- a/src/addons/mod/glossary/tests/behat/navigation.feature +++ b/src/addons/mod/glossary/tests/behat/navigation.feature @@ -214,7 +214,7 @@ Feature: Test glossary navigation @ci_jenkins_skip Scenario: Tablet navigation on glossary Given I entered the course "Course 1" as "student1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Alphabetically When I press "Fruits glossary" in the app diff --git a/src/addons/notifications/tests/behat/notifications.feature b/src/addons/notifications/tests/behat/notifications.feature index 90e500400..21f5eff1f 100644 --- a/src/addons/notifications/tests/behat/notifications.feature +++ b/src/addons/notifications/tests/behat/notifications.feature @@ -81,7 +81,7 @@ Feature: Notifications Scenario: Tablet navigation Given I enter the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app And I log in as "student1" And I press "Notifications" in the app Then I should find "Test 30" in the app diff --git a/src/core/features/grades/tests/behat/navigation-401.feature b/src/core/features/grades/tests/behat/navigation-401.feature index b6b3c6b1b..6aca275e2 100644 --- a/src/core/features/grades/tests/behat/navigation-401.feature +++ b/src/core/features/grades/tests/behat/navigation-401.feature @@ -84,7 +84,7 @@ Feature: Grades navigation # in 4.1. It tests the grades from participants profile instead. Scenario: Tablet navigation (teacher) Given I entered the course "Course 2" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Course grades When I press "Participants" in the app diff --git a/src/core/features/grades/tests/behat/navigation.feature b/src/core/features/grades/tests/behat/navigation.feature index 1ee0a463a..113960acc 100644 --- a/src/core/features/grades/tests/behat/navigation.feature +++ b/src/core/features/grades/tests/behat/navigation.feature @@ -203,7 +203,7 @@ Feature: Grades navigation Scenario: Tablet navigation (student) Given I entered the course "Course 2" as "student1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Course grades When I press "Grades" in the app @@ -284,7 +284,7 @@ Feature: Grades navigation @lms_from4.2 Scenario: Tablet navigation (teacher) Given I entered the course "Course 2" as "teacher1" in the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # User grades When I press "Grades" in the app diff --git a/src/core/features/reportbuilder/tests/behat/reportbuilder.feature b/src/core/features/reportbuilder/tests/behat/reportbuilder.feature index fc004127d..9c356811c 100644 --- a/src/core/features/reportbuilder/tests/behat/reportbuilder.feature +++ b/src/core/features/reportbuilder/tests/behat/reportbuilder.feature @@ -133,7 +133,7 @@ Feature: Report builder Scenario: Open report in tablet Given I enter the app - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app And I log in as "student1" And I press the user menu button in the app When I press "Reports" in the app diff --git a/src/core/features/settings/tests/behat/settings_navigation.feature b/src/core/features/settings/tests/behat/settings_navigation.feature index 5e14ec472..a25562164 100644 --- a/src/core/features/settings/tests/behat/settings_navigation.feature +++ b/src/core/features/settings/tests/behat/settings_navigation.feature @@ -47,7 +47,7 @@ Feature: It navigates properly within settings. Scenario: Tablet navigation on settings Given I entered the app as "student1" - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app # Settings When I press "More" in the app diff --git a/src/tests/behat/navigation_splitview.feature b/src/tests/behat/navigation_splitview.feature index 74f331fbb..26b899ed0 100644 --- a/src/tests/behat/navigation_splitview.feature +++ b/src/tests/behat/navigation_splitview.feature @@ -76,7 +76,7 @@ Feature: It navigates properly in pages with a split-view component. # Open user menu Given I entered the app as "student1" - And I change viewport size to "1200x640" + And I change viewport size to "1200x640" in the app And I press the user menu button in the app # Open grades page @@ -85,6 +85,7 @@ Feature: It navigates properly in pages with a split-view component. And I should find "Course 1" in the app And I should find "Course 2" in the app And I should find "Grade category C1" in the app + And the UI should match the snapshot # Open C1 course grades When I press "Grade item C1" in the app diff --git a/src/tests/behat/snapshots/it-navigates-properly-in-pages-with-a-split-view-component-navigate-in-grades-tab-on-tablet_14.png b/src/tests/behat/snapshots/it-navigates-properly-in-pages-with-a-split-view-component-navigate-in-grades-tab-on-tablet_14.png new file mode 100644 index 000000000..f1033553a Binary files /dev/null and b/src/tests/behat/snapshots/it-navigates-properly-in-pages-with-a-split-view-component-navigate-in-grades-tab-on-tablet_14.png differ