mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-45371 behat: Tests for block glossary_random
This commit is contained in:
parent
a929fd50f9
commit
cca6e78d87
2 changed files with 137 additions and 0 deletions
111
blocks/glossary_random/tests/behat/glossary_random.feature
Normal file
111
blocks/glossary_random/tests/behat/glossary_random.feature
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
@block @block_glossary_random
|
||||||
|
Feature: Random glossary entry block is used in a course
|
||||||
|
In order to show the entries from glossary
|
||||||
|
As a teacher
|
||||||
|
I can add the random glossary entry to a course page
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "courses" exist:
|
||||||
|
| fullname | shortname |
|
||||||
|
| Course 1 | C1 |
|
||||||
|
And the following "users" exist:
|
||||||
|
| username | firstname | lastname | email |
|
||||||
|
| student1 | Sam1 | Student1 | student1@test.com |
|
||||||
|
| teacher1 | Terry1 | Teacher1 | teacher1@test.com |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
| teacher1 | C1 | editingteacher |
|
||||||
|
|
||||||
|
Scenario: Student can not see the block if it is not configured
|
||||||
|
When I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Random glossary entry" block
|
||||||
|
Then I should see "Please configure this block using the edit icon" in the "block_glossary_random" "block"
|
||||||
|
And I log out
|
||||||
|
And I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And "block_glossary_random" "block" should not exist
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
Scenario: View random (last) entry in the glossary with auto approval
|
||||||
|
Given the following "activities" exist:
|
||||||
|
| activity | name | intro | course | idnumber | defaultapproval |
|
||||||
|
| glossary | GlossaryAuto | Test glossary description | C1 | glossary1 | 1 |
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Random glossary entry" block
|
||||||
|
And I configure the "block_glossary_random" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Title | AutoGlossaryblock |
|
||||||
|
| Take entries from this glossary | GlossaryAuto |
|
||||||
|
| How a new entry is chosen | Last modified entry |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I log out
|
||||||
|
When I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
Then I should see "There are no entries yet in the chosen glossary" in the "AutoGlossaryblock" "block"
|
||||||
|
And I click on "Add a new entry" "link" in the "AutoGlossaryblock" "block"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Concept | Concept1 |
|
||||||
|
| Definition | Definition1 |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I should see "Concept1" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should see "Definition1" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should not see "There are no entries yet in the chosen glossary" in the "AutoGlossaryblock" "block"
|
||||||
|
And I click on "Add a new entry" "link" in the "AutoGlossaryblock" "block"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Concept | Concept2 |
|
||||||
|
| Definition | Definition2 |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I follow "Course 1"
|
||||||
|
# Only the last entry appears in the block
|
||||||
|
And I should not see "Concept1" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should not see "Definition1" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should see "Concept2" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should see "Definition2" in the "AutoGlossaryblock" "block"
|
||||||
|
And I click on "View all entries" "link" in the "AutoGlossaryblock" "block"
|
||||||
|
And I should see "GlossaryAuto" in the "#page-navbar" "css_element"
|
||||||
|
And I should see "Concept1" in the "#page-content" "css_element"
|
||||||
|
And I should see "Concept2" in the "#page-content" "css_element"
|
||||||
|
And I log out
|
||||||
|
|
||||||
|
Scenario: View random (last) entry in the glossary with manual approval
|
||||||
|
Given the following "activities" exist:
|
||||||
|
| activity | name | intro | course | idnumber | defaultapproval |
|
||||||
|
| glossary | GlossaryManual | Test glossary description | C1 | glossary2 | 0 |
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I add the "Random glossary entry" block
|
||||||
|
And I configure the "block_glossary_random" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Title | ManualGlossaryblock |
|
||||||
|
| Take entries from this glossary | GlossaryManual |
|
||||||
|
| How a new entry is chosen | Last modified entry |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I log out
|
||||||
|
When I log in as "student1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
Then I should see "There are no entries yet in the chosen glossary" in the "ManualGlossaryblock" "block"
|
||||||
|
And I click on "Add a new entry" "link" in the "ManualGlossaryblock" "block"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Concept | Concept1 |
|
||||||
|
| Definition | Definition1 |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I should see "There are no entries yet in the chosen glossary" in the "ManualGlossaryblock" "block"
|
||||||
|
And I log out
|
||||||
|
And I log in as "teacher1"
|
||||||
|
And I follow "Course 1"
|
||||||
|
And I should see "There are no entries yet in the chosen glossary" in the "ManualGlossaryblock" "block"
|
||||||
|
And I follow "GlossaryManual"
|
||||||
|
And I follow "Waiting approval"
|
||||||
|
And I follow "Approve"
|
||||||
|
And I click on "Course 1" "link" in the "#page-navbar" "css_element"
|
||||||
|
And I should see "Concept1" in the "ManualGlossaryblock" "block"
|
||||||
|
And I should see "Definition1" in the "ManualGlossaryblock" "block"
|
||||||
|
And I log out
|
|
@ -0,0 +1,26 @@
|
||||||
|
@block @block_glossary_random
|
||||||
|
Feature: Random glossary entry block can be added to the frontpage
|
||||||
|
In order to show the entries from glossary on the frontpage
|
||||||
|
As a teacher
|
||||||
|
I can add the random glossary entry to the frontpage
|
||||||
|
|
||||||
|
Scenario: Admin can add random glossary block to the frontpage
|
||||||
|
Given the following "activities" exist:
|
||||||
|
| activity | name | intro | course | idnumber |
|
||||||
|
| glossary | Tips and Tricks | Frontpage glossary description | Acceptance test site | glossary0 |
|
||||||
|
And I log in as "admin"
|
||||||
|
And I click on "Turn editing on" "link" in the "Administration" "block"
|
||||||
|
And I add the "Random glossary entry" block
|
||||||
|
And I configure the "block_glossary_random" block
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Title | Tip of the day |
|
||||||
|
| Take entries from this glossary | Tips and Tricks |
|
||||||
|
And I press "Save changes"
|
||||||
|
And I click on "Add a new entry" "link" in the "Tip of the day" "block"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Concept | Never come late |
|
||||||
|
| Definition | Come in time for your classes |
|
||||||
|
And I press "Save changes"
|
||||||
|
When I log out
|
||||||
|
Then I should see "Never come late" in the "Tip of the day" "block"
|
||||||
|
And I should see "Come in time for your classes" in the "Tip of the day" "block"
|
Loading…
Add table
Add a link
Reference in a new issue