MOBILE-4446 behat: Assert event logs
parent
5a8ec1404d
commit
d0fadb93f2
|
@ -78,12 +78,16 @@ jobs:
|
|||
"@addon_mod_choice"
|
||||
"@addon_mod_data"
|
||||
"@addon_mod_feedback"
|
||||
"@addon_mod_folder"
|
||||
"@addon_mod_forum"
|
||||
"@addon_mod_glossary"
|
||||
"@addon_mod_imscp"
|
||||
"@addon_mod_lesson"
|
||||
"@addon_mod_page"
|
||||
"@addon_mod_quiz"
|
||||
"@addon_mod_scorm"
|
||||
"@addon_mod_survey"
|
||||
"@addon_mod_url"
|
||||
"@addon_mod_workshop"
|
||||
"@addon_notifications"
|
||||
"@addon_blog"
|
||||
|
|
|
@ -968,6 +968,40 @@ class behat_app extends behat_app_helper {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that an event has been logged.
|
||||
*
|
||||
* @Then /^the following events should( not)? have been logged for (".+"|the system) in the app:$/
|
||||
*/
|
||||
public function the_event_should_have_been_logged(bool $not, string $username, TableNode $data) {
|
||||
$userid = $this->get_event_userid($username);
|
||||
|
||||
foreach ($data->getColumnsHash() as $event) {
|
||||
$eventname = $event['name'];
|
||||
$logs = $this->get_event_logs($userid, $event);
|
||||
|
||||
if (!$not && empty($logs)) {
|
||||
throw new ExpectationException("Logs for event '$eventname' not found", $this->getSession()->getDriver());
|
||||
}
|
||||
|
||||
if ($not && !empty($logs) && empty($event['other'])) {
|
||||
throw new ExpectationException("Logs for event '$eventname' found, but shouldn't have", $this->getSession()->getDriver());
|
||||
}
|
||||
|
||||
if (!empty($event['other'])) {
|
||||
$log = $this->find_event_log_with_other($logs, json_decode($event['other'], true));
|
||||
|
||||
if (!$not && is_null($log)) {
|
||||
throw new ExpectationException("Other data for event '$eventname' does not match", $this->getSession()->getDriver());
|
||||
}
|
||||
|
||||
if ($not && !is_null($log)) {
|
||||
throw new ExpectationException("Logs for event '$eventname' found, but shouldn't have", $this->getSession()->getDriver());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches to a newly-opened browser tab.
|
||||
*
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
||||
|
||||
use Behat\Mink\Exception\DriverException;
|
||||
use Behat\Mink\Exception\ExpectationException;
|
||||
use Moodle\BehatExtension\Exception\SkippedException;
|
||||
|
||||
/**
|
||||
|
@ -480,6 +481,106 @@ class behat_app_helper extends behat_base {
|
|||
return !empty($mobilesettings->forcedurlscheme) ? $mobilesettings->forcedurlscheme : 'moodlemobile';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user id corresponding to the given username in event logs.
|
||||
*
|
||||
* @param string $username User name, or "the system" to refer to a non-user actor such as the system, the cli, or a cron job.
|
||||
* @return int Event user id.
|
||||
*/
|
||||
protected function get_event_userid(string $username): int {
|
||||
global $DB;
|
||||
|
||||
if ($username === 'the system') {
|
||||
return \core\event\base::USER_OTHER;
|
||||
}
|
||||
|
||||
if (str_starts_with($username, '"')) {
|
||||
$username = substr($username, 1, -1);
|
||||
}
|
||||
|
||||
$user = $DB->get_record('user', compact('username'));
|
||||
|
||||
if (is_null($user)) {
|
||||
throw new ExpectationException("'$username' user not found", $this->getSession()->getDriver());
|
||||
}
|
||||
|
||||
return $user->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given event logs matching the given restrictions.
|
||||
*
|
||||
* @param array $event Event restrictions.
|
||||
* @return array Event logs.
|
||||
*/
|
||||
protected function get_event_logs(int $userid, array $event): array {
|
||||
global $DB;
|
||||
|
||||
$filters = [
|
||||
'origin' => 'ws',
|
||||
'eventname' => $event['name'],
|
||||
'userid' => $userid,
|
||||
'courseid' => empty($event['course']) ? 0 : $this->get_course_id($event['course']),
|
||||
];
|
||||
|
||||
if (!empty($event['relateduser'])) {
|
||||
$relateduser = $DB->get_record('user', ['username' => $event['relateduser']]);
|
||||
|
||||
$filters['relateduserid'] = $relateduser->id;
|
||||
}
|
||||
|
||||
if (!empty($event['activity'])) {
|
||||
$cm = $this->get_cm_by_activity_name_and_course($event['activity'], $event['activityname'], $event['course']);
|
||||
|
||||
$filters['contextinstanceid'] = $cm->id;
|
||||
}
|
||||
|
||||
if (!empty($event['object'])) {
|
||||
$namecolumns = [
|
||||
'book_chapters' => 'title',
|
||||
'glossary_entries' => 'concept',
|
||||
'lesson_pages' => 'title',
|
||||
'notifications' => 'subject',
|
||||
];
|
||||
|
||||
$field = $namecolumns[$event['object']] ?? 'shortname';
|
||||
$object = $DB->get_record_select(
|
||||
$event['object'],
|
||||
$DB->sql_compare_text($field) . ' = ' . $DB->sql_compare_text('?'),
|
||||
[$event['objectname']]
|
||||
);
|
||||
|
||||
$filters['objectid'] = $object->id;
|
||||
}
|
||||
|
||||
return $DB->get_records('logstore_standard_log', $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a log matching the given other data.
|
||||
*
|
||||
* @param array $logs Event logs.
|
||||
* @param array $other Other data.
|
||||
* @return object Log matching the given other data, or null otherwise.
|
||||
*/
|
||||
protected function find_event_log_with_other(array $logs, array $other): ?object {
|
||||
foreach ($logs as $log) {
|
||||
$logother = json_decode($log->other, true);
|
||||
|
||||
if (empty($logother)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty(array_diff_assoc($other, array_intersect_assoc($other, $logother)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a coursemodule from an activity name or idnumber with course.
|
||||
*
|
||||
|
|
|
@ -18,6 +18,9 @@ Feature: Blog entries
|
|||
And I press "Blog entries" in the app
|
||||
Then I should find "Blog post one" in the app
|
||||
And I should find "Blog post two" in the app
|
||||
And the following events should have been logged for "testuser" in the app:
|
||||
| name |
|
||||
| \core\event\blog_entries_viewed |
|
||||
|
||||
Scenario: Delete blog entry
|
||||
Given I entered the app as "testuser"
|
||||
|
|
|
@ -66,5 +66,8 @@ Feature: Test creation of calendar events in app
|
|||
And I press "Barcelona" in the app
|
||||
And I press "OK" in the app
|
||||
Then the app should have opened a browser tab with url "google.com"
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | other |
|
||||
| \core\event\calendar_event_created | {"name":"User Event 01"} |
|
||||
|
||||
# @todo Add more Scenarios to test teacher, different values, and creating events from other views (e.g. day view).
|
||||
|
|
|
@ -175,6 +175,13 @@ Feature: Test competency navigation
|
|||
Then I should find "Desserts are important" in the app
|
||||
But I should not find "Cakes" in the app
|
||||
|
||||
# Event logs
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | object | objectname | course |
|
||||
| \core\event\competency_user_competency_viewed_in_plan | | | |
|
||||
| \core\event\competency_viewed | competency | Desserts | |
|
||||
| \core\event\competency_user_competency_viewed_in_course | | | Course 1 |
|
||||
|
||||
Scenario: Mobile navigation (teacher)
|
||||
Given I entered the course "Course 1" as "teacher1" in the app
|
||||
|
||||
|
|
|
@ -61,6 +61,13 @@ Feature: Test basic usage of messages in app
|
|||
And I press "Teacher teacher" in the app
|
||||
Then the header should be "Teacher teacher" in the app
|
||||
And I should find "heeey student" in the app
|
||||
And the following events should have been logged for "teacher1" in the app:
|
||||
| name | relateduser |
|
||||
| \core\event\message_contact_added | student1 |
|
||||
| \core\event\message_sent | student1 |
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | relateduser |
|
||||
| \core\event\message_viewed | teacher1 |
|
||||
|
||||
Scenario: Search users
|
||||
Given I entered the app as "student1"
|
||||
|
|
|
@ -57,6 +57,19 @@ Feature: Test basic usage of assignment activity in app
|
|||
When 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 edited" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \assignsubmission_onlinetext\event\assessable_uploaded | assign | assignment1 | Course 1 |
|
||||
| \assignsubmission_onlinetext\event\submission_created | assign | assignment1 | Course 1 |
|
||||
| \assignsubmission_onlinetext\event\submission_updated | assign | assignment1 | Course 1 |
|
||||
| \mod_assign\event\assessable_submitted | assign | assignment1 | Course 1 |
|
||||
| \mod_assign\event\course_module_viewed | assign | assignment1 | Course 1 |
|
||||
| \mod_assign\event\statement_accepted | assign | assignment1 | Course 1 |
|
||||
| \mod_assign\event\submission_status_viewed | assign | assignment1 | Course 1 |
|
||||
And the following events should have been logged for "teacher1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_assign\event\grading_table_viewed | assign | assignment1 | Course 1 |
|
||||
| \mod_assign\event\course_module_viewed | assign | assignment1 | Course 1 |
|
||||
|
||||
Scenario: Edit/Add submission (online text) & Add new attempt from previous submission & Submit for grading
|
||||
# Submit first attempt as a student
|
||||
|
|
|
@ -54,6 +54,10 @@ Feature: Test basic usage of BBB activity in app
|
|||
Then I should find "The session is in progress." in the app
|
||||
And I should find "1" near "Viewer" in the app
|
||||
And I should find "0" near "Moderator" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_bigbluebuttonbn\event\course_module_viewed | bigbluebuttonbn | Test BBB | Course 1 |
|
||||
| \mod_bigbluebuttonbn\event\meeting_joined | bigbluebuttonbn | Test BBB | Course 1 |
|
||||
|
||||
Scenario: Join meeting (moderator)
|
||||
Given the following "activities" exist:
|
||||
|
|
|
@ -153,8 +153,15 @@ Feature: Test basic usage of book activity in app
|
|||
Then I should find "Chapt 2" in the app
|
||||
And I should find "This is the second chapter" in the app
|
||||
And I should find "3 / 4" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | object | objectname | course |
|
||||
| \mod_book\event\course_module_viewed | book | Basic book | | | Course 1 |
|
||||
| \mod_book\event\chapter_viewed | book | Basic book | book_chapters | Chapt 1 | Course 1 |
|
||||
| \mod_book\event\chapter_viewed | book | Basic book | book_chapters | Chapt 1.1 | Course 1 |
|
||||
| \mod_book\event\chapter_viewed | book | Basic book | book_chapters | Chapt 2 | Course 1 |
|
||||
| \mod_book\event\chapter_viewed | book | Basic book | book_chapters | Chapt 3 | Course 1 |
|
||||
|
||||
Scenario: View and navigate book contents (teacher)
|
||||
Scenario: View and navigate book contents (teacher)
|
||||
Given I entered the course "Course 1" as "teacher1" in the app
|
||||
And I press "Basic book" in the app
|
||||
And I press "Start" in the app
|
||||
|
|
|
@ -54,6 +54,14 @@ Feature: Test basic usage of chat in app
|
|||
When I set the field "New message" to "Hi David, I am Pau." in the app
|
||||
And I press "Send" in the app
|
||||
Then I should find "Hi David, I am Pau." in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_chat\event\course_module_viewed | chat | Test chat name | Course 1 |
|
||||
| \mod_chat\event\message_sent | chat | Test chat name | Course 1 |
|
||||
And the following events should have been logged for "student2" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_chat\event\course_module_viewed | chat | Test chat name | Course 1 |
|
||||
| \mod_chat\event\message_sent | chat | Test chat name | Course 1 |
|
||||
|
||||
Scenario: Past sessions shown
|
||||
# Send messages as student1
|
||||
|
|
|
@ -38,6 +38,10 @@ Feature: Test basic usage of choice activity in app
|
|||
Then I should find "Option 1: 0" in the app
|
||||
And I should find "Option 2: 1" in the app
|
||||
And I should find "Option 3: 0" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_choice\event\course_module_viewed | choice | Test single choice name | Course 1 |
|
||||
| \mod_choice\event\answer_created | choice | Test single choice name | Course 1 |
|
||||
|
||||
Scenario: Answer a choice (multi or single, update answer) & View results & Delete choice
|
||||
Given the following "activities" exist:
|
||||
|
|
|
@ -91,6 +91,10 @@ Feature: Users can manage entries in database activities
|
|||
And I entered the data activity "Data with comments" on course "Course 1" as "student1" in the app
|
||||
When I press "Show more" near "Moodle community site" in the app
|
||||
Then I should not find "Comments" in the app
|
||||
But the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_data\event\course_module_viewed | data | Data with comments | Course 1 |
|
||||
| \mod_data\event\record_created | data | Data with comments | Course 1 |
|
||||
|
||||
Scenario: Students can not edit or delete other user's entries from list and single view in the app
|
||||
Given I entered the data activity "Web links" on course "Course 1" as "student1" in the app
|
||||
|
|
|
@ -377,6 +377,9 @@ Feature: Test feedback navigation
|
|||
But I should not find "Student 21" in the app
|
||||
And I should not find "Anonymous entries" in the app
|
||||
And I should not find "Response number: 22" in the app
|
||||
And the following events should have been logged for "teacher1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_feedback\event\course_module_viewed | feedback | Feedback | Course 1 |
|
||||
|
||||
Scenario: Tablet navigation
|
||||
Given I entered the course "Course 1" as "teacher1" in the app
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
@addon_mod_folder @app @javascript
|
||||
Feature: Test basic usage of folder activity in app
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | student | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| folder | Test folder title | Test folder description | C1 | folder |
|
||||
|
||||
Scenario: View contents
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
When I press "Test folder title" in the app
|
||||
Then I should find "Test folder description" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_folder\event\course_module_viewed | folder | Test folder title | Course 1 |
|
|
@ -66,6 +66,12 @@ Feature: Test basic usage of forum activity in app
|
|||
And I press "Post to forum" in the app
|
||||
Then I should find "Initial discussion message" in the app
|
||||
And I should find "ReplyMessage" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_forum\event\course_module_viewed | forum | Test forum name | Course 1 |
|
||||
| \mod_forum\event\assessable_uploaded | forum | Test forum name | Course 1 |
|
||||
| \mod_forum\event\post_created | forum | Test forum name | Course 1 |
|
||||
| \mod_forum\event\discussion_subscription_created | forum | Test forum name | Course 1 |
|
||||
|
||||
Scenario: Star and pin discussions (student)
|
||||
Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app
|
||||
|
|
|
@ -45,6 +45,10 @@ Feature: Test basic usage of glossary in app
|
|||
When I press "Potato" in the app
|
||||
Then I should find "Potato" in the app
|
||||
And I should find "To make chips" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | object | objectname | course |
|
||||
| \mod_glossary\event\course_module_viewed | glossary | Test glossary | | | Course 1 |
|
||||
| \mod_glossary\event\entry_viewed | glossary | Test glossary | glossary_entries | Potato | Course 1 |
|
||||
|
||||
Scenario: Navigate to glossary terms by link (auto-linking)
|
||||
Given the "glossary" filter is "on"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
@addon_mod_imscp @app @javascript
|
||||
Feature: Test basic usage of imscp activity in app
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | student | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| imscp | Test imscp title | Test imscp description | C1 | imscp |
|
||||
|
||||
Scenario: View contents
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
When I press "Test imscp title" in the app
|
||||
Then I should find "Test imscp description" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_imscp\event\course_module_viewed | imscp | Test imscp title | Course 1 |
|
|
@ -117,6 +117,14 @@ Feature: Test decimal separators in lesson
|
|||
|
||||
When I press "Review lesson" in the app
|
||||
Then the field "Your answer" matches value "2,87" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | object | objectname | course |
|
||||
| \mod_lesson\event\course_module_viewed | lesson | Basic lesson | | | Course 1 |
|
||||
| \mod_lesson\event\lesson_started | lesson | Basic lesson | | | Course 1 |
|
||||
| \mod_lesson\event\lesson_ended | lesson | Basic lesson | | | Course 1 |
|
||||
| \mod_lesson\event\question_viewed | lesson | Basic lesson | lesson_pages | Hardest question ever | Course 1 |
|
||||
| \mod_lesson\event\question_answered | lesson | Basic lesson | lesson_pages | Hardest question ever | Course 1 |
|
||||
| \core\event\user_graded | | | | | Course 1 |
|
||||
|
||||
Scenario: Attempt an offline lesson successfully as a student (standard separator)
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
@addon_mod_page @app @javascript
|
||||
Feature: Test basic usage of page activity in app
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | student | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | content | course | idnumber |
|
||||
| page | Test page title | Test page content | C1 | page |
|
||||
|
||||
Scenario: View contents
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
When I press "Test page title" in the app
|
||||
Then I should find "Test page content" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_page\event\course_module_viewed | page | Test page title | Course 1 |
|
|
@ -133,6 +133,16 @@ Feature: Attempt a quiz in app
|
|||
And I should find "Grade" in the app
|
||||
And I should find "Question 1" in the app
|
||||
And I should find "Question 2" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course | other |
|
||||
| \mod_quiz\event\course_module_viewed | quiz | Quiz 1 | Course 1 | |
|
||||
| \mod_quiz\event\attempt_started | quiz | Quiz 1 | Course 1 | |
|
||||
| \mod_quiz\event\attempt_viewed | quiz | Quiz 1 | Course 1 | {"page":"0"} |
|
||||
| \mod_quiz\event\attempt_viewed | quiz | Quiz 1 | Course 1 | {"page":"1"} |
|
||||
| \mod_quiz\event\attempt_updated | quiz | Quiz 1 | Course 1 | {"page":"0"} |
|
||||
| \mod_quiz\event\attempt_updated | quiz | Quiz 1 | Course 1 | {"page":"1"} |
|
||||
| \mod_quiz\event\attempt_reviewed | quiz | Quiz 1 | Course 1 | |
|
||||
| \mod_quiz\event\attempt_summary_viewed | quiz | Quiz 1 | Course 1 | |
|
||||
|
||||
Scenario: Attempt a quiz (all question types)
|
||||
Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app
|
||||
|
|
|
@ -52,6 +52,10 @@ Feature: Test basic usage of survey activity in app
|
|||
And I log in as "student1"
|
||||
Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages."
|
||||
And I should see "1 people have completed this survey so far"
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_survey\event\course_module_viewed | survey | Test survey name | Course 1 |
|
||||
| \mod_survey\event\response_submitted | survey | Test survey name | Course 1 |
|
||||
|
||||
Scenario: Answer a survey & View results (Critical incidents)
|
||||
Given the following "activities" exist:
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
@addon_mod_url @app @javascript
|
||||
Feature: Test basic usage of url activity in app
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | student | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | externalurl |
|
||||
| url | Test url title | C1 | url | https://moodle.org |
|
||||
|
||||
Scenario: View contents
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
When I press "Test url title" in the app
|
||||
Then I should find "https://moodle.org" in the app
|
||||
|
||||
When I press "Access the URL" in the app
|
||||
And I press "OK" near "You are about to leave the app" in the app
|
||||
Then the app should have opened a browser tab with url "moodle.org"
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_url\event\course_module_viewed | url | Test url title | Course 1 |
|
|
@ -114,6 +114,20 @@ Feature: Test basic usage of workshop activity in app
|
|||
And I pull to refresh in the app
|
||||
Then I should find "Closed" in the app
|
||||
And I should find "Conclusion 1" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_workshop\event\course_module_viewed | workshop | Test workshop | Course 1 |
|
||||
| \mod_workshop\event\submission_created | workshop | Test workshop | Course 1 |
|
||||
| \mod_workshop\event\submission_updated | workshop | Test workshop | Course 1 |
|
||||
| \mod_workshop\event\assessable_uploaded | workshop | Test workshop | Course 1 |
|
||||
And the following events should have been logged for "student2" in the app:
|
||||
| name | activity | activityname | relateduser | course |
|
||||
| \mod_workshop\event\course_module_viewed | workshop | Test workshop | | Course 1 |
|
||||
| \mod_workshop\event\submission_viewed | workshop | Test workshop | student1 | Course 1 |
|
||||
| \mod_workshop\event\submission_assessed | workshop | Test workshop | student1 | Course 1 |
|
||||
And the following events should have been logged for "teacher1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_workshop\event\course_module_viewed | workshop | Test workshop | Course 1 |
|
||||
|
||||
Scenario: Prefetch a workshop
|
||||
Given I entered the workshop activity "workshop" on course "Course 1" as "teacher1" in the app
|
||||
|
|
|
@ -78,6 +78,16 @@ Feature: Notifications
|
|||
Then I should find "Test 10 description" in the app
|
||||
But I should not find "Test 09 description" in the app
|
||||
|
||||
|
||||
# Check event logs
|
||||
And the following events should not have been logged for "student1" in the app:
|
||||
| name | object | objectname |
|
||||
| \core\event\notification_viewed | notifications | Test 10 |
|
||||
| \core\event\notification_viewed | notifications | Test 11 |
|
||||
But the following events should have been logged for "student1" in the app:
|
||||
| name | object | objectname |
|
||||
| \core\event\notification_viewed | notifications | Test 30 |
|
||||
|
||||
Scenario: Tablet navigation
|
||||
Given I entered the app as "student1"
|
||||
And I change viewport size to "1200x640" in the app
|
||||
|
|
|
@ -41,6 +41,9 @@ Feature: Test basic usage of one course in app
|
|||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | groupmode | section |
|
||||
| feedback | Test feedback name | Test feedback | C1 | feedback | 0 | 3 |
|
||||
And the following "mod_feedback > questions" exist:
|
||||
| activity |
|
||||
| feedback |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | section |
|
||||
| glossary | Test glossary | glossary description | C1 | gloss1 | 5 |
|
||||
|
@ -67,12 +70,20 @@ Feature: Test basic usage of one course in app
|
|||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | groupmode | section |
|
||||
| lesson | Test lesson name | Test lesson | C1 | lesson | 0 | 3 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title |
|
||||
| Test lesson name | content | First page title |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page |
|
||||
| First page title |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | groupmode | section |
|
||||
| scorm | Test scorm name | Test scorm | C1 | scorm | 0 | 2 |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | groupmode | section |
|
||||
| workshop | Test workshop name | Test workshop | C1 | workshop | 0 | 3 |
|
||||
And the following config values are set as admin:
|
||||
| disabledfeatures | CoreCourseModuleDelegate_AddonModLti:launchViaSite | tool_mobile |
|
||||
|
||||
# TODO remove once MDL-77951 is resolved.
|
||||
And I log in as "admin"
|
||||
|
@ -134,11 +145,12 @@ Feature: Test basic usage of one course in app
|
|||
|
||||
When I press the back button in the app
|
||||
And I press "Test external name" in the app
|
||||
And I press "Launch the activity" in the app
|
||||
And I wait loading to finish in the app
|
||||
Then the header should be "Test external name" in the app
|
||||
|
||||
When I press the back button in the app
|
||||
And I press "Test feedback name" in the app
|
||||
And I press "OK" in the app
|
||||
Then the header should be "Test feedback name" in the app
|
||||
|
||||
When I press the back button in the app
|
||||
|
@ -168,6 +180,23 @@ Feature: Test basic usage of one course in app
|
|||
When I press the back button in the app
|
||||
And I press "Test workshop name" in the app
|
||||
Then the header should be "Test workshop name" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_survey\event\course_module_viewed | survey | Test survey name | Course 1 |
|
||||
| \mod_wiki\event\course_module_viewed | wiki | Test wiki name | Course 1 |
|
||||
| \mod_lesson\event\course_module_viewed | lesson | Test lesson name | Course 1 |
|
||||
| \mod_scorm\event\course_module_viewed | scorm | Test scorm name | Course 1 |
|
||||
| \mod_workshop\event\course_module_viewed | workshop | Test workshop name | Course 1 |
|
||||
| \mod_choice\event\course_module_viewed | choice | Choice course 1 | Course 1 |
|
||||
| \mod_assign\event\course_module_viewed | assign | assignment | Course 1 |
|
||||
| \mod_assign\event\submission_status_viewed | assign | assignment | Course 1 |
|
||||
| \mod_forum\event\course_module_viewed | forum | Test forum name | Course 1 |
|
||||
| \mod_chat\event\course_module_viewed | chat | Test chat name | Course 1 |
|
||||
| \mod_data\event\course_module_viewed | data | Web links | Course 1 |
|
||||
| \mod_lti\event\course_module_viewed | lti | Test external name | Course 1 |
|
||||
| \mod_feedback\event\course_module_viewed | feedback | Test feedback name | Course 1 |
|
||||
| \mod_glossary\event\course_module_viewed | glossary | Test glossary | Course 1 |
|
||||
| \mod_quiz\event\course_module_viewed | quiz | Quiz 1 | Course 1 |
|
||||
|
||||
@lms_from4.4
|
||||
Scenario: View section contents
|
||||
|
@ -293,7 +322,6 @@ Feature: Test basic usage of one course in app
|
|||
And I should not find "Test scorm name" in the app
|
||||
|
||||
When I press "Test feedback name" in the app
|
||||
And I press "OK" in the app
|
||||
Then the header should be "Test feedback name" in the app
|
||||
|
||||
When I press the back button in the app
|
||||
|
@ -423,6 +451,13 @@ Feature: Test basic usage of one course in app
|
|||
But I should not find "General" in the app
|
||||
And I should not find "Section 1" in the app
|
||||
And I should not find "Section 2" in the app
|
||||
But the following events should have been logged for "student1" in the app:
|
||||
| name | course | other |
|
||||
| \core\event\course_viewed | Course 1 | {"coursesectionnumber":1} |
|
||||
| \core\event\course_viewed | Course 1 | {"coursesectionnumber":2} |
|
||||
| \core\event\course_viewed | Course 1 | {"coursesectionnumber":3} |
|
||||
| \core\event\course_viewed | Course 1 | {"coursesectionnumber":4} |
|
||||
| \core\event\course_viewed | Course 1 | {"coursesectionnumber":5} |
|
||||
|
||||
@lms_from4.0
|
||||
Scenario: Self enrol
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 35 KiB |
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
|
@ -93,6 +93,10 @@ Feature: Test basic usage of courses in 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\dashboard_viewed |
|
||||
| \core\event\mycourses_viewed |
|
||||
|
||||
Scenario: Search for a course
|
||||
Given I entered the app as "student1"
|
||||
|
|
|
@ -150,6 +150,22 @@ Feature: Grades navigation
|
|||
When I press the back button in the app
|
||||
Then I should find "Course 1" in the app
|
||||
And I should find "Course 2" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | course | other |
|
||||
| \gradereport_overview\event\grade_report_viewed | Acceptance test site | |
|
||||
| \gradereport_user\event\grade_report_viewed | Course 1 | |
|
||||
| \gradereport_user\event\grade_report_viewed | Course 2 | |
|
||||
| \core\event\user_list_viewed | Course 2 | |
|
||||
| \core\event\grade_item_updated | Course 1 | {"itemname":"GI C1"} |
|
||||
| \core\event\grade_item_updated | Course 2 | {"itemname":"GI C2.1.1"} |
|
||||
| \core\event\grade_item_updated | Course 2 | {"itemname":"GI C2.1.2"} |
|
||||
| \core\event\grade_item_updated | Course 2 | {"itemname":"GI C2.2.1"} |
|
||||
And the following events should have been logged for the system in the app:
|
||||
| name | relateduser | course | other |
|
||||
| \core\event\user_graded | student1 | Course 1 | {"finalgrade":30} |
|
||||
| \core\event\user_graded | student1 | Course 2 | {"finalgrade":40} |
|
||||
| \core\event\user_graded | student1 | Course 2 | {"finalgrade":90} |
|
||||
| \core\event\user_graded | student1 | Course 2 | {"finalgrade":130} |
|
||||
|
||||
@lms_from4.2
|
||||
Scenario: Mobile navigation (teacher)
|
||||
|
|
|
@ -97,6 +97,11 @@ Feature: Test Global Search
|
|||
And I set the field "Search" to "noresults" in the app
|
||||
And I press "Search" "button" in the app
|
||||
Then I should find "No results for" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | other |
|
||||
| \core\event\search_results_viewed | {"q":"page"} |
|
||||
| \core\event\search_results_viewed | {"q":"forum"} |
|
||||
| \core\event\search_results_viewed | {"q":"noresults"} |
|
||||
|
||||
# TODO test other results like course, user, and messages (global search generator not supported)
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ Feature: It opens files properly.
|
|||
And I press "Test DOC" in the app
|
||||
And I press "Open" in the app
|
||||
Then I should find "This file may not work as expected on this device" in the app
|
||||
And the following events should have been logged for "student1" in the app:
|
||||
| name | activity | activityname | course |
|
||||
| \mod_resource\event\course_module_viewed | resource | Test TXT | Course 1 |
|
||||
| \mod_resource\event\course_module_viewed | resource | Test RTF | Course 1 |
|
||||
| \mod_resource\event\course_module_viewed | resource | Test DOC | Course 1 |
|
||||
|
||||
@lms_from4.3
|
||||
Scenario: Open a PDF embedded using an iframe
|
||||
|
|
Loading…
Reference in New Issue