Skip to content

Commit

Permalink
Merge branch 'MDL-44621_master' of git://github.com/dmonllao/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Apr 17, 2014
2 parents 8416d55 + a0f59af commit 2d6221b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/behat/classes/behat_selectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class behat_selectors {
'table' => 'table',
'field' => 'field',
'fieldset' => 'fieldset',
'text' => 'text',
'css_element' => 'css_element',
'xpath_element' => 'xpath_element'
);
Expand All @@ -82,7 +83,10 @@ class behat_selectors {
* @var XPaths for moodle elements.
*/
protected static $moodleselectors = array(
'dialogue' => <<<XPATH
'text' => <<<XPATH
//*[contains(., %locator%)][count(./descendant::*[contains(., %locator%)]) = 0]
XPATH
, 'dialogue' => <<<XPATH
//div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue ') and
normalize-space(descendant::div[
contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-hd ')
Expand Down
71 changes: 71 additions & 0 deletions mod/data/tests/behat/view_entries.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@mod @mod_data
Feature: Users can view and search database entries
In order to find the database entries that I am looking for
As a user
I need to list and search the database entries

Scenario: Students can add view, list and search entries
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Test database name | n | C1 | data1 |
And I log in as "teacher1"
And I follow "Course 1"
And I add a "Text input" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
# To generate the default templates.
And I follow "Templates"
And I add an entry to "Test database name" database with:
| Test field description | Teacher entry 1 |
And I press "Save and add another"
And I add an entry to "Test database name" database with:
| Test field description | Teacher entry 2 |
And I press "Save and add another"
And I add an entry to "Test database name" database with:
| Test field description | Teacher entry 3 |
And I press "Save and view"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Test database name"
Then I should see "Teacher entry 1"
And I should see "Teacher entry 2"
And I should see "Teacher entry 3"
And I follow "View single"
And I should see "Teacher entry 1"
And I should not see "Teacher entry 2"
And "2" "link" should exist
And "3" "link" should exist
And I follow "Next"
And I should see "Teacher entry 2"
And I should not see "Teacher entry 1"
And I follow "3"
And I should see "Teacher entry 3"
And I should not see "Teacher entry 2"
And I follow "Previous"
And I should see "Teacher entry 2"
And I should not see "Teacher entry 1"
And I should not see "Teacher entry 3"
And I follow "Search"
And I set the field "Test field name" to "Teacher entry 1"
And I press "Save settings"
And I should see "Teacher entry 1"
And I should not see "Teacher entry 2"
And I should not see "Teacher entry 3"
And I follow "Search"
And I set the field "Test field name" to "Teacher entry"
And I set the field "Order" to "Descending"
And I press "Save settings"
And "Teacher entry 3" "text" should appear before "Teacher entry 2" "text"
And "Teacher entry 2" "text" should appear before "Teacher entry 1" "text"

0 comments on commit 2d6221b

Please sign in to comment.