Merge pull request #3683 from NoelDeMartin/MOBILE-4270
MOBILE-4270 behat: Fix viewport in tablet tests
This commit is contained in:
		
						commit
						b1f1691495
					
				| @ -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<width>\d+)x(?P<height>\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); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 34 KiB | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user