From be0e1825d35032e75b8579393f3953f689dc35b7 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 1 Apr 2013 17:52:46 +0800 Subject: [PATCH] MDL-38823 behat: New test According to MDLQA-521, a teacher can set a certain number of discussions as a completion condition for a forum. --- ...etion_condition_number_discussions.feature | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 mod/forum/tests/behat/completion_condition_number_discussions.feature diff --git a/mod/forum/tests/behat/completion_condition_number_discussions.feature b/mod/forum/tests/behat/completion_condition_number_discussions.feature new file mode 100644 index 00000000000..eb0c914b848 --- /dev/null +++ b/mod/forum/tests/behat/completion_condition_number_discussions.feature @@ -0,0 +1,54 @@ +@mod_forum +Feature: Set a certain number of discussions as a completion condition for a forum + In order to ensure students are participating on forums + As a moodle teacher + I need to set a minimum number of discussions to mark the forum activity as completed + + @javascript + Scenario: Set X number of discussions as a condition + Given the following "users" exists: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@asd.com | + | teacher1 | Teacher | 1 | teacher1@asd.com | + And the following "courses" exists: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exists: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And I log in as "admin" + And I set the following administration settings values: + | Enable completion tracking | 1 | + | Enable conditional access | 1 | + And I log out + And I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I follow "Edit settings" + And I fill the moodle form with: + | Completion tracking | Enabled, control via completion and activity settings | + | Completion tracking begins on enrolment | 1 | + And I press "Save changes" + When I add a "Forum" to section "1" and I fill the form with: + | Forum name | Test forum name | + | Description | Test forum description | + | Completion tracking | Show activity as complete when conditions are met | + | completiondiscussionsenabled | 1 | + | completiondiscussions | 2 | + And I log out + And I log in as "student1" + And I follow "Course 1" + Then I hover "//li[contains(concat(' ', @class, ' '), ' modtype_forum ')]/descendant::img[@alt='Not completed: Test forum name']" "xpath_element" + And I add a new discussion to "Test forum name" forum with: + | Subject | Post 1 subject | + | Message | Body 1 content | + And I add a new discussion to "Test forum name" forum with: + | Subject | Post 2 subject | + | Message | Body 2 content | + And I follow "Course 1" + And I hover "//li[contains(concat(' ', @class, ' '), ' modtype_forum ')]/descendant::img[contains(@alt, 'Completed: Test forum name')]" "xpath_element" + And I log out + And I log in as "teacher1" + And I follow "Course 1" + And "Student 1" user has completed "Test forum name" activity -- 2.43.0