From cc3c8906c65dee8110f78d7e2a138c66542f4328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 11 May 2022 11:57:07 +0200 Subject: [PATCH] MOBILE-4061 behat: Add shortcuts to enter activities --- .../tests/behat/behat_app.php | 40 +++++++++- .../tests/behat/basic_usage-310.feature | 6 +- .../assign/tests/behat/basic_usage.feature | 36 ++++----- .../mod/chat/tests/behat/basic_usage.feature | 16 ++-- .../mod/chat/tests/behat/navigation.feature | 3 +- .../tests/behat/basic_usage-311.feature | 8 +- .../choice/tests/behat/basic_usage.feature | 30 +++----- .../mod/forum/tests/behat/basic_usage.feature | 75 ++++++++----------- .../mod/quiz/tests/behat/basic_usage.feature | 20 ++--- .../quiz/tests/behat/quiz_navigation.feature | 3 +- .../tests/behat/basic_usage-310.feature | 5 +- .../courses/tests/behat/basic_usage.feature | 5 +- .../behat/navigation_externallinks.feature | 5 +- 13 files changed, 120 insertions(+), 132 deletions(-) diff --git a/local-moodleappbehat/tests/behat/behat_app.php b/local-moodleappbehat/tests/behat/behat_app.php index 8b648c99f..16f3a52a6 100644 --- a/local-moodleappbehat/tests/behat/behat_app.php +++ b/local-moodleappbehat/tests/behat/behat_app.php @@ -566,7 +566,7 @@ class behat_app extends behat_base { global $CFG; - $this->i_set_the_field_in_the_app('Your site', $CFG->wwwroot); + $this->i_set_the_field_in_the_app('Your site', $CFG->behat_wwwroot); $this->i_press_in_the_app('"Connect to your site"'); $this->wait_for_pending_js(); } @@ -603,7 +603,7 @@ class behat_app extends behat_base { /** * User enters a course in the app. * - * @Given /^I enter(ed)? 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 */ @@ -622,8 +622,42 @@ class behat_app extends behat_base { } else { $this->open_moodleapp_custom_url("/course/view.php?id=$courseid", '//page-core-course-index'); } + } + /** + * User enters an activity in a course in the app. + * + * @Given /^I enter(ed)? the (.+) activity "([^"]+)" on course "([^"]+)"(?: as "([^"]+)")? in the app$/ + * @param string $coursename Course name + * @throws DriverException If the button push doesn't work + */ + public function i_enter_the_activity_in_the_app(bool $unused, string $activity, string $activityname, string $coursename, ?string $username = null) { + global $DB; + $courseid = $DB->get_field('course', 'id', [ 'fullname' => $coursename]); + if (!$courseid) { + throw new DriverException("Course '$coursename' not found"); + } + + if ($activity === 'assignment') { + $activity = 'assign'; + } + + $module = $DB->get_record($activity, ['name' => $activityname, 'course' => $courseid ]); + if (!$module) { + throw new DriverException("'$activityname' activity '$activityname' not found"); + } + + $cm = get_coursemodule_from_instance($activity, $module->id); + $pageurl = "/mod/$activity/view.php?id={$cm->id}"; + + if ($username) { + $this->i_launch_the_app(); + + $this->open_moodleapp_custom_login_url($username, $pageurl); + } else { + $this->open_moodleapp_custom_url($pageurl); + } } /** @@ -660,7 +694,7 @@ class behat_app extends behat_base { $module = $DB->get_record('course_modules', ['idnumber' => $data->module]); $discussion = $DB->get_record('forum_discussions', ['name' => $data->discussion]); $notification = json_encode([ - 'site' => md5($CFG->wwwroot . $data->username), + 'site' => md5($CFG->behat_wwwroot . $data->username), 'courseid' => $discussion->course, 'moodlecomponent' => 'mod_forum', 'name' => 'posts', diff --git a/src/addons/mod/assign/tests/behat/basic_usage-310.feature b/src/addons/mod/assign/tests/behat/basic_usage-310.feature index cdd88aeef..532f7a134 100755 --- a/src/addons/mod/assign/tests/behat/basic_usage-310.feature +++ b/src/addons/mod/assign/tests/behat/basic_usage-310.feature @@ -21,8 +21,7 @@ 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 - Given I entered the course "Course 1" as "student1" in the app - When I press "assignment1" in the app + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" 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 +46,7 @@ Feature: Test basic usage of assignment activity in app And I should find "Submission test edited" in the app # View as a teacher - Given I entered the course "Course 1" as "teacher1" in the app - When I press "assignment1" in the app + Given I entered the assign activity "assignment1" on course "Course 1" as "teacher1" in the app Then the header should be "assignment1" in the app When I press "Submitted" in the app diff --git a/src/addons/mod/assign/tests/behat/basic_usage.feature b/src/addons/mod/assign/tests/behat/basic_usage.feature index 9e26048be..ec41e1017 100755 --- a/src/addons/mod/assign/tests/behat/basic_usage.feature +++ b/src/addons/mod/assign/tests/behat/basic_usage.feature @@ -22,8 +22,7 @@ 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 - Given I entered the course "Course 1" as "student1" in the app - When I press "assignment1" in the app + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" 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 +47,7 @@ Feature: Test basic usage of assignment activity in app And I should find "Submission test edited" in the app # View as a teacher - Given I entered the course "Course 1" as "teacher1" in the app - When I press "assignment1" in the app + Given I entered the assign activity "assignment1" on course "Course 1" as "teacher1" in the app Then the header should be "assignment1" in the app When I press "Submitted" in the app @@ -62,18 +60,16 @@ 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 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 + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" in the app + When I press "Add submission" in the app + Then I set the field "Online text submissions" to "Submission test 1st attempt" in the app And I press "Save" in the app And I press "Submit assignment" in the app And I press "OK" in the app # Allow more attempts as a teacher - 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 + Given I entered the assign activity "assignment1" on course "Course 1" as "teacher1" in the app + When I press "Participants" in the app And I press "Student student" near "assignment1" in the app And I press "Grade" in the app And I press "Allow another attempt" in the app @@ -82,8 +78,7 @@ Feature: Test basic usage of assignment activity in app And I should find "Not graded" in the app # Submit second attempt as a student - Given I entered the course "Course 1" as "student1" in the app - When I press "assignment1" in the app + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" 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,17 +95,15 @@ Feature: Test basic usage of assignment activity in app And I press "OK" in the app # View second attempt as a teacher - 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 + Given I entered the assign activity "assignment1" on course "Course 1" as "teacher1" in the app + When 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 - 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 + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" in the app + When 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 And I press "Save" in the app @@ -127,9 +120,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 - 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 + Given I entered the assign activity "assignment1" on course "Course 1" as "student1" in the app + When 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 And I press "Save" in the app diff --git a/src/addons/mod/chat/tests/behat/basic_usage.feature b/src/addons/mod/chat/tests/behat/basic_usage.feature index d739a2df9..35a4972f6 100755 --- a/src/addons/mod/chat/tests/behat/basic_usage.feature +++ b/src/addons/mod/chat/tests/behat/basic_usage.feature @@ -21,8 +21,7 @@ Feature: Test basic usage of chat in app Scenario: Receive and send messages & See connected users, beep and talk to # Send messages as student1 - Given I entered the course "Course 1" as "student1" in the app - When I press "Test chat name" in the app + Given I entered the chat activity "Test chat name" on course "Course 1" as "student1" in the app Then I should find "Enter the chat" in the app And I should find "Past sessions" in the app @@ -37,8 +36,7 @@ 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 - Given I entered the course "Course 1" as "student2" in the app - When I press "Test chat name" in the app + Given I entered the chat activity "Test chat name" on course "Course 1" as "student2" 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,9 +53,8 @@ Feature: Test basic usage of chat in app Scenario: Past sessions shown # Send messages as student1 - 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 + Given I entered the chat activity "Test chat name" on course "Course 1" as "student1" in the app + When I press "Enter the chat" in the app And I set the field "New message" to "Hi!" in the app And I press "Send" in the app Then I should find "Hi!" in the app @@ -67,9 +64,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 - 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 + Given I entered the chat activity "Test chat name" on course "Course 1" as "student2" in the app + When 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 Then I should find "Hi!" in the app diff --git a/src/addons/mod/chat/tests/behat/navigation.feature b/src/addons/mod/chat/tests/behat/navigation.feature index 8bca1e498..3490ea6f0 100644 --- a/src/addons/mod/chat/tests/behat/navigation.feature +++ b/src/addons/mod/chat/tests/behat/navigation.feature @@ -18,8 +18,7 @@ Feature: Test chat navigation | chat | Test chat name | Test chat | C1 | chat | 0 | # Create sessions # TODO use generator instead - And I entered the course "Course 1" as "student1" in the app - And I press "Test chat name" in the app + And I entered the chat activity "Test chat name" on course "Course 1" as "student1" 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 And I press "Send" in the app diff --git a/src/addons/mod/choice/tests/behat/basic_usage-311.feature b/src/addons/mod/choice/tests/behat/basic_usage-311.feature index 6ce9f1e60..5030a7f2e 100755 --- a/src/addons/mod/choice/tests/behat/basic_usage-311.feature +++ b/src/addons/mod/choice/tests/behat/basic_usage-311.feature @@ -22,15 +22,13 @@ 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 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 entered the choice activity "Choice name" on course "Course 1" as "student1" in the app + Then 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 - Given I entered the course "Course 1" as "teacher1" in the app - When I press "Choice name" in the app + Given I entered the choice activity "Choice name" on course "Course 1" as "teacher1" in the app Then I should find "Test choice description" in the app When I press "Information" in the app diff --git a/src/addons/mod/choice/tests/behat/basic_usage.feature b/src/addons/mod/choice/tests/behat/basic_usage.feature index 8585a6ab4..753181599 100755 --- a/src/addons/mod/choice/tests/behat/basic_usage.feature +++ b/src/addons/mod/choice/tests/behat/basic_usage.feature @@ -21,9 +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 | - 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 entered the choice activity "Test single choice name" on course "Course 1" as "student1" in the app + When I select "Option 1" in the app And I select "Option 2" in the app And I press "Save my choice" in the app Then I should find "Are you sure" in the app @@ -44,9 +43,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 | - 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 entered the choice activity "Test multi choice name" on course "Course 1" as "student1" in the app + When I select "Option 1" in the app And I select "Option 2" in the app And I press "Save my choice" in the app Then I should find "Option 1: 1" in the app @@ -72,9 +70,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 | - 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 entered the choice activity "Test single choice name" on course "Course 1" as "student1" in the app + When I select "Option 1" in the app And I switch offline mode to "true" And I select "Option 2" in the app And I press "Save my choice" in the app @@ -104,9 +101,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 | - 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 entered the choice activity "Test single choice name" on course "Course 1" as "student1" in the app + When I select "Option 1" in the app And I switch offline mode to "true" And I select "Option 2" in the app And I press "Save my choice" in the app @@ -133,7 +129,7 @@ Feature: Test basic usage of choice activity in app | choice | Test single choice name | Test single choice description | C1 | choice1 | Option 1, Option 2, Option 3 | 0 | 0 | 1 | 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 + When 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 +167,13 @@ 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 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 entered the choice activity "Choice name" on course "Course 1" as "student1" in the app + When 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 - Given I entered the course "Course 1" as "teacher1" in the app - When I press "Choice name" in the app + Given I entered the choice activity "Choice name" on course "Course 1" as "teacher1" in the app Then I should find "Test choice description" in the app When I press "Information" in the app diff --git a/src/addons/mod/forum/tests/behat/basic_usage.feature b/src/addons/mod/forum/tests/behat/basic_usage.feature index 20b075d96..ddf3e4990 100755 --- a/src/addons/mod/forum/tests/behat/basic_usage.feature +++ b/src/addons/mod/forum/tests/behat/basic_usage.feature @@ -25,9 +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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When I press "Add discussion topic" in the app And I set the field "Subject" to "My happy subject" in the app And I set the field "Message" to "An awesome message" in the app And I press "Post to forum" in the app @@ -37,9 +36,8 @@ Feature: Test basic usage of forum activity in app Then I should find "An awesome message" in the app Scenario: Reply a post - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -53,9 +51,8 @@ Feature: Test basic usage of forum activity in app And I should find "ReplyMessage" in the app Scenario: Star and pin discussions (student) - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -87,9 +84,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) - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "teacher1" in the app + When 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 And I press "Post to forum" in the app @@ -117,9 +113,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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -150,9 +145,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 - 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" + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I set the field "Message" to "Auto-test message" in the app @@ -173,9 +167,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) - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -200,9 +193,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) - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -233,9 +225,8 @@ 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 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -247,9 +238,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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "teacher1" in the app + When I press "Auto-test" in the app Then I should find "Reply" in the app When I press "None" near "Auto-test message" in the app @@ -274,17 +264,15 @@ 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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app @@ -312,9 +300,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 - 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" + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I set the field "Message" to "DiscussionMessage" in the app @@ -335,9 +322,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 - 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" + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I set the field "Message" to "DiscussionMessage" in the app @@ -358,9 +344,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 - 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 + Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When 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 And I press "Post to forum" in the app diff --git a/src/addons/mod/quiz/tests/behat/basic_usage.feature b/src/addons/mod/quiz/tests/behat/basic_usage.feature index c20850298..73479ebc3 100755 --- a/src/addons/mod/quiz/tests/behat/basic_usage.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage.feature @@ -56,9 +56,8 @@ Feature: Attempt a quiz in app | TF9 | 7 | Scenario: View a quiz entry page (attempts, status, etc.) - 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 + Given I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" in the app + When 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,9 +105,8 @@ Feature: Attempt a quiz in app And I should find "Question 2" in the app Scenario: Attempt a quiz (all question types) - 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 + Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app + When I press "Attempt quiz now" in the app And I press "Four" in the app And I press "Three" in the app And I press "Next" near "Quiz 2" in the app @@ -143,9 +141,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 - 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 + Given I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" in the app + When 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 And I press "False" in the app @@ -154,9 +151,8 @@ Feature: Attempt a quiz in app And I press "OK" in the app Then I should find "Review" 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 + Given I entered the quiz activity "Quiz 1" on course "Course 1" as "teacher1" in the app + When 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 And I log in as "teacher1" diff --git a/src/addons/mod/quiz/tests/behat/quiz_navigation.feature b/src/addons/mod/quiz/tests/behat/quiz_navigation.feature index a81c5d0a3..8ecb4e422 100644 --- a/src/addons/mod/quiz/tests/behat/quiz_navigation.feature +++ b/src/addons/mod/quiz/tests/behat/quiz_navigation.feature @@ -30,8 +30,7 @@ Feature: Attempt a quiz in app | TF2 | 2 | Scenario: Next and previous navigation - Given I entered the course "Course 1" as "student1" in the app - When I press "Quiz 1" in the app + Given I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" 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 diff --git a/src/core/features/courses/tests/behat/basic_usage-310.feature b/src/core/features/courses/tests/behat/basic_usage-310.feature index 21691d4f3..6c4a0e7a6 100755 --- a/src/core/features/courses/tests/behat/basic_usage-310.feature +++ b/src/core/features/courses/tests/behat/basic_usage-310.feature @@ -36,9 +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 entered the course "Course 1" as "teacher1" in the app - When I press "assignment" in the app - And I press "Information" in the app + Given I entered the assign activity "assignment" on course "Course 1" as "teacher1" in the app + When 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 And I log in as "teacher1" diff --git a/src/core/features/courses/tests/behat/basic_usage.feature b/src/core/features/courses/tests/behat/basic_usage.feature index c76f34d9c..46968acf9 100755 --- a/src/core/features/courses/tests/behat/basic_usage.feature +++ b/src/core/features/courses/tests/behat/basic_usage.feature @@ -101,9 +101,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 - 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 + Given I entered the assign activity "assignment" on course "Course 1" as "teacher1" in the app + When 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 And I log in as "teacher1" diff --git a/src/tests/behat/navigation_externallinks.feature b/src/tests/behat/navigation_externallinks.feature index 35fcf6564..b68264704 100644 --- a/src/tests/behat/navigation_externallinks.feature +++ b/src/tests/behat/navigation_externallinks.feature @@ -19,9 +19,8 @@ Feature: It opens external links properly. | Test forum | student1 | Forum topic | See moodle.org external link | Scenario: Click an external link - 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 + Given I entered the forum activity "Test forum" on course "Course 1" as "student1" in the app + When 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