MDL-37661 behat: Test to add activities to courses
authorDavid Monllao <davidm@moodle.com>
Fri, 25 Jan 2013 08:00:14 +0000 (16:00 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Jan 2013 10:19:04 +0000 (18:19 +0800)
course/tests/behat/add_activities.feature [new file with mode: 0644]

diff --git a/course/tests/behat/add_activities.feature b/course/tests/behat/add_activities.feature
new file mode 100644 (file)
index 0000000..75eba57
--- /dev/null
@@ -0,0 +1,56 @@
+@core_course
+Feature: Add activities to courses
+  In order to provide tools for students learning
+  As a teacher
+  I need to add activites to a course
+
+  @javascript
+  Scenario: Add an activity to the course
+    Given the following "users" exists:
+      | username | firstname | lastname | email |
+      | student1 | Student | 1 | student1@asd.com |
+      | student2 | Student | 2 | student2@asd.com |
+    And the following "courses" exists:
+      | fullname | shortname | format |
+      | Course 1 | C1 | topics |
+    And the following "course enrolments" exists:
+      | user | course | role |
+      | student1 | C1 | student |
+      | student2 | C1 | student |
+    And I log in as "admin"
+    And I follow "Course 1"
+    When I turn editing mode on
+    And I add a "Database" to section "3" and I fill the form with:
+      | Name | Test name |
+      | Introduction | Test database description |
+      | Required entries | 9 |
+      | Comments | Yes |
+      | ID number | ASD123 |
+    Then I should not see "Adding a new"
+    And I follow "Test name"
+    And I follow "Edit settings"
+    And the "Name" field should match "Test name" value
+    And the "Required entries" field should match "9" value
+    And the "Comments" field should match "Yes" value
+    And the "ID number" field should match "ASD123" value
+
+  @javascript
+  Scenario: Add an activity without the required fields
+    Given the following "users" exists:
+      | username | firstname | lastname | email |
+      | student1 | Student | 1 | student1@asd.com |
+      | student2 | Student | 2 | student2@asd.com |
+    And the following "courses" exists:
+      | fullname | shortname | format |
+      | Course 1 | C1 | topics |
+    And the following "course enrolments" exists:
+      | user | course | role |
+      | student1 | C1 | student |
+      | student2 | C1 | student |
+    And I log in as "admin"
+    And I follow "Course 1"
+    When I turn editing mode on
+    And I add a "Database" to section "3" and I fill the form with:
+      | Name | Test name |
+    Then I should see "Adding a new"
+    And I should see "Required"