| Server IP : 104.21.80.248 / Your IP : 162.159.115.42 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/myschool/triamudom/tuprblearn/course/tests/behat/ |
Upload File : |
@core @core_course
Feature: Test if displaying the course contacts works correctly:
As a user I need to see the course contacts of a course.
As an admin I need to be able to control the appearance of the course contacts.
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | CAT1 | topics |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | [email protected] |
| teacher2 | Teacher | 2 | [email protected] |
| teacher3 | Teacher | 3 | [email protected] |
| manager1 | Manager | 1 | [email protected] |
| student1 | Student | 1 | [email protected] |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C1 | teacher |
| teacher2 | C1 | teacher |
| teacher3 | C1 | editingteacher |
| manager1 | C1 | manager |
Scenario: Test general course contacts functionality for all user roles
Given I log in as "admin"
And I navigate to "Appearance > Courses" in site administration
And I set the following fields to these values:
| Manager | 0 |
| Teacher | 1 |
| Non-editing teacher | 0 |
| Display all course contact roles | 0 |
And I press "Save changes"
When I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher 2" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
When I log out
And I log in as "manager1"
And I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher 2" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
When I log out
And I log in as "teacher1"
And I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher 2" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
When I log out
And I log in as "student1"
And I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher 2" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
Scenario: Test course contact roles without displaying all roles
Given I log in as "admin"
And I navigate to "Appearance > Courses" in site administration
And I set the following fields to these values:
| Manager | 0 |
| Teacher | 1 |
| Non-editing teacher | 1 |
| Display all course contact roles | 0 |
And I press "Save changes"
When I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should see "Teacher 2" in the ".teachers" "css_element"
And I should see "Teacher 3" in the ".teachers" "css_element"
And I should see "Teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher, Non-editing teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
Scenario: Test course contact roles with displaying all roles and standard sorting
Given I log in as "admin"
And I navigate to "Appearance > Courses" in site administration
And I set the following fields to these values:
| Manager | 0 |
| Teacher | 1 |
| Non-editing teacher | 1 |
| Display all course contact roles | 1 |
And I press "Save changes"
When I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should see "Teacher 2" in the ".teachers" "css_element"
And I should see "Teacher 3" in the ".teachers" "css_element"
And I should see "Teacher, Non-editing teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
And I should see teacher "Teacher 1" before "Teacher 3" in the course contact listing
And I should see teacher "Teacher 3" before "Teacher 2" in the course contact listing
And I should not see teacher "Teacher 1" after "Teacher 3" in the course contact listing
And I should not see teacher "Teacher 3" after "Teacher 2" in the course contact listing
Scenario: Test course contact roles with displaying all roles and modified sorting
Given I log in as "admin"
And I navigate to "Appearance > Courses" in site administration
And I set the following fields to these values:
| Manager | 0 |
| Teacher | 1 |
| Non-editing teacher | 1 |
| Display all course contact roles | 1 |
And I press "Save changes"
And I navigate to "Users > Permissions > Define roles" in site administration
And I click on "Move up" "link" in the "//td[text()[contains(.,'Non-editing teacher')]]/parent::tr/td[contains(@class, 'lastcol')]" "xpath_element"
When I am on course index
And I should see "Cat 1" in the "#region-main" "css_element"
And I follow "Cat 1"
And I wait until the page is ready
And I should see "Course 1" in the "#region-main" "css_element"
Then I should see "Teacher 1" in the ".teachers" "css_element"
And I should see "Teacher 2" in the ".teachers" "css_element"
And I should see "Teacher 3" in the ".teachers" "css_element"
And I should see "Non-editing teacher, Teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Non-editing teacher: Teacher 1" in the ".teachers" "css_element"
And I should not see "Manager 1" in the ".teachers" "css_element"
And I should see teacher "Teacher 1" before "Teacher 2" in the course contact listing
And I should see teacher "Teacher 2" before "Teacher 3" in the course contact listing
And I should not see teacher "Teacher 1" after "Teacher 2" in the course contact listing
And I should not see teacher "Teacher 2" after "Teacher 3" in the course contact listing