Skip to content

Commit

Permalink
MDL-38437 behat: Behat feature for mod_forum
Browse files Browse the repository at this point in the history
Basic add an activity, MDLQA-2 (students
can edit or delete their forum posts within
a set time limit).
  • Loading branch information
David Monllao committed Mar 27, 2013
1 parent 279d869 commit e6cb6ae
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
29 changes: 29 additions & 0 deletions mod/forum/tests/behat/add_forum.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@mod_forum
Feature: Add forum activities and discussions
In order to discuss topics with other users
As a moodle teacher
I need to add forum activities to moodle courses

@javascript
Scenario: Add a forum and a discussion
Given the following "users" exists:
| username | firstname | lastname | email |
| 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 |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
When I add a new discussion to "Test forum name" forum with:
| Subject | Forum post 1 |
| Message | This is the body |
And I wait "6" seconds
Then I should see "Test forum name"
62 changes: 62 additions & 0 deletions mod/forum/tests/behat/edit_post_student.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@mod_forum
Feature: Students can edit or delete their forum posts within a set time limit
In order to refine forum posts
As a moodle user
I need to edit or delete my forum posts within a certain period of time after posting

Background:
Given the following "users" exists:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
And the following "courses" exists:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exists:
| user | course | role |
| student1 | C1 | student |
And I log in as "admin"
And I expand "Site administration" node
And I expand "Security" node
And I follow "Site policies"
And I select "1 minutes" from "Maximum time to edit posts"
And I press "Save changes"
And I am on homepage
And I follow "Course 1"
And I turn editing mode on
And I add a "forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I log out
And I follow "Course 1"
And I log in as "student1"
And I add a new discussion to "Test forum name" forum with:
| Subject | Forum post subject |
| Message | This is the body |
And I wait "6" seconds

@javascript
Scenario: Edit forum post
When I follow "Forum post subject"
And I follow "Edit"
And I fill the moodle form with:
| Subject | Edited post subject |
| Message | Edited post body |
And I press "Save changes"
And I wait "6" seconds
Then I should see "Edited post subject"
And I should see "Edited post body"

@javascript
Scenario: Delete forum post
When I follow "Forum post subject"
And I follow "Delete"
And I press "Continue"
Then I should not see "Forum post subject"

@javascript
Scenario: Time limit expires
When I wait "70" seconds
And I follow "Forum post subject"
Then I should not see "Edit"
And I should not see "Delete"

0 comments on commit e6cb6ae

Please sign in to comment.