MOBILE-4061 behat: Generate custom URL to quickly bypass steps on app

main
Pau Ferrer Ocaña 2022-05-12 15:27:52 +02:00
parent 97862f40f5
commit a94da4d804
38 changed files with 356 additions and 323 deletions

View File

@ -125,6 +125,20 @@ class behat_app extends behat_base {
$this->enter_site();
}
/**
* Opens the Moodle app in the browser logged in as a user.
*
* @Given /^I enter(ed)? the app as "(.+)"$/
* @throws DriverException Issue with configuration or feature file
* @throws dml_exception Problem with Moodle setup
* @throws ExpectationException Problem with resizing window
*/
public function i_entered_the_app_as(bool $unused, string $username) {
$this->i_launch_the_app();
$this->open_moodleapp_custom_login_url($username);
}
/**
* Opens the Moodle app in the browser.
*
@ -587,33 +601,27 @@ class behat_app extends behat_base {
/**
* User enters a course in the app.
*
* @Given /^I enter the course "(.+?)"(?: as "(.+)")? in the app$/
* @Given /^I enter(ed)? the course "(.+?)"(?: as "(.+)")? in the app$/
* @param string $coursename Course name
* @throws DriverException If the button push doesn't work
*/
public function i_enter_the_course_in_the_app(string $coursename, ?string $username = null) {
if (!is_null($username)) {
$this->i_enter_the_app();
$this->login($username);
public function i_enter_the_course_in_the_app(bool $unused, string $coursename, ?string $username = null) {
global $DB;
$courseid = $DB->get_field('course', 'id', [ 'fullname' => $coursename]);
if (!$courseid) {
throw new DriverException("Course '$coursename' not found");
}
$mycoursesfound = $this->evaluate_script("return window.behat.find({ text: 'My courses', selector: 'ion-tab-button'});");
if ($username) {
$this->i_launch_the_app();
if ($mycoursesfound !== 'OK') {
// My courses not present enter from Dashboard.
$this->i_press_in_the_app('"Home" "ion-tab-button"');
$this->i_press_in_the_app('"Dashboard"');
$this->i_press_in_the_app('"'.$coursename.'" near "Course overview"');
$this->wait_for_pending_js();
return;
$this->open_moodleapp_custom_login_url($username, "/course/view.php?id=$courseid", '//page-core-course-index');
} else {
$this->open_moodleapp_custom_url("/course/view.php?id=$courseid", '//page-core-course-index');
}
$this->i_press_in_the_app('"My courses" "ion-tab-button"');
$this->i_press_in_the_app('"'.$coursename.'"');
$this->wait_for_pending_js();
}
/**
@ -701,25 +709,21 @@ class behat_app extends behat_base {
switch ($title) {
case 'discussion':
$discussion = $DB->get_record('forum_discussions', ['name' => $data->discussion]);
$pageurl = "{$CFG->behat_wwwroot}/mod/forum/discuss.php?d={$discussion->id}";
$pageurl = "/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}";
$pageurl = "/mod/forum/view.php?id={$cm->id}";
break;
default:
throw new DriverException('Invalid custom link title - ' . $title);
}
$urlscheme = $this->get_mobile_url_scheme();
$url = "$urlscheme://link=" . urlencode($pageurl);
$this->evaluate_async_script("return window.behat.handleCustomURL('$url')");
$this->wait_for_pending_js();
$this->open_moodleapp_custom_url($pageurl);
}
/**
@ -1165,6 +1169,98 @@ class behat_app extends behat_base {
return $result;
}
/**
* Opens a custom URL for automatic login and redirect from the mobile app (and waits to finish.)
*
* @param string $username Of the user that needs to be logged in.
* @param string $path To redirect the user.
* @param string $successXPath If a path is declared, the XPath of the element to lookat after redirect.
*/
private function open_moodleapp_custom_login_url($username, $path = '', string $successXPath = '') {
global $CFG, $DB;
require_once($CFG->libdir.'/externallib.php');
require_once($CFG->libdir.'/moodlelib.php');
// Ensure the user exists.
$userid = $DB->get_field('user', 'id', [ 'username' => $username ]);
if (!$userid) {
throw new DriverException("User '$username' not found");
}
// Get or create the user token.
$service = $DB->get_record('external_services', ['shortname' => 'moodle_mobile_app']);
$token_params = [
'userid' => $userid,
'externalserviceid' => $service->id,
];
$usertoken = $DB->get_record('external_tokens', $token_params);
if (!$usertoken) {
$context = context_system::instance();
$token = external_generate_token(EXTERNAL_TOKEN_PERMANENT, $service, $userid, $context);
$token_params['token'] = $token;
$privatetoken = $DB->get_field('external_tokens', 'privatetoken', $token_params);
} else {
$token = $usertoken->token;
$privatetoken = $usertoken->privatetoken;
}
// Generate custom URL.
$parsed_url = parse_url($CFG->behat_wwwroot);
$domain = $parsed_url['host'];
$url = $this->get_mobile_url_scheme() . "://$username@$domain?token=$token&privatetoken=$privatetoken";
if (!empty($path)) {
$url .= '&redirect='.urlencode($CFG->behat_wwwroot.$path);
} else {
$successXPath = '//page-core-mainmenu';
}
$this->handle_url_and_wait_page_to_load($url, $successXPath);
}
/**
* Opens a custom URL on the mobile app (and waits to finish.)
*
* @param string $path To navigate.
* @param string $successXPath The XPath of the element to lookat after navigation.
*/
private function open_moodleapp_custom_url(string $path, string $successXPath = '') {
global $CFG;
$urlscheme = $this->get_mobile_url_scheme();
$url = "$urlscheme://link=" . urlencode($CFG->behat_wwwroot.$path);
$this->handle_url_and_wait_page_to_load($url);
}
/**
* Handles the custom URL on the mobile app (and waits to finish.)
*
* @param string $customurl To navigate.
* @param string $successXPath The XPath of the element to lookat after navigation.
*/
private function handle_url_and_wait_page_to_load(string $customurl, string $successXPath = '') {
// Instead of using evaluate_async_script, we wait for the path to load.
$this->evaluate_script("return window.behat.handleCustomURL('$customurl')");
if (!empty($successXPath)) {
// Wait until the page appears.
$this->spin(
function($context, $args) use ($successXPath) {
$found = $context->getSession()->getPage()->find('xpath', $successXPath);
if ($found) {
return true;
}
throw new DriverException('Moodle App custom URL page not loaded');
}, false, 30);
}
// Wait for JS to finish as well.
$this->wait_for_pending_js();
}
/**
* Returns the current mobile url scheme of the site.
*/

View File

@ -20,9 +20,8 @@ Feature: Test basic usage of messages in app
| student2 | C1 | student |
Scenario: View recent conversations and contacts
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Contacts" in the app
Then I should find "No contacts" in the app
@ -37,9 +36,8 @@ Feature: Test basic usage of messages in app
And I press "Add" near "Are you sure you want to add Student1 student1 to your contacts?" in the app
Then I should find "Contact request sent" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Requests" in the app
And I press "Teacher teacher" in the app
@ -57,9 +55,8 @@ Feature: Test basic usage of messages in app
And I should find "heeey student" in the app
Scenario: Search users
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student2" in the app
And I press "Search" "button" in the app
@ -70,9 +67,8 @@ Feature: Test basic usage of messages in app
Then I should find "Teacher teacher" in the app
Scenario: Send/receive messages in existing conversations
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
@ -82,9 +78,8 @@ Feature: Test basic usage of messages in app
And I press "Send" in the app
Then I should find "heeey student" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "teacher" in the app
@ -96,9 +91,8 @@ Feature: Test basic usage of messages in app
And I press "Send" in the app
Then I should find "hi" in the app
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
And I press "Search" "button" in the app
@ -114,9 +108,8 @@ Feature: Test basic usage of messages in app
# TODO Fix this test in all Moodle versions
Scenario: User profile: send message, add/remove contact
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student" in the app
@ -131,9 +124,8 @@ Feature: Test basic usage of messages in app
And I press "Add" in the app
Then I should find "Contact request sent" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Requests" in the app
And I press "Teacher teacher" in the app
@ -165,9 +157,8 @@ Feature: Test basic usage of messages in app
And I should not find "hi" in the app
Scenario: Send message offline
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
@ -188,17 +179,15 @@ Feature: Test basic usage of messages in app
Then I should find "heeey student" in the app
And I should find "byee" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Teacher teacher" in the app
Then I should find "heeey student" in the app
And I should find "byee" in the app
Scenario: Auto-sync messages
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
@ -213,17 +202,15 @@ Feature: Test basic usage of messages in app
When I switch offline mode to "false"
And I run cron tasks in the app
And I enter the app
And I log in as "student1"
And I enter the app as "student1"
And I press "Messages" in the app
And I press "Teacher teacher" in the app
Then I should find "heeey student" in the app
And I should find "byee" in the app
Scenario: Search for messages
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
And I press "Search" "button" in the app
@ -236,9 +223,8 @@ Feature: Test basic usage of messages in app
And I press "Send" in the app
Then I should find "search this message" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "search this message" in the app
And I press "Search" "button" in the app
@ -250,9 +236,8 @@ Feature: Test basic usage of messages in app
And I should find "search this message" in the app
Scenario: Star/Unstar
When I enter the app
And I log in as "teacher1"
And I press "Messages" in the app
Given I entered the app as "teacher1"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
And I press "Search" "button" in the app
@ -261,9 +246,8 @@ Feature: Test basic usage of messages in app
And I press "Send" in the app
Then I should find "star message" in the app
When I enter the app
And I log in as "student2"
And I press "Messages" in the app
Given I entered the app as "student2"
When I press "Messages" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student1" in the app
And I press "Search" "button" in the app
@ -272,9 +256,8 @@ Feature: Test basic usage of messages in app
And I press "Send" in the app
Then I should find "test message student2" in the app
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
Then I should find "Private (2)" in the app
And I should find "Starred (1)" in the app
@ -290,8 +273,8 @@ Feature: Test basic usage of messages in app
And I should find "Student1 student1" in the app
Scenario: User blocking feature
When I enter the course "Course 1" as "student2" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student2" in the app
When I press "Participants" in the app
And I press "Student1 student1" in the app
And I press "Message" in the app
And I press "Display options" in the app
@ -299,14 +282,14 @@ Feature: Test basic usage of messages in app
And I press "Block user" near "Are you sure you want to block Student1 student1?" in the app
Then I should find "You have blocked this user" in the app
When I enter the course "Course 1" as "student1" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app
And I press "Student2 student2" in the app
And I press "Message" in the app
Then I should find "You are unable to message this user" in the app
When I enter the course "Course 1" as "student2" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student2" in the app
When I press "Participants" in the app
And I press "Student1 student1" in the app
And I press "Message" in the app
And I press "Display options" in the app
@ -317,8 +300,8 @@ Feature: Test basic usage of messages in app
And I press "Unblock user" near "Are you sure you want to unblock Student1 student1?" in the app
Then I should not find "You have blocked this user" in the app
When I enter the course "Course 1" as "student1" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app
And I press "Student2 student2" in the app
And I press "Message" in the app
And I set the field "New message" to "test message" in the app
@ -327,8 +310,8 @@ Feature: Test basic usage of messages in app
But I should not find "You are unable to message this user" in the app
Scenario: Mute Unmute conversations
When I enter the course "Course 1" as "student1" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app
And I press "Student2 student2" in the app
And I press "Message" in the app
And I set the field "New message" to "test message" in the app
@ -354,9 +337,8 @@ Feature: Test basic usage of messages in app
And I should find "Muted conversation" in the app
Scenario: Self conversations
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
Then I should find "Starred (1)" in the app
When I press "Student1 student1" in the app

View File

@ -15,9 +15,8 @@ Feature: Test messages navigation in the app
| student | C1 | student |
Scenario: Avoid recursive links to profile
When I enter the app
And I log in as "teacher"
And I press "Messages" in the app
Given I entered the app as "teacher"
When I press "Messages" in the app
And I press "Contacts" in the app
And I press "Search people and messages" in the app
And I set the field "Search" to "student" in the app

View File

@ -7,9 +7,8 @@ Feature: Test messages settings
| student1 |
Scenario: Modify settings
When I enter the app
And I log in as "student1"
And I press "Messages" in the app
Given I entered the app as "student1"
When I press "Messages" in the app
And I press "Message preferences" in the app
And I select "My contacts only" in the app
Then "My contacts only" should be selected in the app

View File

@ -21,8 +21,8 @@ Feature: Test basic usage of assignment activity in app
Scenario: View assign description, due date & View list of student submissions (as teacher) & View own submission or student submission
# Create, edit and submit as a student
When I enter the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "assignment1" in the app
Then the header should be "assignment1" in the app
And I should find "Test assignment description1" in the app
And I should find "Due date" in the app
@ -47,8 +47,8 @@ Feature: Test basic usage of assignment activity in app
And I should find "Submission test edited" in the app
# View as a teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "assignment1" in the app
Then the header should be "assignment1" in the app
When I press "Submitted" in the app

View File

@ -22,8 +22,8 @@ Feature: Test basic usage of assignment activity in app
@lms_from3.11
Scenario: View assign description, due date & View list of student submissions (as teacher) & View own submission or student submission
# Create, edit and submit as a student
When I enter the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "assignment1" in the app
Then the header should be "assignment1" in the app
And I should find "Test assignment description1" in the app
And I should find "Due:" in the app
@ -48,8 +48,8 @@ Feature: Test basic usage of assignment activity in app
And I should find "Submission test edited" in the app
# View as a teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "assignment1" in the app
Then the header should be "assignment1" in the app
When I press "Submitted" in the app
@ -62,7 +62,7 @@ Feature: Test basic usage of assignment activity in app
Scenario: Edit/Add submission (online text) & Add new attempt from previous submission & Submit for grading
# Submit first attempt as a student
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
And I press "Add submission" in the app
And I set the field "Online text submissions" to "Submission test 1st attempt" in the app
@ -71,8 +71,8 @@ Feature: Test basic usage of assignment activity in app
And I press "OK" in the app
# Allow more attempts as a teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "assignment1" in the app
And I press "Participants" in the app
And I press "Student student" near "assignment1" in the app
And I press "Grade" in the app
@ -82,8 +82,8 @@ Feature: Test basic usage of assignment activity in app
And I should find "Not graded" in the app
# Submit second attempt as a student
When I enter the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "assignment1" in the app
Then I should find "Reopened" in the app
And I should find "2 out of Unlimited" in the app
And I should find "Add a new attempt based on previous submission" in the app
@ -100,16 +100,16 @@ Feature: Test basic usage of assignment activity in app
And I press "OK" in the app
# View second attempt as a teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "assignment1" in the app
And I press "Participants" in the app
And I press "Student student" near "assignment1" in the app
Then I should find "Online text submissions" in the app
And I should find "Submission test 2nd attempt" in the app
Scenario: Add submission offline (online text) & Submit for grading offline & Sync submissions
When I enter the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "assignment1" in the app
And I press "Add submission" in the app
And I switch offline mode to "true"
And I set the field "Online text submissions" to "Submission test" in the app
@ -127,8 +127,8 @@ Feature: Test basic usage of assignment activity in app
But I should not find "This Assignment has offline data to be synchronised." in the app
Scenario: Edit an offline submission before synchronising it
When I enter the course "Course 1" as "student1" in the app
And I press "assignment1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "assignment1" in the app
And I press "Add submission" in the app
And I switch offline mode to "true"
And I set the field "Online text submissions" to "Submission test original offline" in the app

View File

@ -36,7 +36,7 @@ Feature: Test assignments navigation
| assignment | student3 | Ipsum |
Scenario: Mobile navigation
Given I enter the course "Course 1" as "teacher1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
# Initial status
When I press "Assignment" in the app
@ -150,7 +150,7 @@ Feature: Test assignments navigation
And I should not find "Second Student" in the app
Scenario: Tablet navigation
Given I enter the course "Course 1" as "teacher1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
And I change viewport size to "1200x640"
# Initial status

View File

@ -21,8 +21,8 @@ Feature: Test basic usage of chat in app
Scenario: Receive and send messages & See connected users, beep and talk to
# Send messages as student1
When I enter the course "Course 1" as "student1" in the app
And I press "Test chat name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test chat name" in the app
Then I should find "Enter the chat" in the app
And I should find "Past sessions" in the app
@ -37,8 +37,8 @@ Feature: Test basic usage of chat in app
And I should find "I am David" in the app
# Read messages, view connected users, send beep and reply as student2
When I enter the course "Course 1" as "student2" in the app
And I press "Test chat name" in the app
Given I entered the course "Course 1" as "student2" in the app
When I press "Test chat name" in the app
And I press "Enter the chat" in the app
Then I should find "Hi!" in the app
And I should find "I am David" in the app
@ -55,7 +55,7 @@ Feature: Test basic usage of chat in app
Scenario: Past sessions shown
# Send messages as student1
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
And I press "Test chat name" in the app
And I press "Enter the chat" in the app
And I set the field "New message" to "Hi!" in the app
@ -67,8 +67,8 @@ Feature: Test basic usage of chat in app
Then I should find "I am David" in the app
# Read messages from past sessions as student2
When I enter the course "Course 1" as "student2" in the app
And I press "Test chat name" in the app
Given I entered the course "Course 1" as "student2" in the app
When I press "Test chat name" in the app
And I press "Past sessions" in the app
And I press "Show incomplete sessions" in the app
And I press "david student" near "(2)" in the app

View File

@ -18,7 +18,7 @@ Feature: Test chat navigation
| chat | Test chat name | Test chat | C1 | chat | 0 |
# Create sessions
# TODO use generator instead
And I enter the course "Course 1" as "student1" in the app
And I entered the course "Course 1" as "student1" in the app
And I press "Test chat name" in the app
And I press "Enter the chat" in the app
And I set the field "New message" to "Test message" in the app
@ -26,7 +26,7 @@ Feature: Test chat navigation
Then I should find "Test message" in the app
Scenario: Tablet navigation
Given I enter the course "Course 1" as "student2" in the app
Given I entered the course "Course 1" as "student2" in the app
And I change viewport size to "1200x640"
# Sessions

View File

@ -22,15 +22,15 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice name | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 |
And I enter the course "Course 1" as "student1" in the app
And I press "Choice name" in the app
And I entered the course "Course 1" as "student1" in the app
Then I press "Choice name" in the app
And I select "Option 2" in the app
And I press "Save my choice" in the app
And I press "OK" in the app
# Download answers as teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "Choice name" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "Choice name" in the app
Then I should find "Test choice description" in the app
When I press "Information" in the app

View File

@ -21,8 +21,8 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | allowmultiple | allowupdate | showresults |
| choice | Test single choice name | Test single choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 0 | 0 | 1 |
When I enter the course "Course 1" as "student1" in the app
And I press "Test single choice name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test single choice name" in the app
And I select "Option 1" in the app
And I select "Option 2" in the app
And I press "Save my choice" in the app
@ -44,8 +44,8 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | allowmultiple | allowupdate | showresults |
| choice | Test multi choice name | Test multi choice description | C1 | choice2 | Option 1, Option 2, Option 3 | 1 | 1 | 1 |
When I enter the course "Course 1" as "student1" in the app
And I press "Test multi choice name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test multi choice name" in the app
And I select "Option 1" in the app
And I select "Option 2" in the app
And I press "Save my choice" in the app
@ -72,8 +72,8 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | allowmultiple | allowupdate | showresults |
| choice | Test single choice name | Test single choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 0 | 0 | 1 |
When I enter the course "Course 1" as "student1" in the app
And I press "Test single choice name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test single choice name" in the app
And I select "Option 1" in the app
And I switch offline mode to "true"
And I select "Option 2" in the app
@ -104,8 +104,8 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | allowmultiple | allowupdate | showresults |
| choice | Test single choice name | Test single choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 0 | 0 | 1 |
When I enter the course "Course 1" as "student1" in the app
And I press "Test single choice name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test single choice name" in the app
And I select "Option 1" in the app
And I switch offline mode to "true"
And I select "Option 2" in the app
@ -131,8 +131,8 @@ Feature: Test basic usage of choice activity in app
| activity | name | intro | course | idnumber | option | allowmultiple | allowupdate | showresults |
| choice | Test multi choice name | Test multi choice description | C1 | choice2 | Option 1, Option 2, Option 3 | 1 | 1 | 1 |
| choice | Test single choice name | Test single choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 0 | 0 | 1 |
When I enter the course "Course 1" as "student1" in the app
And I press "Course downloads" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Course downloads" in the app
And I press "Download" within "Test single choice name" "ion-item" in the app
Then I should find "Downloaded" within "Test single choice name" "ion-item" in the app
And I press the back button in the app
@ -171,15 +171,15 @@ Feature: Test basic usage of choice activity in app
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option |
| choice | Choice name | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 |
And I enter the course "Course 1" as "student1" in the app
And I press "Choice name" in the app
And I entered the course "Course 1" as "student1" in the app
Then I press "Choice name" in the app
And I select "Option 2" in the app
And I press "Save my choice" in the app
And I press "OK" in the app
# Download answers as teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "Choice name" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "Choice name" in the app
Then I should find "Test choice description" in the app
When I press "Information" in the app

View File

@ -25,8 +25,8 @@ Feature: Test basic usage of forum activity in app
| forum | Test forum name | Test forum | C1 | forum | 0 | 1 | 1 |
Scenario: Create new discussion
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "My happy subject" in the app
And I set the field "Message" to "An awesome message" in the app
@ -37,8 +37,8 @@ Feature: Test basic usage of forum activity in app
Then I should find "An awesome message" in the app
Scenario: Reply a post
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject" in the app
And I set the field "Message" to "DiscussionMessage" in the app
@ -53,8 +53,8 @@ Feature: Test basic usage of forum activity in app
And I should find "ReplyMessage" in the app
Scenario: Star and pin discussions (student)
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "starred subject" in the app
And I set the field "Message" to "starred message" in the app
@ -87,8 +87,8 @@ Feature: Test basic usage of forum activity in app
Then I should find "normal message" in the app
Scenario: Star and pin discussions (teacher)
When I enter the course "Course 1" as "teacher1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test star" in the app
And I set the field "Message" to "Auto-test star message" in the app
@ -117,8 +117,8 @@ Feature: Test basic usage of forum activity in app
And I should find "Auto-test pin" in the app
Scenario: Edit a not sent reply offline
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app
@ -150,8 +150,8 @@ Feature: Test basic usage of forum activity in app
And I should not find "This Discussion has offline data to be synchronised" in the app
Scenario: Edit a not sent new discussion offline
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I switch offline mode to "true"
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test" in the app
@ -173,8 +173,8 @@ Feature: Test basic usage of forum activity in app
And I should find "Auto-test message edited" in the app
Scenario: Edit a forum post (only online)
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app
@ -200,8 +200,8 @@ Feature: Test basic usage of forum activity in app
# TODO Fix this test in all Moodle versions
Scenario: Delete a forum post (only online)
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app
@ -233,7 +233,7 @@ Feature: Test basic usage of forum activity in app
Then I should not find "Auto-test" in the app
Scenario: Add/view ratings
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "Auto-test" in the app
@ -247,8 +247,8 @@ Feature: Test basic usage of forum activity in app
And I press "Post to forum" in the app
Then I should find "test2" "ion-card" in the app
When I enter the course "Course 1" as "teacher1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "Test forum name" in the app
And I press "Auto-test" in the app
Then I should find "Reply" in the app
@ -274,16 +274,16 @@ Feature: Test basic usage of forum activity in app
And I should find "Average of ratings: 0" in the app
But I should not find "Average of ratings: -" in the app
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Auto-test" in the app
Then I should find "Average of ratings: 1" in the app
And I should find "Average of ratings: 0" in the app
But I should not find "Average of ratings: -" in the app
Scenario: Reply a post offline
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject" in the app
And I set the field "Message" to "DiscussionMessage" in the app
@ -312,8 +312,8 @@ Feature: Test basic usage of forum activity in app
But I should not find "Not sent" in the app
Scenario: New discussion offline & Sync Forum
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I switch offline mode to "true"
And I press "Add discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject" in the app
@ -335,8 +335,8 @@ Feature: Test basic usage of forum activity in app
And I should not find "This Forum has offline data to be synchronised." in the app
Scenario: New discussion offline & Auto-sync forum
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I switch offline mode to "true"
And I press "Add discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject" in the app
@ -358,8 +358,8 @@ Feature: Test basic usage of forum activity in app
And I should not find "This Forum has offline data to be synchronised." in the app
Scenario: Prefetch
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum name" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum name" in the app
And I press "Add discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject 1" in the app
And I set the field "Message" to "DiscussionMessage 1" in the app

View File

@ -42,7 +42,7 @@ Feature: Test forum navigation
| Discussion 05 | Discussion 05 | Discussion 05 first reply |
Scenario: Mobile navigation
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
# By last reply
When I press "Forum" in the app
@ -139,7 +139,7 @@ Feature: Test forum navigation
# Then I should find "Discussion 20 message" in the app
Scenario: Tablet navigation
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
And I change viewport size to "1200x640"
# By last reply

View File

@ -88,7 +88,7 @@ Feature: Test glossary navigation
| glossary | Watermelon | Watermelon is a fruit | student2 |
Scenario: Mobile navigation
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
# Alphabetically
When I press "Fruits glossary" in the app
@ -195,7 +195,7 @@ Feature: Test glossary navigation
Then I should find "Acerola is a fruit" in the app
Scenario: Tablet navigation
Given I enter the course "Course 1" as "student1" in the app
Given I entered the course "Course 1" as "student1" in the app
And I change viewport size to "1200x640"
# Alphabetically

View File

@ -56,8 +56,8 @@ Feature: Attempt a quiz in app
| TF9 | 7 |
Scenario: View a quiz entry page (attempts, status, etc.)
When I enter the course "Course 1" as "student1" in the app
And I press "Quiz 1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Quiz 1" in the app
And I press "Attempt quiz now" in the app
Then I should find "Text of the first question" in the app
But I should not find "Text of the second question" in the app
@ -106,8 +106,8 @@ Feature: Attempt a quiz in app
And I should find "Question 2" in the app
Scenario: Attempt a quiz (all question types)
When I enter the course "Course 1" as "student1" in the app
And I press "Quiz 2" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Quiz 2" in the app
And I press "Attempt quiz now" in the app
And I press "Four" in the app
And I press "Three" in the app
@ -143,8 +143,8 @@ Feature: Attempt a quiz in app
And I should find "Not yet graded" in the app
Scenario: Submit a quiz & Review a quiz attempt
When I enter the course "Course 1" as "student1" in the app
And I press "Quiz 1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Quiz 1" in the app
And I press "Attempt quiz now" in the app
And I press "True" in the app
And I press "Next" near "Question 1" in the app
@ -154,8 +154,8 @@ Feature: Attempt a quiz in app
And I press "OK" in the app
Then I should find "Review" in the app
When I enter the course "Course 1" as "teacher1" in the app
And I press "Quiz 1" in the app
Given I entered the course "Course 1" as "teacher1" in the app
When I press "Quiz 1" 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

View File

@ -30,10 +30,8 @@ Feature: Attempt a quiz in app
| TF2 | 2 |
Scenario: Next and previous navigation
Given I enter the app
And I log in as "student1"
When I enter the course "Course 1" in the app
And I press "Quiz 1" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Quiz 1" in the app
And I press "Attempt quiz now" in the app
Then I should find "Text of the first question" in the app
But I should not find "Text of the second question" in the app

View File

@ -72,7 +72,7 @@ Feature: Test basic usage of one course in app
| workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 |
Scenario: Self enrol
Given I enter the course "Course 1" as "teacher1" in the app
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
@ -83,9 +83,8 @@ Feature: Test basic usage of one course in app
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
When I enter the app
And I log in as "student2"
And I press "Site home" in the app
Given 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
And I press "Enrol me" in the app
@ -108,7 +107,7 @@ Feature: Test basic usage of one course in app
And I should find "Test workshop name" in the app
Scenario: Guest access
Given I enter the course "Course 1" as "teacher1" in the app
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
@ -119,9 +118,8 @@ Feature: Test basic usage of one course in app
And I follow "Enrolment methods"
And I click on "Enable" "icon" in the "Guest access" "table_row"
And I close the browser tab opened by the app
When I enter the app
And I log in as "student2"
And I press "Site home" in the app
Given 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

View File

@ -72,7 +72,7 @@ Feature: Test basic usage of one course in app
| workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 |
Scenario: View course contents
When I enter the course "Course 1" as "student1" in the app
When I entered the course "Course 1" as "student1" in the app
Then the header should be "Course 1" in the app
And I should find "Choice course 1" in the app
And I should find "assignment" in the app
@ -147,7 +147,7 @@ Feature: Test basic usage of one course in app
Then the header should be "Test workshop name" in the app
Scenario: View section contents
When I enter the course "Course 1" as "student1" in the app
When I entered the course "Course 1" as "student1" in the app
Then the header should be "Course 1" in the app
And I should find "Choice course 1" in the app
And I should find "assignment" in the app
@ -324,7 +324,7 @@ Feature: Test basic usage of one course in app
Then the header should be "Test glossary" in the app
Scenario: Navigation between sections using the bottom arrows
When I enter the course "Course 1" as "student1" in the app
When I entered the course "Course 1" as "student1" in the app
Then the header should be "Course 1" in the app
And I should find "Choice course 1" in the app
And I should find "assignment" in the app
@ -402,7 +402,7 @@ Feature: Test basic usage of one course in app
@lms_from4.0
Scenario: Self enrol
Given I enter the course "Course 1" as "teacher1" in the app
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
@ -411,9 +411,8 @@ Feature: Test basic usage of one course in app
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
When I enter the app
And I log in as "student2"
And I press "Site home" in the app
Given 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
And I press "Enrol me" in the app
@ -437,7 +436,7 @@ Feature: Test basic usage of one course in app
@lms_from4.0
Scenario: Guest access
Given I enter the course "Course 1" as "teacher1" in the app
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
@ -446,9 +445,8 @@ Feature: Test basic usage of one course in app
And I select "Enrolment methods" from the "jump" singleselect
And I click on "Enable" "icon" in the "Guest access" "table_row"
And I close the browser tab opened by the app
When I enter the app
And I log in as "student2"
And I press "Site home" in the app
Given 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
@ -476,7 +474,7 @@ Feature: Test basic usage of one course in app
| blockname | contextlevel | reference | pagetypepattern | defaultregion | configdata |
| html | Course | C1 | course-view-* | site-pre | Tzo4OiJzdGRDbGFzcyI6Mjp7czo1OiJ0aXRsZSI7czoxNToiSFRNTCB0aXRsZSB0ZXN0IjtzOjQ6InRleHQiO3M6OToiYm9keSB0ZXN0Ijt9 |
| activity_modules | Course | C1 | course-view-* | site-pre | |
When I enter the course "Course 1" as "student1" in the app
And I entered the course "Course 1" as "student1" in the app
Then the header should be "Course 1" in the app
And I should find "Choice course 1" in the app
And I should find "assignment" in the app

View File

@ -20,9 +20,9 @@ Feature: Check course completion feature.
| activity | name | course | idnumber | completion | completionview |
| forum | First forum | C1 | forum1 | 1 | 0 |
| forum | Second forum | C1 | forum2 | 1 | 0 |
When I enter the course "Course 1" as "student1" in the app
And I entered the course "Course 1" as "student1" in the app
# Set activities as completed.
And I should find "0%" in the app
Then I should find "0%" in the app
And I click on "ion-button[title=\"Not completed: First forum. Select to mark as complete.\"]" "css"
And I should find "50%" in the app
And I click on "ion-button[title=\"Not completed: Second forum. Select to mark as complete.\"]" "css"

View File

@ -21,9 +21,9 @@ Feature: Check course completion feature.
| activity | name | course | idnumber | completion | completionview |
| forum | First forum | C1 | forum1 | 1 | 0 |
| forum | Second forum | C1 | forum2 | 1 | 0 |
When I enter the course "Course 1" as "student1" in the app
And I entered the course "Course 1" as "student1" in the app
# Set activities as completed.
And I should find "0%" in the app
Then I should find "0%" in the app
And I press "Mark First forum as done" in the app
And I should find "50%" in the app
And I press "Mark Second forum as done" in the app

View File

@ -20,16 +20,14 @@ Feature: Test course list shown on app start tab
| student2 | C2 | student |
Scenario: View courses (shortnames not displayed)
When I enter the app
And I log in as "student1"
Then I should find "Course 1" in the app
Given I entered the app as "student1"
When I should find "Course 1" in the app
But I should not find "Course 2" in the app
But I should not find "C1" in the app
But I should not find "C2" in the app
When I enter the app
And I log in as "student2"
Then I should find "Course 1" in the app
Given I entered the app as "student2"
When I should find "Course 1" in the app
And I should find "Course 2" in the app
But I should not find "C1" in the app
But I should not find "C2" in the app
@ -76,9 +74,8 @@ Feature: Test course list shown on app start tab
| student2 | Z8 | student |
| student2 | Z9 | student |
| student2 | Z10 | student |
When I enter the app
And I log in as "student2"
Then I should find "C1" in the app
Given I entered the app as "student2"
When I should find "C1" in the app
And I should find "C2" in the app
And I should find "C3" in the app
And I should find "C4" in the app

View File

@ -21,17 +21,15 @@ Feature: Test course list shown on app start tab
@lms_from4.0
Scenario: View courses (shortnames not displayed)
When I enter the app
And I log in as "student1"
And I press "My courses" in the app
Given I entered the app as "student1"
When I press "My courses" in the app
Then I should find "Course 1" in the app
But I should not find "Course 2" in the app
But I should not find "C1" in the app
But I should not find "C2" in the app
When I enter the app
And I log in as "student2"
And I press "My courses" in the app
Given I entered the app as "student2"
When I press "My courses" in the app
Then I should find "Course 1" in the app
And I should find "Course 2" in the app
But I should not find "C1" in the app
@ -80,9 +78,8 @@ Feature: Test course list shown on app start tab
| student2 | Z8 | student |
| student2 | Z9 | student |
| student2 | Z10 | student |
When I enter the app
And I log in as "student2"
And I press "My courses" in the app
Given I entered the app as "student2"
When I press "My courses" in the app
Then I should find "C1" in the app
And I should find "C2" in the app
And I should find "C3" in the app

View File

@ -36,8 +36,8 @@ Feature: Test basic usage of courses in app
Scenario: Links to actions in Timeline work for teachers/students
# Configure assignment as teacher
Given I enter the course "Course 1" as "teacher1" in the app
And I press "assignment" in the app
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
@ -51,9 +51,8 @@ Feature: Test basic usage of courses in app
And I close the browser tab opened by the app
# Submit assignment as student
When I enter the app
And I log in as "student1"
Then I press "Open block drawer" in the app
Given I entered the app as "student1"
When I press "Open block drawer" in the app
And I press "Add submission" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app
@ -71,9 +70,8 @@ Feature: Test basic usage of courses in app
And I should find "Due date" in the app
# Grade assignment as teacher
When I enter the app
And I log in as "teacher1"
Then I press "Open block drawer" in the app
Given I entered the app as "teacher1"
When I press "Open block drawer" in the app
And I press "Grade" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app

View File

@ -35,9 +35,8 @@ Feature: Test basic usage of courses in app
| assign | C1 | assign1 | assignment | Test assignment description | 1 |
Scenario: "Dashboard" tab displayed in >= 3.3 sites
When I enter the app
And I log in as "student1"
Then I should see "Dashboard"
Given I entered the app as "student1"
When I should see "Dashboard"
And the header should be "Acceptance test site" in the app
And I should find "Course 1" in the app
And I should find "Course 2" in the app
@ -53,9 +52,8 @@ Feature: Test basic usage of courses in app
And I should find "Course 3" in the app
Scenario: See my courses
When I enter the app
And I log in as "student1"
Then the header should be "Acceptance test site" in the app
Given I entered the app as "student1"
When the header should be "Acceptance test site" 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
@ -82,8 +80,8 @@ 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 enter the course "Course 1" as "teacher1" in the app
And I press "assignment" in the app
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
@ -97,9 +95,8 @@ Feature: Test basic usage of courses in app
And I close the browser tab opened by the app
# Submit assignment as student
When I enter the app
And I log in as "student1"
Then I press "Open block drawer" in the app
Given I entered the app as "student1"
When I press "Open block drawer" in the app
And I press "Add submission" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app
@ -117,9 +114,8 @@ Feature: Test basic usage of courses in app
And I should find "Due:" in the app
# Grade assignment as teacher
When I enter the app
And I log in as "teacher1"
Then I press "Open block drawer" in the app
Given I entered the app as "teacher1"
When I press "Open block drawer" in the app
And I press "Grade" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app

View File

@ -35,9 +35,8 @@ Feature: Test basic usage of courses in app
| assign | C1 | assign1 | assignment | Test assignment description | 1 |
Scenario: "Dashboard" tab displayed
When I enter the app
And I log in as "student1"
Then I should see "Dashboard"
Given I entered the app as "student1"
When I should see "Dashboard"
And the header should be "Acceptance test site" in the app
And I should see "Timeline"
And I press "Site home" in the app
@ -50,9 +49,8 @@ Feature: Test basic usage of courses in app
And I should find "Course 3" in the app
Scenario: See my courses
When I enter the app
And I log in as "student1"
Then the header should be "Acceptance test site" in the app
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
@ -78,9 +76,8 @@ Feature: Test basic usage of courses in app
And the header should be "Course 3" in the app
Scenario: Search for a course
When I enter the app
And I log in as "student1"
And I press "Search courses" in the app
Given I entered the app as "student1"
When I press "Search courses" in the app
And I set the field "Search" to "Course 4" in the app
And I press "Search" "button" in the app
Then I should find "Course 4" in the app
@ -102,8 +99,8 @@ Feature: Test basic usage of courses in app
# TODO remove LMS UI steps in app tests
Scenario: Links to actions in Timeline work for teachers/students
# Configure assignment as teacher
When I enter the course "Course 1" as "teacher1" in the app
And I press "assignment" in the app
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
@ -116,9 +113,8 @@ Feature: Test basic usage of courses in app
And I close the browser tab opened by the app
# Submit assignment as student
When I enter the app
And I log in as "student1"
And I press "Add submission" in the app
Given I entered the app as "student1"
When I press "Add submission" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app
And I should find "No attempt" in the app
@ -135,9 +131,8 @@ Feature: Test basic usage of courses in app
And I should find "Due:" in the app
# Grade assignment as teacher
When I enter the app
And I log in as "teacher1"
And I press "Grade" in the app
Given I entered the app as "teacher1"
When I press "Grade" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app
And I should find "Time remaining" in the app

View File

@ -63,9 +63,8 @@ Feature: Test basic usage of login in app
And I should find "Wrong Site Address" in the app
Scenario: Delete an account
When I enter the app
And I log in as "student1"
And I press the user menu button in the app
Given I entered the app as "student1"
When I press the user menu button in the app
And I press "Log out" in the app
And I wait the app to restart
Then I should find "Acceptance test site" in the app

View File

@ -9,17 +9,15 @@ Feature: Main Menu opens the right page
Scenario: Opens Site Home when defaulthomepage is set to Site
Given the following config values are set as admin:
| defaulthomepage | 0 |
When I enter the app
And I log in as "student"
Then "Site home" should be selected in the app
Given I entered the app as "student"
When "Site home" should be selected in the app
And I should find "Available courses" in the app
And "Site home" "text" should appear before "Dashboard" "text" in the ".core-tabs-bar" "css_element"
Scenario: Opens Dashboard when defaulthomepage is set to Dashboard
Given the following config values are set as admin:
| defaulthomepage | 1 |
When I enter the app
And I log in as "student"
Then "Dashboard" should be selected in the app
Given I entered the app as "student"
When "Dashboard" should be selected in the app
And I should find "Course overview" in the app
And "Dashboard" "text" should appear before "Site home" "text" in the ".core-tabs-bar" "css_element"

View File

@ -16,9 +16,8 @@ Feature: Main Menu opens the right page
Scenario: Opens Site Home when defaulthomepage is set to Site
Given the following config values are set as admin:
| defaulthomepage | 0 |
When I enter the app
And I log in as "student"
Then "Site home" should be selected in the app
Given I entered the app as "student"
When "Site home" should be selected in the app
And I should find "Available courses" in the app
And "Site home" "text" should appear before "Dashboard" "text" in the ".core-tabs-bar" "css_element"
And "Home" "text" should appear before "My courses" "text" in the ".mainmenu-tabs" "css_element"
@ -27,9 +26,8 @@ Feature: Main Menu opens the right page
Scenario: Opens Dashboard when defaulthomepage is set to Dashboard
Given the following config values are set as admin:
| defaulthomepage | 1 |
When I enter the app
And I log in as "student"
Then "Dashboard" should be selected in the app
Given I entered the app as "student"
When "Dashboard" should be selected in the app
And I should find "Timeline" in the app
And "Dashboard" "text" should appear before "Site home" "text" in the ".core-tabs-bar" "css_element"
And "Home" "text" should appear before "My courses" "text" in the ".mainmenu-tabs" "css_element"
@ -38,8 +36,7 @@ Feature: Main Menu opens the right page
Scenario: Opens My Courses when defaulthomepage is set to My Courses
Given the following config values are set as admin:
| defaulthomepage | 3 |
When I enter the app
And I log in as "student"
Then "My courses" near "Home" should be selected in the app
Given I entered the app as "student"
When "My courses" near "Home" should be selected in the app
And I should find "Course 1" in the app
And "My courses" "text" should appear before "Home" "text" in the ".mainmenu-tabs" "css_element"

View File

@ -7,8 +7,7 @@ Feature: It navigates properly within settings.
| student1 |
Scenario: Mobile navigation
Given I enter the app
And I log in as "student1"
Given I entered the app as "student1"
# Settings
When I press "More" in the app
@ -47,8 +46,7 @@ Feature: It navigates properly within settings.
Then I should find "Total space used" in the app
Scenario: Tablet navigation
Given I enter the app
And I log in as "student1"
Given I entered the app as "student1"
And I change viewport size to "1200x640"
# Settings

View File

@ -7,9 +7,8 @@ Feature: Plugins work properly.
| studentusername |
Scenario: See more menu button
When I enter the app
And I log in as "studentusername"
And I press the more menu button in the app
Given I entered the app as "studentusername"
When I press the more menu button in the app
Then I should find "Moodle App Behat (auto-generated)" in the app
When I press "Moodle App Behat (auto-generated)" in the app

View File

@ -17,9 +17,8 @@ Feature: User Tours work properly.
| disableUserTours | false |
Scenario: Acknowledge User Tours
When I enter the app
And I log in as "student1"
Then I should find "Explore your personal area" in the app
Given I entered the app as "student1"
When I should find "Explore your personal area" in the app
But I should not find "Expand to explore" in the app
When I press "Got it" in the app

View File

@ -557,14 +557,14 @@ export class CoreSitesProvider {
}
// Add site to sites list.
this.addSite(siteId, siteUrl, token, info, privateToken, config, oauthId);
await this.addSite(siteId, siteUrl, token, info, privateToken, config, oauthId);
this.sites[siteId] = candidateSite;
if (login) {
// Turn candidate site into current site.
this.currentSite = candidateSite;
// Store session.
this.login(siteId);
await this.login(siteId);
} else if (this.currentSite && this.currentSite.getId() == siteId) {
// Current site has just been updated, trigger the event.
CoreEvents.trigger(CoreEvents.SITE_UPDATED, info, siteId);

View File

@ -18,8 +18,8 @@ Feature: It navigates properly within activities.
And I replace the arguments in "page" "content"
Scenario: Navigates using deep links
When I enter the course "Course 1" as "student" in the app
And I press "Page" in the app
Given I entered the course "Course 1" as "student" in the app
When I press "Page" in the app
And I press "Go to label" in the app
Then I should find "Label description" in the app

View File

@ -24,9 +24,8 @@ Feature: It navigates properly using deep links.
| defaulthomepage | 0 | |
Scenario: Receive a push notification
When I enter the app
And I log in as "student2"
And I press the user menu button in the app
Given I entered the app as "student2"
When 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 press "Add" in the app
@ -67,9 +66,8 @@ Feature: It navigates properly using deep links.
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
Given I entered the app as "student2"
When 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:

View File

@ -20,8 +20,8 @@ Feature: It opens external links properly.
# This test is flaky and may fail
Scenario: Click an external link
When I enter the course "Course 1" as "student1" in the app
And I press "Test forum" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Test forum" in the app
And I press "Forum topic" in the app
And I press "moodle.org external link" in the app
Then I should find "You are about to leave the app" in the app

View File

@ -21,8 +21,8 @@ Feature: It navigates using gestures.
| student3 | C1 | student |
Scenario: Swipe between participants
When I enter the course "Course 1" as "student1" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app
And I press "Student First" in the app
And I swipe to the left in the app
Then I should find "Teacher First" in the app
@ -40,8 +40,8 @@ Feature: It navigates using gestures.
Then I should find "Student First" in the app
Scenario: Swipe between filtered participants
When I enter the course "Course 1" as "student1" in the app
And I press "Participants" in the app
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app
And I press "Search" in the app
And I set the field "Search" to "student" in the app
And I press "Search" "button" near "Clear search" in the app

View File

@ -25,8 +25,7 @@ Feature: It navigates properly in pages with a split-view component.
Scenario: Navigate in grades tab on mobile
# Open user menu
Given I enter the app
And I log in as "student1"
Given I entered the app as "student1"
And I press the user menu button in the app
# Open grades page
@ -76,9 +75,8 @@ Feature: It navigates properly in pages with a split-view component.
Scenario: Navigate in grades tab on tablet
# Open user menu
Given I enter the app
Given I entered the app as "student1"
And I change viewport size to "1200x640"
And I log in as "student1"
And I press the user menu button in the app
# Open grades page

View File

@ -81,13 +81,7 @@ Feature: Measure performance.
Then "Login" should have taken less than 10 seconds
Scenario: Open Activity
When I launch the app
Then I should see "Connect to Moodle"
But I should not see "Welcome to the Moodle App!"
And I set the field "Your site" to "$WWWROOT" in the app
And I press "Connect to your site" in the app
And I log in as "student1"
Given I entered the app as "student1"
Then I press "My courses" in the app
And I should find "Course 1" in the app