Merge branch 'wip-mdl-51101-m29' of git://github.com/rajeshtaneja/moodle into MOODLE_29_STABLE

This commit is contained in:
David Monllao
2015-09-14 16:18:38 +08:00
8 changed files with 50 additions and 72 deletions
@@ -1,54 +0,0 @@
@tool @tool_behat
Feature: Page contents assertions
In order to write good tests
As a tests writer
I need to check the page contents
@javascript
Scenario: Basic contents assertions
Given I log in as "admin"
And I am on site homepage
And I expand "Users" node
And I follow "Groups"
And I press "Create group"
And I set the following fields to these values:
| Group name | I'm the name |
| Group description | I'm the description |
And I press "Save changes"
When I follow "Overview"
And I wait until the page is ready
And I wait "2" seconds
And I hover "#region-main .generaltable td span" "css_element"
Then I should see "I'm the description"
And "Grouping" "select" in the "region-main" "region" should be visible
And "Group" "select" should be visible
And "Activity report" "link" in the "Administration" "block" should not be visible
And "Event monitoring rules" "link" should not be visible
And I should see "Filter groups by"
And I should not see "Filter groupssss by"
And I should see "Group members" in the "#region-main table th.c1" "css_element"
And I should not see "Group membersssss" in the "#region-main table th.c1" "css_element"
And I follow "Groups"
And the "#groupeditform #showcreateorphangroupform" "css_element" should be enabled
And the "#groupeditform #showeditgroupsettingsform" "css_element" should be disabled
@javascript
Scenario: Locators inside specific DOM nodes using CSS selectors
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
When I dock "Administration" block
Then I should not see "Question bank" in the ".block-region" "css_element"
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
@javascript
Scenario: Locators inside specific DOM nodes using XPath
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
When I dock "Administration" block
Then I should not see "Turn editing on" in the ".block-region" "css_element"
@@ -122,4 +122,40 @@ class behat_completion extends behat_base {
new Given('I press "'.get_string('savechangesanddisplay').'"')
);
}
/**
* Checks if the activity with specified name is maked as complete.
*
* @Given /^the "(?P<activityname_string>(?:[^"]|\\")*)" "(?P<activitytype_string>(?:[^"]|\\")*)" activity with "(manual|auto)" completion should be marked as complete$/
* @return array
*/
public function activity_marked_as_complete($activityname, $activitytype, $completiontype) {
if ($completiontype == "manual") {
$imgalttext = get_string("completion-alt-manual-y", 'core_completion', $activityname);
} else {
$imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname);
}
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
return new Given('"//img[contains(@alt, \''.$imgalttext.'\')]" "xpath_element" ' .
'should exist in the "'.$csselementforactivitytype.'" "css_element"');
}
/**
* Checks if the activity with specified name is maked as complete.
*
* @Given /^the "(?P<activityname_string>(?:[^"]|\\")*)" "(?P<activitytype_string>(?:[^"]|\\")*)" activity with "(manual|auto)" completion should be marked as not complete$/
* @return array
*/
public function activity_marked_as_not_complete($activityname, $activitytype, $completiontype) {
if ($completiontype == "manual") {
$imgalttext = get_string("completion-alt-manual-n", 'core_completion', $activityname);
} else {
$imgalttext = get_string("completion-alt-auto-n", 'core_completion', $activityname);
}
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
return new Given('"//img[contains(@alt, \''.$imgalttext.'\')]" "xpath_element" ' .
'should exist in the "'.$csselementforactivitytype.'" "css_element"');
}
}
@@ -22,7 +22,6 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
And I follow "Course 1"
And I turn editing mode on
@javascript
Scenario: Publish anonymous results
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
@@ -41,9 +40,8 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
And I follow "Choice 1"
Then I should not see "Student 1"
And I should not see "Users who chose this option"
And I hover ".results .graph img" "css_element"
And ".results .graph img" "css_element" should exist
@javascript
Scenario: Publish full results
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
@@ -4,7 +4,6 @@ Feature: Set a certain number of discussions as a completion condition for a for
As a 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" exist:
| username | firstname | lastname | email |
@@ -36,7 +35,7 @@ Feature: Set a certain number of discussions as a completion condition for a for
And I log out
And I log in as "student1"
And I follow "Course 1"
Then I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_forum ')]/descendant::img[@alt='Not completed: Test forum name']" "xpath_element"
Then the "Test forum name" "forum" activity with "auto" completion should be marked as not complete
And I add a new discussion to "Test forum name" forum with:
| Subject | Post 1 subject |
| Message | Body 1 content |
@@ -44,7 +43,7 @@ Feature: Set a certain number of discussions as a completion condition for a for
| Subject | Post 2 subject |
| Message | Body 2 content |
And I follow "Course 1"
And I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_forum ')]/descendant::img[contains(@alt, 'Completed: Test forum name')]" "xpath_element"
Then the "Test forum name" "forum" activity with "auto" completion should be marked as complete
And I log out
And I log in as "teacher1"
And I follow "Course 1"
@@ -4,7 +4,6 @@ Feature: Set end of lesson reached as a completion condition for a lesson
As a teacher
I need to set end of lesson reached to mark the lesson activity as completed
@javascript
Scenario: Set end reached as a condition
Given the following "users" exist:
| username | firstname | lastname | email |
@@ -39,7 +38,7 @@ Feature: Set end of lesson reached as a completion condition for a lesson
| id_answer_editor_0 | Next page |
| id_jumpto_0 | Next page |
And I press "Save page"
And I set the field "qtype" to "Add a content page"
And I select "Add a content page" from the "qtype" singleselect
And I set the following fields to these values:
| Page title | Second page name |
| Page contents | Second page contents |
@@ -51,11 +50,11 @@ Feature: Set end of lesson reached as a completion condition for a lesson
And I log out
When I log in as "student1"
And I follow "Course 1"
Then I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Not completed: Test lesson']" "xpath_element"
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And I follow "Test lesson"
And I press "Next page"
And I follow "Course 1"
And I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Not completed: Test lesson']" "xpath_element"
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And I follow "Course 1"
And I follow "Test lesson"
And I should see "You have seen more than one page of this lesson already."
@@ -64,7 +63,7 @@ Feature: Set end of lesson reached as a completion condition for a lesson
And I press "Next page"
And I press "Next page"
And I follow "Course 1"
And I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Completed: Test lesson']" "xpath_element"
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as complete
And I log out
And I log in as "teacher1"
And I follow "Course 1"
@@ -41,7 +41,7 @@ Feature: Set time spent as a completion condition for a lesson
| id_answer_editor_0 | Next page |
| id_jumpto_0 | Next page |
And I press "Save page"
And I set the field "qtype" to "Add a content page"
And I select "Add a content page" from the "qtype" singleselect
And I set the following fields to these values:
| Page title | Second page name |
| Page contents | Second page contents |
@@ -53,14 +53,14 @@ Feature: Set time spent as a completion condition for a lesson
And I log out
When I log in as "student1"
And I follow "Course 1"
Then I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Not completed: Test lesson']" "xpath_element"
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And I follow "Test lesson"
And I press "Next page"
And I press "Next page"
And I should see "You completed this lesson in"
And I should see ", which is less than the required time of 1 min. You might need to attempt the lesson again."
And I follow "Course 1"
And I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Not completed: Test lesson']" "xpath_element"
And the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And I follow "Course 1"
And I follow "Test lesson"
And I press "Next page"
@@ -68,7 +68,7 @@ Feature: Set time spent as a completion condition for a lesson
And I press "Next page"
And I should not see "You might need to attempt the lesson again."
And I follow "Course 1"
And I hover "//li[contains(concat(' ', normalize-space(@class), ' '), ' modtype_lesson ')]/descendant::img[@alt='Completed: Test lesson']" "xpath_element"
And the "Test lesson" "lesson" activity with "auto" completion should be marked as complete
And I log out
And I log in as "teacher1"
And I follow "Course 1"
@@ -35,14 +35,14 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
Scenario: student1 uses up both attempts without passing
When I log in as "student1"
And I follow "Course 1"
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element"
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And I follow "Test quiz name"
And I press "Attempt quiz now"
And I set the field "False" to "1"
And I press "Next"
And I press "Submit all and finish"
And I follow "C1"
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element"
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And I follow "Test quiz name"
And I press "Re-attempt quiz"
And I set the field "False" to "1"
@@ -35,7 +35,7 @@ Feature: Set a quiz to be marked complete when the student passes
Scenario: student1 passes on the first try
When I log in as "student1"
And I follow "Course 1"
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element"
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And I follow "Test quiz name"
And I press "Attempt quiz now"
And I set the field "True" to "1"