first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related to mod_quiz.
*
* @package mod_wiki
* @category test
* @copyright 2023 Catalyst IT Europe Ltd.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
use Behat\Gherkin\Node\TableNode as TableNode;
use Behat\Mink\Exception\ExpectationException as ExpectationException;
/**
* Steps definitions related to mod_wiki.
*
* @copyright 2023 Catalyst IT Europe Ltd.
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_wiki extends behat_base {
/**
* Add the specified pages to the specified wiki
*
* The first row should be column names:
* | wiki | user | group | title | content |
*
*
* wiki idnumber of the wiki course module
* user username of the user who is creating the page
* group (optional) idnumber of the group the page belongs to
* title (optional) the title text of the page
* content (optional) the content of the page
*
* @param TableNode $data The pages to add
*
* @Given /^the following wiki pages exist:$/
*/
public function the_following_wiki_pages_exist(TableNode $data): void {
global $DB;
$generator = behat_util::get_data_generator()->get_plugin_generator('mod_wiki');
// Add the pages.
foreach ($data->getHash() as $pagedata) {
if (!array_key_exists('wiki', $pagedata)) {
throw new ExpectationException('When adding pages to a wiki, ' .
'the wiki column is required containing the wiki idnumber.', $this->getSession());
}
$wikicm = $this->get_course_module_for_identifier($pagedata['wiki']);
$wiki = $DB->get_record('wiki', ['id' => $wikicm->instance]);
$wiki->cmid = $wikicm->cmid;
$pagedata['wikiid'] = $wiki->id;
unset($pagedata['wiki']);
if (array_key_exists('group', $pagedata)) {
$pagedata['group'] = $DB->get_field('groups', 'id', ['idnumber' => $pagedata['group']], MUST_EXIST);
}
if (array_key_exists('user', $pagedata)) {
$pagedata['userid'] = $DB->get_field('user', 'id', ['username' => $pagedata['user']], MUST_EXIST);
unset($pagedata['user']);
}
$generator->create_page($wiki, $pagedata);
}
}
}
@@ -0,0 +1,67 @@
@mod @mod_wiki
Feature: A teacher can set a wiki to be collaborative or individual
In order to allow both collaborative wikis and individual journals with history register
As a teacher
I need to select whether the wiki is collaborative or individual
@javascript
Scenario: Collaborative and individual wikis
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.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 |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | name | firstpagetitle | wikimode |
| wiki | C1 | Collaborative wiki name | Collaborative index | collaborative |
| wiki | C1 | Individual wiki name | Individual index | individual |
And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | Collaborative teacher1 edition |
And I press "Save"
And I am on the "Individual wiki name" "wiki activity" page
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual teacher1 edition |
And I press "Save"
And I am on the "Collaborative wiki name" "wiki activity" page logged in as student1
Then I should see "Collaborative teacher1 edition"
And I select "Edit" from the "jump" singleselect
And I set the following fields to these values:
| HTML format | Collaborative student1 edition |
And I press "Save"
And I should not see "Collaborative teacher1 edition"
And I should see "Collaborative student1 edition"
And I am on the "Individual wiki name" "wiki activity" page
And I should not see "Individual teacher1 edition"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual student1 edition |
And I press "Save"
And I am on the "Individual wiki name" "wiki activity" page logged in as student2
And I should not see "Individual teacher1 edition"
And I should not see "Individual student1 edition"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual student2 edition |
And I press "Save"
And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1
And I should see "Collaborative student1 edition"
And I am on the "Individual wiki name" "wiki activity" page
And I should see "Individual teacher1 edition"
And I should not see "Individual student1 edition"
And I set the field "uid" to "Student 1"
And I should see "Individual student1 edition"
And I should not see "Individual teacher1 edition"
And I set the field "uid" to "Student 2"
And I should see "Individual student2 edition"
And I should not see "Individual teacher1 edition"
+66
View File
@@ -0,0 +1,66 @@
@mod @mod_wiki @core_tag @javascript
Feature: Edited wiki pages handle tags correctly
In order to get wiki pages properly labelled
As a user
I need to introduce the tags while editing
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.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 "activity" exists:
| course | C1 |
| activity | wiki |
| name | Test wiki name |
| firstpagetitle | First page |
| wikimode | collaborative |
Scenario: Wiki page edition of custom tags works as expected
Given I am on the "Test wiki name" "wiki activity" page logged in as student1
And I press "Create page"
When I set the following fields to these values:
| HTML format | Student page contents to be tagged |
| Tags | Example, Page, Cool |
And I press "Save"
Then I should see "Example" in the ".wiki-tags" "css_element"
And I should see "Page" in the ".wiki-tags" "css_element"
And I should see "Cool" in the ".wiki-tags" "css_element"
And I select "Edit" from the "jump" singleselect
Then I should see "Example" in the ".form-autocomplete-selection" "css_element"
Then I should see "Page" in the ".form-autocomplete-selection" "css_element"
Then I should see "Cool" in the ".form-autocomplete-selection" "css_element"
And I press "Cancel"
@javascript
Scenario: Wiki page edition of standard tags works as expected
Given the following "tags" exist:
| name | isstandard |
| OT1 | 1 |
| OT2 | 1 |
| OT3 | 1 |
And I am on the "Test wiki name" "wiki activity" page logged in as student1
And I press "Create page"
And I open the autocomplete suggestions list
And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element"
And I should see "OT2" in the ".form-autocomplete-suggestions" "css_element"
And I should see "OT3" in the ".form-autocomplete-suggestions" "css_element"
When I set the following fields to these values:
| HTML format | Student page contents to be tagged |
| Tags | OT1, OT3 |
And I press "Save"
Then I should see "OT1" in the ".wiki-tags" "css_element"
And I should see "OT3" in the ".wiki-tags" "css_element"
And I should not see "OT2" in the ".wiki-tags" "css_element"
And I select "Edit" from the "jump" singleselect
And I should see "OT1" in the ".form-autocomplete-selection" "css_element"
And I should see "OT3" in the ".form-autocomplete-selection" "css_element"
And I should not see "OT2" in the ".form-autocomplete-selection" "css_element"
And I press "Cancel"
+63
View File
@@ -0,0 +1,63 @@
@mod @mod_wiki
Feature: A history of each wiki page is available
In order to know how a wiki page evolved over the time and how changed what
As a user
I need to check the history of a wiki page
@javascript
Scenario: Wiki page edition history changes list
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.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 |
| student2 | C1 | student |
And the following "activity" exists:
| course | C1 |
| activity | wiki |
| name | Test wiki name |
| firstpagetitle | First page |
| wikimode | collaborative |
And I am on the "Test wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | First edition |
And I press "Save"
When I am on the "Test wiki name" "wiki activity" page logged in as student1
And I select "Edit" from the "jump" singleselect
And I set the following fields to these values:
| HTML format | Second edition |
And I press "Save"
When I am on the "Test wiki name" "wiki activity" page logged in as student2
And I select "Edit" from the "jump" singleselect
And I set the following fields to these values:
| HTML format | Third edition |
And I press "Save"
And I select "History" from the "jump" singleselect
# Checking that there are 3 history items (the first one is are th)
And "//*[@id='region-main']/descendant::table/descendant::tr[4]" "xpath_element" should exist
And I click on "1" "link" in the "Teacher 1" "table_row"
And I should see "First edition"
And I should see "Teacher 1"
And I follow "Back"
And I click on "2" "link" in the "Student 1" "table_row"
And I should see "Second edition"
And I should see "Student 1"
And I follow "Back"
And I click on "3" "link" in the "Student 2" "table_row"
And I should see "Third edition"
And I should see "Student 2" in the "region-main" "region"
And I follow "Back"
And I click on "comparewith" "radio" in the "Student 1" "table_row"
And I click on "compare" "radio" in the "Teacher 1" "table_row"
And I press "Compare selected"
And I should see "Comparing version 1 with version 3"
And I follow "Next"
And I should see "Comparing version 2 with version 3"
+43
View File
@@ -0,0 +1,43 @@
@mod @mod_wiki
Feature: Edited wiki pages may be previewed before saving
In order to avoid silly mistakes
As a user
I need to preview pages before saving changes
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.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 "activity" exists:
| activity | wiki |
| course | C1 |
| name | Test wiki name |
| wikimode | collaborative |
And I am on the "Test wiki name" "wiki activity" page logged in as student1
When I press "Create page"
And I set the following fields to these values:
| HTML format | Student page contents to be previewed |
And I press "Preview"
Then I expand all fieldsets
And I should see "This is a preview. Changes have not been saved yet"
And I should see "Student page contents to be previewed"
And I press "Save"
And I should see "Student page contents to be previewed"
And I select "Edit" from the "jump" singleselect
@javascript
Scenario: Page contents preview before saving with Javascript enabled
Then the field "HTML format" matches value "Student page contents to be previewed"
And I press "Cancel"
Scenario: Page contents preview before saving with Javascript disabled
Then the field "HTML format" matches value "Student page contents to be previewed"
And I press "Cancel"
@@ -0,0 +1,93 @@
@mod @mod_wiki @javascript @_file_upload
Feature: Teachers can reset wiki pages, tags and files
In order to remove wiki pages, tags and files
As a teacher
I need to be able to reset the pages, tags and files on the course level
Background: Create a wiki, add a page, tag and file, and reset them
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.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 |
And the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Test wiki name |
| wikimode | collaborative |
And I am on the "Test wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | Test wiki content |
| Tags | Test tag 1, Test tag 2, |
And I press "Save"
And I should see "Test tag 1" in the ".wiki-tags" "css_element"
And I should see "Test tag 2" in the ".wiki-tags" "css_element"
And I select "Comments" from the "jump" singleselect
And I follow "Add comment"
And I set the following fields to these values:
| Comment | Test comment |
And I press "Save changes"
And I should see "Test comment"
And I select "Files" from the "jump" singleselect
And I press "Edit wiki files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I should see "empty.txt"
And I am on the "Course 1" "reset" page
Scenario: Reset page, tags and files
Given I set the following fields to these values:
| Delete all wiki pages | 1 |
| Remove all wiki tags | 1 |
| reset_wiki_comments | 1 |
And I press "Reset course"
And I should see "Delete all wiki pages"
And I should see "Wiki tags have been deleted"
And I should see "Delete all comments"
And I press "Continue"
And I am on the "Test wiki name" "wiki activity" page
And I press "Create page"
When I select "View" from the "jump" singleselect
Then I should not see "Test tag 1"
And I should not see "Test tag 2"
And I select "Comments" from the "jump" singleselect
And I should not see "Test comment"
And I select "Files" from the "jump" singleselect
And I should not see "empty.txt"
Scenario: Reset only tags
Given I set the following fields to these values:
| Remove all wiki tags | 1 |
When I press "Reset course"
And I should not see "Delete all wiki pages"
And I should see "Wiki tags have been deleted"
And I should not see "Delete all comments"
And I press "Continue"
And I am on the "Test wiki name" "wiki activity" page
Then I should not see "Test tag 1"
And I should not see "Test tag 2"
And I select "Comments" from the "jump" singleselect
And I should see "Test comment"
And I select "Files" from the "jump" singleselect
And I should see "empty.txt"
Scenario: Reset only comments
Given I set the following fields to these values:
| reset_wiki_comments | 1 |
When I press "Reset course"
And I should not see "Delete all wiki pages"
And I should not see "Wiki tags have been deleted"
And I should see "Delete all comments"
And I press "Continue"
And I am on the "Test wiki name" "wiki activity" page
Then I should see "Test tag 1"
And I should see "Test tag 2"
And I select "Comments" from the "jump" singleselect
And I should not see "Test comment"
And I select "Files" from the "jump" singleselect
And I should see "empty.txt"
@@ -0,0 +1,62 @@
@mod @mod_wiki @core_completion
Feature: View activity completion information in the Wiki activity
In order to have visibility of wiki completion requirements
As a student
I need to be able to view my wiki completion progress
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Vinnie | Student1 | student1@example.com |
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | enablecompletion | showcompletionconditions |
| Course 1 | C1 | 1 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | wiki |
| course | C1 |
| idnumber | mh1 |
| name | Music history |
| completion | 2 |
| completionview | 1 |
And I am on the "Music history" "wiki activity" page logged in as teacher1
And I click on "Create page" "button"
Scenario: View automatic completion items as a teacher and confirm all tabs display conditions
When I am on the "Music history" "wiki activity" page logged in as teacher1
Then "Music history" should have the "View" completion condition
And I select "Edit" from the "jump" singleselect
And "Music history" should have the "View" completion condition
And I select "Comments" from the "jump" singleselect
And "Music history" should have the "View" completion condition
And I select "Map" from the "jump" singleselect
And "Music history" should have the "View" completion condition
And I select "Files" from the "jump" singleselect
And "Music history" should have the "View" completion condition
And I select "Administration" from the "jump" singleselect
And "Music history" should have the "View" completion condition
Scenario: View automatic completion items as a student
When I am on the "Music history" "wiki activity" page logged in as student1
Then the "View" completion condition of "Music history" is displayed as "done"
@javascript
Scenario: Use manual completion
Given I am on the "Music history" "wiki activity" page logged in as teacher1
And I am on the "Music history" "wiki activity editing" page
And I expand all fieldsets
And I press "Unlock completion settings"
And I expand all fieldsets
And I set the field "Students must manually mark the activity as done" to "1"
And I press "Save and display"
# Teacher view.
And the manual completion button for "Music history" should be disabled
# Student view.
When I am on the "Music history" "wiki activity" page logged in as student1
Then the manual completion button of "Music history" is displayed as "Mark as done"
And I toggle the manual completion state of "Music history"
And the manual completion button of "Music history" is displayed as "Done"
@@ -0,0 +1,65 @@
@mod @mod_wiki
Feature: Users can comment on wiki pages
In order to discuss wiki pages
As a user
I need to be able to comment on wiki pages as well as editing and deleting comments
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.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 |
| student2 | C1 | student |
And the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Test wiki name |
| firstpagetitle | First page |
| wikimode | collaborative |
And I am on the "Test wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | First edition |
And I press "Save"
And I am on the "Test wiki name" "wiki activity" page logged in as student1
And I select "Comments" from the "jump" singleselect
And I follow "Add comment"
And I set the following fields to these values:
| Comment | student 1 original comment |
And I press "Save"
And I wait to be redirected
@javascript
Scenario: Student can edit and delete their own comment
When I click on "Edit" "link" in the "wiki-comments" "table"
And I set the following fields to these values:
| Comment | student 1 updated comment |
And I press "Save"
Then I should see "student 1 updated comment"
And "Edit" "link" should exist in the "wiki-comments" "table"
And "Delete" "link" should exist in the "wiki-comments" "table"
And I click on "Delete" "link" in the "wiki-comments" "table"
And I press "Continue"
And I should not see "student 1 updated comment"
@javascript
Scenario: Student cannot edit another student's comment
When I am on the "Test wiki name" "wiki activity" page logged in as student2
And I select "Comments" from the "jump" singleselect
Then "Edit" "link" should not exist in the "wiki-comments" "table"
And "Delete" "link" should not exist in the "wiki-comments" "table"
@javascript
Scenario: Teacher can delete a student comment
When I am on the "Test wiki name" "wiki activity" page logged in as teacher1
And I select "Comments" from the "jump" singleselect
Then "Edit" "link" should not exist in the "wiki-comments" "table"
And "Delete" "link" should exist in the "wiki-comments" "table"
+73
View File
@@ -0,0 +1,73 @@
@mod @mod_wiki
Feature: There is a choice of formats for editing a wiki page
In order to allow users to use their favorite wiki format
As a user
I need to choose which wiki format do I want to use
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.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 |
And the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Test wiki name |
| wikimode | collaborative |
| firstpagetitle | First page |
And I am on the "Test wiki name" "wiki activity" page logged in as teacher1
@javascript
Scenario: Creole format
When I set the following fields to these values:
| Creole format | 1 |
And I press "Create page"
Then "div.wikieditor-toolbar" "css_element" should exist
# Click on bold, italic, interal link and H1
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[1]" "xpath_element"
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[2]" "xpath_element"
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[4]" "xpath_element"
And the field "newcontent" matches value "**Bold text**//Italic text//[[Internal link]]"
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[8]" "xpath_element"
And I press "Save"
And I should see "Bold textItalic textInternal link"
And I should see "Level 1 Header"
And I should see "Table of contents"
And I click on "Level 1 Header" "link" in the ".wiki-toc" "css_element"
And I follow "Internal link"
And I should see "New page title"
@javascript
Scenario: NWiki format
When I set the following fields to these values:
| NWiki format | 1 |
And I press "Create page"
Then "div.wikieditor-toolbar" "css_element" should exist
# Click on italic, interal link and H1
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[2]" "xpath_element"
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[4]" "xpath_element"
And the field "newcontent" matches value "'''Italic text'''[[Internal link]]"
And I click on "//div[@class='wikieditor-toolbar']/descendant::a[8]" "xpath_element"
And I press "Save"
And I should see "Italic textInternal link"
And I should see "Level 1 Header"
And I should see "Table of contents"
And I click on "Level 1 Header" "link" in the ".wiki-toc" "css_element"
And I follow "Internal link"
And I should see "New page title"
@javascript
Scenario: HTML format
When I set the following fields to these values:
| HTML format | 1 |
And I press "Create page"
Then "#id_newcontent_editor" "css_element" should exist
And I set the following fields to these values:
| HTML format | I'm a text |
And I press "Save"
And I should see "I'm a text"
+112
View File
@@ -0,0 +1,112 @@
@mod @mod_wiki
Feature: Groups can have separate content on a wiki
In order to create a wiki with my group
As a user
I need to view and add wiki pages by group
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student1@example.com |
| student4 | Student | 4 | student2@example.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 |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
Given the following "groups" exist:
| name | course | idnumber | participation |
| Group 1 | C1 | G1 | 1 |
| Group 2 | C1 | G2 | 1 |
| Group 3 | C1 | G3 | 0 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
| student3 | G3 |
And the following "activities" exist:
| activity | course | name | idnumber | wikimode | firstpagetitle | groupmode |
| wiki | C1 | Separate wiki | wiki1 | collaborative | Separate page 1 | 1 |
| wiki | C1 | Visible wiki | wiki2 | collaborative | Visible page 1 | 2 |
And the following wiki pages exist:
| wiki | title | content | group |
| wiki1 | Separate page 1 | Group 1 page | G1 |
| wiki1 | Separate page 1 | Group 2 page | G2 |
| wiki2 | Visible page 1 | Group 1 page | G1 |
| wiki2 | Visible page 1 | Group 2 page | G2 |
And the following wiki pages exist:
| wiki | title | content |
| wiki1 | Separate page 1 | No group page |
| wiki2 | Visible page 1 | No group page |
Scenario Outline: Teacher can see all participation group wikis
Given I am on the "<wiki>" "wiki activity" page logged in as teacher1
And I should see "All participants" in the "<mode> groups" "select"
And I should see "Group 1" in the "<mode> groups" "select"
And I should see "Group 2" in the "<mode> groups" "select"
And I should not see "Group 3" in the "<mode> groups" "select"
And I should see "No group page"
And I should not see "Group 1 page"
And I should not see "Group 2 page"
When I select "Group 1" from the "<mode> groups" singleselect
Then I should not see "No group page"
And I should see "Group 1 page"
And I should not see "Group 2 page"
Examples:
| wiki | mode |
| wiki1 | Separate |
| wiki2 | Visible |
Scenario Outline: Teacher can add a page to any participation group's wiki
Given I am on the "<wiki>" "wiki activity" page logged in as teacher1
And I select "Edit" from the "jump" singleselect
And I set the field "HTML format" to "[[Internal link]]"
And I press "Save"
When I follow "Internal link"
And I should see "New page"
Then I should see "All participants" in the "Group" "select"
And I should see "Group 1" in the "Group" "select"
And I should see "Group 2" in the "Group" "select"
And I should not see "Group 3" in the "Group" "select"
Examples:
| wiki |
| wiki1 |
| wiki2 |
Scenario Outline: Students should only see their participation groups' own wiki in separate groups mode
Given I am on the "wiki1" "wiki activity" page logged in as <user>
Then I should see "Separate groups: <group>"
And "Separate groups" "select" should not exist
And I should see "<page>"
Examples:
| user | group | page |
| student1 | Group 1 | Group 1 page |
| student2 | Group 2 | Group 2 page |
# The view page throws an exception if the user is not in a group, so we cannot test
# student3 and student4.
Scenario Outline: Students can see all participation groups' own wikis in visible groups mode
Given I am on the "wiki2" "wiki activity" page logged in as <user>
And I should see "All participants" in the "Visible groups" "select"
And I should see "Group 1" in the "Visible groups" "select"
And I should see "Group 2" in the "Visible groups" "select"
And I should not see "Group 3" in the "Visible groups" "select"
And I should see "<page>"
Examples:
| user | page |
| student1 | Group 1 page |
| student2 | Group 2 page |
| student3 | Group 1 page |
| student4 | Group 1 page |
+158
View File
@@ -0,0 +1,158 @@
@mod @mod_wiki
Feature: Users can search wikis
In order to find information in wiki
As a user
I need to be able to search individual and collaborative wikis
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.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 |
| student2 | C1 | student |
@javascript
Scenario: Searching collaborative wiki
Given the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Collaborative wiki name |
| wikimode | collaborative |
| firstpagetitle | First page |
And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | Collaborative teacher1 page [[new page]] |
And I press "Save"
And I am on the "Collaborative wiki name" "wiki activity" page logged in as student1
And I follow "new page"
And I press "Create page"
And I set the following fields to these values:
| HTML format | New page created by student1 |
And I press "Save"
When I set the field "searchstring" to "page"
And I press "Search wikis"
Then I should see "New page created by student1"
And I should see "Collaborative teacher1 page"
And I set the field "searchstring" to "teacher1"
And I press "Search wikis"
And I should not see "New page created by student1"
And I should see "Collaborative teacher1 page"
And I set the field "searchstring" to "teacher1 page"
And I press "Search wikis"
And I should not see "New page created by student1"
And I should see "Collaborative teacher1 page"
@javascript
Scenario: Searching individual wiki
Given the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Individual wiki name |
| wikimode | individual |
| firstpagetitle | First page |
And I am on the "Individual wiki name" "wiki activity" page logged in as teacher1
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual teacher1 page |
And I press "Save"
And I am on the "Individual wiki name" "wiki activity" page logged in as student1
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual student1 page |
And I press "Save"
When I set the field "searchstring" to "page"
And I press "Search wikis"
Then I should see "Individual student1 page"
And I should not see "Individual teacher1 page"
And I am on the "Individual wiki name" "wiki activity" page logged in as student2
And I press "Create page"
And I set the following fields to these values:
| HTML format | Individual student2 page |
And I press "Save"
And I set the field "searchstring" to "page"
And I press "Search wikis"
And I should see "Individual student2 page"
And I should not see "Individual student1 page"
And I should not see "Individual teacher1 page"
And I am on the "Individual wiki name" "wiki activity" page logged in as teacher1
And I set the field "searchstring" to "page"
And I press "Search wikis"
And I should see "Individual teacher1 page"
And I should not see "Individual student1 page"
And I should not see "Individual student2 page"
And I set the field "uid" to "Student 1"
And I should not see "Individual teacher1 page"
And I should see "Individual student1 page"
And I should not see "Individual student2 page"
And I set the field "uid" to "Student 2"
And I should not see "Individual teacher1 page"
And I should not see "Individual student1 page"
And I should see "Individual student2 page"
@javascript
Scenario: Searching group wiki
Given the following "groups" exist:
| name | course | idnumber |
| Group1 | C1 | G1 |
| Group2 | C1 | G2 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
Given the following "activity" exists:
| activity | wiki |
| course | C1 |
| name | Group wiki name |
| wikimode | collaborative |
| firstpagetitle | Groups pag |
| groupmode | 1 |
And I am on the "Group wiki name" "wiki activity" page logged in as teacher1
And I set the field "Group" to "All participants"
And I press "Create page"
And I set the following fields to these values:
| HTML format | All participants teacher1 page |
And I press "Save"
And I set the field "group" to "Group1"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Group1 teacher1 page [[new page1]] |
And I press "Save"
And I set the field "group" to "Group2"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Group2 teacher1 page [[new page2]] |
And I press "Save"
And I am on the "Group wiki name" "wiki activity" page logged in as student1
And I follow "new page1"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Group1 student1 new page |
And I press "Save"
When I set the field "searchstring" to "page"
And I press "Search wikis"
Then I should see "Group1 teacher1 page"
And I should not see "Group2 teacher1 page"
And I should see "Group1 student1 new page"
And I should not see "All participants teacher1 page"
And I am on the "Group wiki name" "wiki activity" page logged in as student2
And I follow "new page2"
And I press "Create page"
And I set the following fields to these values:
| HTML format | Group2 student2 new page |
And I press "Save"
And I set the field "searchstring" to "page"
And I press "Search wikis"
And I should not see "Group1 teacher1 page"
And I should see "Group2 teacher1 page"
And I should not see "Group1 student1 new page"
And I should not see "All participants teacher1 page"
And I should see "Group2 student2 new page"