Merge pull request #69 from dpalou/MOBILE-3833
MOBILE-3833 behat: Test custom URL that calls WS when logged out
This commit is contained in:
		
						commit
						c01a7b2727
					
				| @ -691,9 +691,27 @@ class behat_app extends behat_base { | ||||
|     public function i_open_a_custom_link(TableNode $data) { | ||||
|         global $DB, $CFG; | ||||
| 
 | ||||
|         $data = (object) $data->getColumnsHash()[0]; | ||||
|         $data = $data->getColumnsHash()[0]; | ||||
|         $title = array_keys($data)[0]; | ||||
|         $data = (object) $data; | ||||
| 
 | ||||
|         switch ($title) { | ||||
|             case 'discussion': | ||||
|                 $discussion = $DB->get_record('forum_discussions', ['name' => $data->discussion]); | ||||
|                 $pageurl = "{$CFG->behat_wwwroot}/mod/forum/discuss.php?d={$discussion->id}"; | ||||
| 
 | ||||
|                 break; | ||||
| 
 | ||||
|             case 'forum': | ||||
|                 $forumdata = $DB->get_record('forum', ['name' => $data->forum]); | ||||
|                 $cm = get_coursemodule_from_instance('forum', $forumdata->id); | ||||
|                 $pageurl = "{$CFG->behat_wwwroot}/mod/forum/view.php?id={$cm->id}"; | ||||
|                 break; | ||||
| 
 | ||||
|             default: | ||||
|                 throw new DriverException('Invalid custom link title - ' . $title); | ||||
|         } | ||||
| 
 | ||||
|         $url = "moodlemobile://link=" . urlencode($pageurl); | ||||
| 
 | ||||
|         $this->evaluate_script("return window.urlSchemes.handleCustomURL('$url')"); | ||||
|  | ||||
| @ -21,6 +21,7 @@ Feature: It navigates properly using deep links. | ||||
|       | Test forum | student1 | Forum topic | Forum message | | ||||
|     And the following config values are set as admin: | ||||
|       | forcelogout     | 1 | tool_mobile | | ||||
|       | defaulthomepage | 0 |             | | ||||
| 
 | ||||
|   Scenario: Receive a push notification | ||||
|     When I enter the app | ||||
| @ -64,3 +65,22 @@ Feature: It navigates properly using deep links. | ||||
|     Then I should find "Site home" in the app | ||||
|     But I should not find "Forum topic" in the app | ||||
|     And I should not find "Forum message" in the app | ||||
| 
 | ||||
|   Scenario: Open a link with a custom URL that calls WebServices for a logged out site | ||||
|     When I enter the app | ||||
|     And I log in as "student2" | ||||
|     And I press the user menu button in the app | ||||
|     And I press "Log out" in the app | ||||
|     And I wait the app to restart | ||||
|     And I open a custom link in the app for: | ||||
|       | forum      | | ||||
|       | Test forum | | ||||
|     Then I should find "Reconnect" in the app | ||||
| 
 | ||||
|     When I set the field "Password" to "student2" in the app | ||||
|     And I press "Log in" in the app | ||||
|     Then I should find "Test forum" in the app | ||||
| 
 | ||||
|     When I press the back button in the app | ||||
|     Then I should find "Site home" in the app | ||||
|     But I should not find "Test forum" in the app | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user