forked from EVOgeek/Vmeda.Online
		
	Merge pull request #4012 from NoelDeMartin/MOBILE-4470
MOBILE-4470: Behat and login fixes
This commit is contained in:
		
						commit
						6553d20c30
					
				| @ -599,7 +599,10 @@ class behat_app extends behat_app_helper { | ||||
|      */ | ||||
|     public function the_app_has_the_following_config(TableNode $data) { | ||||
|         foreach ($data->getRows() as $configrow) { | ||||
|             $this->appconfig[$configrow[0]] = json_decode($configrow[1]); | ||||
|             $name = $configrow[0]; | ||||
|             $value = $this->replace_wwwroot($configrow[1]); | ||||
| 
 | ||||
|             $this->appconfig[$name] = json_decode($value); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -242,7 +242,7 @@ class behat_app_helper extends behat_base { | ||||
|             // Assert initial page.
 | ||||
|             $this->spin(function($context) { | ||||
|                 $page = $context->getSession()->getPage(); | ||||
|                 $element = $page->find('xpath', '//page-core-login-site//input[@name="url"]'); | ||||
|                 $element = $page->find('xpath', '//page-core-login-site'); | ||||
| 
 | ||||
|                 if ($element) { | ||||
|                     // Login screen found.
 | ||||
|  | ||||
| @ -0,0 +1,70 @@ | ||||
| @core_courses @app @javascript @lms_upto4.2 | ||||
| Feature: Test basic usage of courses in app | ||||
|   In order to participate in the courses while using the mobile app | ||||
|   As a student | ||||
|   I need basic courses functionality to work | ||||
| 
 | ||||
|   Background: | ||||
|     Given the Moodle site is compatible with this feature | ||||
|     And the following "users" exist: | ||||
|       | username | firstname | lastname | email | | ||||
|       | teacher1 | Teacher | teacher | teacher1@example.com | | ||||
|       | student1 | Student | student | student1@example.com | | ||||
|     And the following "courses" exist: | ||||
|       | fullname | shortname | category | visible | | ||||
|       | Course 1 | C1 | 0 | 1 | | ||||
|       | Course 2 | C2 | 0 | 1 | | ||||
|       | Course 3 | C3 | 0 | 1 | | ||||
|       | Course 4 | C4 | 0 | 1 | | ||||
|       | Hidden course | CH | 0 | 0 | | ||||
|     And the following "course enrolments" exist: | ||||
|       | user | course | role | | ||||
|       | teacher1 | C1 | editingteacher | | ||||
|       | teacher1 | C2 | editingteacher | | ||||
|       | teacher1 | C3 | editingteacher | | ||||
|       | teacher1 | C4 | editingteacher | | ||||
|       | teacher1 | CH | editingteacher | | ||||
|       | student1 | C1 | student | | ||||
|       | student1 | C2 | student | | ||||
|       | student1 | C3 | student | | ||||
|       | student1 | CH | student | | ||||
|     And the following "activities" exist: | ||||
|       | activity | name            | intro                   | course | idnumber | option                       | | ||||
|       | choice   | Choice course 1 | Test choice description | C1     | choice1  | Option 1, Option 2, Option 3 | | ||||
|       | choice   | Choice course 2 | Test choice description | C2     | choice1  | Option 1, Option 2, Option 3 | | ||||
|       | 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 | duedate      | gradingduedate | | ||||
|       | assign   | C1     | assign1  | assignment          | Test assignment description | 1                                   | ##tomorrow## | ##tomorrow##   | | ||||
| 
 | ||||
|   @lms_from4.0 | ||||
|   Scenario: See my courses | ||||
|     Given I entered the app as "student1" | ||||
|     When the header should be "Acceptance test site" in the app | ||||
|     And I press "My courses" in the app | ||||
|     And I should find "Course 1" in the app | ||||
|     And I should find "Course 2" in the app | ||||
|     And I should find "Course 3" in the app | ||||
| 
 | ||||
|     When I press "Course 1" in the app | ||||
|     Then I should find "Choice course 1" in the app | ||||
|     And the header should be "Course 1" in the app | ||||
| 
 | ||||
|     When I press "Choice course 1" in the app | ||||
|     Then I should find "Test choice description" in the app | ||||
|     And the header should be "Choice course 1" in the app | ||||
| 
 | ||||
|     When I press the back button in the app | ||||
|     And I press the back button in the app | ||||
|     And I press "Course 2" in the app | ||||
|     Then I should find "Choice course 2" in the app | ||||
|     And the header should be "Course 2" in the app | ||||
| 
 | ||||
|     When I press the back button in the app | ||||
|     And I press "Course 3" in the app | ||||
|     Then I should find "Choice course 3" in the app | ||||
|     And the header should be "Course 3" in the app | ||||
|     And the following events should have been logged for "student1" in the app: | ||||
|       | name                         | | ||||
|       | \core\event\mycourses_viewed | | ||||
| @ -66,7 +66,7 @@ Feature: Test basic usage of courses in app | ||||
|     Then I should not find "Hidden course" in the app | ||||
|     And I should not find "Hidden from students" in the app | ||||
| 
 | ||||
|   @lms_from4.0 | ||||
|   @lms_from4.3 | ||||
|   Scenario: See my courses | ||||
|     Given I entered the app as "student1" | ||||
|     When the header should be "Acceptance test site" in the app | ||||
|  | ||||
| @ -120,7 +120,7 @@ | ||||
|     "supplyinfo": "More details", | ||||
|     "toggleremove": "Edit accounts list", | ||||
|     "unsupportedsite": "Site not accessible through the app", | ||||
|     "unsupportedsitemessage": "{{site}} can't be accessed through this app.\nYou can still access it using a web browser", | ||||
|     "unsupportedsitemessage": "{{site}} can't be accessed through this app.<br><br>You can still access it using a web browser.", | ||||
|     "username": "Username", | ||||
|     "usernamelowercase": "Only lowercase letters allowed", | ||||
|     "usernameoremail": "Enter either username or email address", | ||||
|  | ||||
| @ -120,7 +120,7 @@ | ||||
|         </ion-thumbnail> | ||||
|         <ion-label> | ||||
|             <p *ngIf="site.title" class="item-heading ion-text-wrap">{{site.title}}</p> | ||||
|             <p *ngIf="displaySiteUrl(site.siteUrl)">{{site.noProtocolUrl}}</p> | ||||
|             <p *ngIf="displaySiteUrl(site.url)">{{site.noProtocolUrl}}</p> | ||||
|             <p *ngIf="site.location">{{site.location}}</p> | ||||
|         </ion-label> | ||||
|     </ion-item> | ||||
|  | ||||
| @ -37,9 +37,8 @@ Feature: Test basic usage of login in app | ||||
|       | Username | student1 | | ||||
|       | Password | student1 | | ||||
|     And I press "Log in" near "Lost password?" in the app | ||||
|     Then I should find "Acceptance test site" in the app | ||||
|     Then the header should be "Acceptance test site" in the app | ||||
|     And the UI should match the snapshot | ||||
|     But I should not find "Log in" in the app | ||||
| 
 | ||||
|   Scenario: Add a non existing account | ||||
|     When I launch the app | ||||
| @ -160,3 +159,21 @@ Feature: Test basic usage of login in app | ||||
|     When I press "OK" in the app | ||||
|     And I press "Lost password?" in the app | ||||
|     Then I should find "Contact support" in the app | ||||
| 
 | ||||
|   Scenario: Shows sites list | ||||
|     Given the app has the following config: | ||||
|       | sites | [{"name":"Xavier's School for Gifted Youngsters","alias":"XSGY","imageurl":"https://x-school.campus.edu/logo.png","city":"North Salem","countrycode":"US","url":"https://x-school.campus.edu"},{"name":"Hogwarts", "url":"https://hogwarts.campus.edu"},{"name":"Acceptance test site","url":"$WWWROOT"}] | | ||||
|     When I launch the app | ||||
|     Then I should find "Xavier's School for Gifted Youngsters (XSGY)" in the app | ||||
| 
 | ||||
|     When I replace "/.*/" within "ion-list ion-item:last-of-type ion-label p:last-of-type" with "campus.example.edu" | ||||
|     Then the UI should match the snapshot | ||||
| 
 | ||||
|     When I press "Acceptance test site" in the app | ||||
|     Then I should find "Log in" in the app | ||||
| 
 | ||||
|     When I set the following fields to these values in the app: | ||||
|       | Username | student1 | | ||||
|       | Password | student1 | | ||||
|     And I press "Log in" near "Lost password?" in the app | ||||
|     Then the header should be "Acceptance test site" in the app | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 51 KiB | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user