mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'MDL-38475_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
55a2081d28
@ -58,4 +58,23 @@ class behat_mod_forum extends behat_base {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a reply to the specified post of the specified forum. The step begins from the forum's page or from the forum's course page.
|
||||
*
|
||||
* @Given /^I reply "(?P<post_subject_string>(?:[^"]|\\")*)" post from "(?P<forum_name_string>(?:[^"]|\\")*)" forum with:$/
|
||||
* @param mixed $postname The subject of the post
|
||||
* @param mixed $forumname The forum name
|
||||
* @param TableNode $table
|
||||
*/
|
||||
public function i_reply_post_from_forum_with($postsubject, $forumname, TableNode $table) {
|
||||
|
||||
return array(
|
||||
new Given('I follow "' . $this->escape($forumname) . '"'),
|
||||
new Given('I follow "' . $this->escape($postsubject) . '"'),
|
||||
new Given('I follow "Reply"'),
|
||||
new Given('I fill the moodle form with:', $table),
|
||||
new Given('I press "Post to forum"'),
|
||||
new Given('I wait "5" seconds')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
93
mod/forum/tests/behat/discussion_display.feature
Normal file
93
mod/forum/tests/behat/discussion_display.feature
Normal file
@ -0,0 +1,93 @@
|
||||
@mod_forum
|
||||
Feature: Students can choose from 4 discussion display options and their choice is remembered
|
||||
In order to read forum posts in a suitable view
|
||||
As a moodle user
|
||||
I need to select which display method I want to use
|
||||
|
||||
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 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 |
|
||||
| Description | Test forum description |
|
||||
And I add a new discussion to "Test forum name" forum with:
|
||||
| Subject | Discussion 1 |
|
||||
| Message | Discussion contents 1, first message |
|
||||
And I reply "Discussion 1" post from "Test forum name" forum with:
|
||||
| Subject | Reply 1 to discussion 1 |
|
||||
| Message | Discussion contents 1, second message |
|
||||
And I add a new discussion to "Test forum name" forum with:
|
||||
| Subject | Discussion 2 |
|
||||
| Message | Discussion contents 2, first message |
|
||||
And I reply "Discussion 2" post from "Test forum name" forum with:
|
||||
| Subject | Reply 1 to discussion 2 |
|
||||
| Message | Discussion contents 2, second message |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
|
||||
@javascript
|
||||
Scenario: Display replies flat, with oldest first
|
||||
Given I reply "Discussion 1" post from "Test forum name" forum with:
|
||||
| Subject | Reply 2 to discussion 1 |
|
||||
| Message | Discussion contents 1, third message |
|
||||
When I select "Display replies flat, with oldest first" from "mode"
|
||||
Then I should see "Discussion contents 1, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 1, second message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element"
|
||||
And I reply "Discussion 2" post from "Test forum name" forum with:
|
||||
| Subject | Reply 2 to discussion 2 |
|
||||
| Message | Discussion contents 2, third message |
|
||||
And the "Display mode" field should match "1" value
|
||||
And I should see "Discussion contents 2, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 2, second message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Display replies flat, with newest first
|
||||
Given I reply "Discussion 1" post from "Test forum name" forum with:
|
||||
| Subject | Reply 2 to discussion 1 |
|
||||
| Message | Discussion contents 1, third message |
|
||||
When I select "Display replies flat, with newest first" from "mode"
|
||||
Then I should see "Discussion contents 1, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 1, third message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element"
|
||||
And I reply "Discussion 2" post from "Test forum name" forum with:
|
||||
| Subject | Reply 2 to discussion 2 |
|
||||
| Message | Discussion contents 2, third message |
|
||||
And the "Display mode" field should match "-1" value
|
||||
And I should see "Discussion contents 2, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 2, third message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Display replies in threaded form
|
||||
Given I follow "Test forum name"
|
||||
And I follow "Discussion 1"
|
||||
When I select "Display replies in threaded form" from "mode"
|
||||
Then I should see "Discussion contents 1, first message"
|
||||
And I should see "Reply 1 to discussion 1" in the "span.forumthread" "css_element"
|
||||
And I follow "Test forum name"
|
||||
And I follow "Discussion 2"
|
||||
And the "Display mode" field should match "2" value
|
||||
And I should see "Discussion contents 2, first message"
|
||||
And I should see "Reply 1 to discussion 2" in the "span.forumthread" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Display replies in nested form
|
||||
Given I follow "Test forum name"
|
||||
And I follow "Discussion 1"
|
||||
When I select "Display replies in nested form" from "mode"
|
||||
Then I should see "Discussion contents 1, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 1, second message" in the "div.indent div.forumpost" "css_element"
|
||||
And I follow "Test forum name"
|
||||
And I follow "Discussion 2"
|
||||
And the "Display mode" field should match "3" value
|
||||
And I should see "Discussion contents 2, first message" in the "div.firstpost.starter" "css_element"
|
||||
And I should see "Discussion contents 2, second message" in the "div.indent div.forumpost" "css_element"
|
Loading…
x
Reference in New Issue
Block a user