Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/httpdocs/new/moodle/enrol/manual/tests/behat/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/httpdocs/new/moodle/enrol/manual/tests/behat/quickenrolment.feature

@enrol @enrol_manual
Feature: Teacher can search and enrol users one by one into the course
  In order to quickly enrol particular students into my course
  As a teacher
  I can search for the students and enrol them into the course

  Background:
    Given the following "custom profile fields" exist:
      | datatype | shortname  | name           |
      | text     | customid   | Custom user id |
    And the following "users" exist:
      | username    | firstname | lastname | email                   | profile_field_customid |
      | teacher001  | Teacher   | 001      | [email protected]  |                        |
      | student001  | Student   | 001      | [email protected]  | Q994                   |
      | student002  | Student   | 002      | [email protected]  | Q008                   |
      | student003  | Student   | 003      | [email protected]  | Z442                   |
      | student004  | Student   | 004      | [email protected]  |                        |
      | student005  | Student   | 005      | [email protected]  |                        |
      | student006  | Student   | 006      | [email protected]  |                        |
      | student007  | Student   | 007      | [email protected]  |                        |
      | student008  | Student   | 008      | [email protected]  |                        |
      | student009  | Student   | 009      | [email protected]  |                        |
      | student010  | Student   | 010      | [email protected]  |                        |
      | student011  | Student   | 011      | [email protected]  |                        |
      | student012  | Student   | 012      | [email protected]  |                        |
      | student013  | Student   | 013      | [email protected]  |                        |
      | student014  | Student   | 014      | [email protected]  |                        |
      | student015  | Student   | 015      | [email protected]  |                        |
      | student016  | Student   | 016      | [email protected]  |                        |
      | student017  | Student   | 017      | [email protected]  |                        |
      | student018  | Student   | 018      | [email protected]  |                        |
      | student019  | Student   | 019      | [email protected]  |                        |
      | student020  | Student   | 020      | [email protected]  |                        |
      | student021  | Student   | 021      | [email protected]  |                        |
      | student022  | Student   | 022      | [email protected]  |                        |
      | student023  | Student   | 023      | [email protected]  |                        |
      | student024  | Student   | 024      | [email protected]  |                        |
      | student025  | Student   | 025      | [email protected]  |                        |
      | student026  | Student   | 026      | [email protected]  |                        |
      | student027  | Student   | 027      | [email protected]  |                        |
      | student028  | Student   | 028      | [email protected]  |                        |
      | student029  | Student   | 029      | [email protected]  |                        |
      | student030  | Student   | 030      | [email protected]  |                        |
      | student031  | Student   | 031      | [email protected]  |                        |
      | student032  | Student   | 032      | [email protected]  |                        |
      | student033  | Student   | 033      | [email protected]  |                        |
      | student034  | Student   | 034      | [email protected]  |                        |
      | student035  | Student   | 035      | [email protected]  |                        |
      | student036  | Student   | 036      | [email protected]  |                        |
      | student037  | Student   | 037      | [email protected]  |                        |
      | student038  | Student   | 038      | [email protected]  |                        |
      | student039  | Student   | 039      | [email protected]  |                        |
      | student040  | Student   | 040      | [email protected]  |                        |
      | student041  | Student   | 041      | [email protected]  |                        |
      | student042  | Student   | 042      | [email protected]  |                        |
      | student043  | Student   | 043      | [email protected]  |                        |
      | student044  | Student   | 044      | [email protected]  |                        |
      | student045  | Student   | 045      | [email protected]  |                        |
      | student046  | Student   | 046      | [email protected]  |                        |
      | student047  | Student   | 047      | [email protected]  |                        |
      | student048  | Student   | 048      | [email protected]  |                        |
      | student049  | Student   | 049      | [email protected]  |                        |
      | student050  | Student   | 050      | [email protected]  |                        |
      | student051  | Student   | 051      | [email protected]  |                        |
      | student052  | Student   | 052      | [email protected]  |                        |
      | student053  | Student   | 053      | [email protected]  |                        |
      | student054  | Student   | 054      | [email protected]  |                        |
      | student055  | Student   | 055      | [email protected]  |                        |
      | student056  | Student   | 056      | [email protected]  |                        |
      | student057  | Student   | 057      | [email protected]  |                        |
      | student058  | Student   | 058      | [email protected]  |                        |
      | student059  | Student   | 059      | [email protected]  |                        |
      | student060  | Student   | 060      | [email protected]  |                        |
      | student061  | Student   | 061      | [email protected]  |                        |
      | student062  | Student   | 062      | [email protected]  |                        |
      | student063  | Student   | 063      | [email protected]  |                        |
      | student064  | Student   | 064      | [email protected]  |                        |
      | student065  | Student   | 065      | [email protected]  |                        |
      | student066  | Student   | 066      | [email protected]  |                        |
      | student067  | Student   | 067      | [email protected]  |                        |
      | student068  | Student   | 068      | [email protected]  |                        |
      | student069  | Student   | 069      | [email protected]  |                        |
      | student070  | Student   | 070      | [email protected]  |                        |
      | student071  | Student   | 071      | [email protected]  |                        |
      | student072  | Student   | 072      | [email protected]  |                        |
      | student073  | Student   | 073      | [email protected]  |                        |
      | student074  | Student   | 074      | [email protected]  |                        |
      | student075  | Student   | 075      | [email protected]  |                        |
      | student076  | Student   | 076      | [email protected]  |                        |
      | student077  | Student   | 077      | [email protected]  |                        |
      | student078  | Student   | 078      | [email protected]  |                        |
      | student079  | Student   | 079      | [email protected]  |                        |
      | student080  | Student   | 080      | [email protected]  |                        |
      | student081  | Student   | 081      | [email protected]  |                        |
      | student082  | Student   | 082      | [email protected]  |                        |
      | student083  | Student   | 083      | [email protected]  |                        |
      | student084  | Student   | 084      | [email protected]  |                        |
      | student085  | Student   | 085      | [email protected]  |                        |
      | student086  | Student   | 086      | [email protected]  |                        |
      | student087  | Student   | 087      | [email protected]  |                        |
      | student088  | Student   | 088      | [email protected]  |                        |
      | student089  | Student   | 089      | [email protected]  |                        |
      | student090  | Student   | 090      | [email protected]  |                        |
      | student091  | Student   | 091      | [email protected]  |                        |
      | student092  | Student   | 092      | [email protected]  |                        |
      | student093  | Student   | 093      | [email protected]  |                        |
      | student094  | Student   | 094      | [email protected]  |                        |
      | student095  | Student   | 095      | [email protected]  |                        |
      | student096  | Student   | 096      | [email protected]  |                        |
      | student097  | Student   | 097      | [email protected]  |                        |
      | student098  | Student   | 098      | [email protected]  |                        |
      | student099  | Student   | 099      | [email protected]  |                        |
    And the following "courses" exist:
      | fullname   | shortname | format | startdate       |
      | Course 001 | C001      | weeks  | ##1 month ago## |
    And the following "course enrolments" exist:
      | user       | course | role           | timestart       |
      | teacher001 | C001   | editingteacher | ##1 month ago## |
    And I log in as "teacher001"
    And I am on "Course 001" course homepage

  @javascript
  Scenario: Teacher can search and enrol one particular student
    Given I navigate to course participants
    And I press "Enrol users"
    When I set the field "Select users" to "student001"
    And I should see "Student 001"
    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
    Then I should see "Active" in the "Student 001" "table_row"
    And I should see "1 enrolled users"

  @javascript
  Scenario: Searching for a non-existing user
    Given I navigate to course participants
    And I press "Enrol users"
    And I click on "Select users" "field"
    And I type "qwertyuiop"
    Then I should see "No suggestions"

  @javascript
  Scenario: If there are less than 100 matching users, all are displayed for selection
    Given I navigate to course participants
    And I press "Enrol users"
    When I click on "Select users" "field"
    And I type "example.com"
    Then "Student 099" "autocomplete_suggestions" should exist

  @javascript
  Scenario: If there are more than 100 matching users, inform there are too many.
    Given the following "users" exist:
      | username    | firstname | lastname | email                   |
      | student100  | Student   | 100      | [email protected]  |
      | student101  | Student   | 101      | [email protected]  |
    And I navigate to course participants
    And I press "Enrol users"
    When I click on "Select users" "field"
    And I type "example.com"
    Then I should see "Too many users (>100) to show"

  @javascript
  Scenario: Changing the Maximum users per page setting affects the enrolment pop-up.
    Given the following config values are set as admin:
      | maxusersperpage | 5 |
    And I navigate to course participants
    And I press "Enrol users"
    When I click on "Select users" "field"
    And I type "student00"
    Then I should see "Too many users (>5) to show"

  @javascript
  Scenario: Change the Show user identity setting affects the enrolment pop-up.
    Given I log out
    When I log in as "admin"
    Then the following "users" exist:
      | username    | firstname | lastname | email                   | phone1     | phone2     | department | institution | city    | country  |
      | student100  | Student   | 100      | [email protected]  | 1234567892 | 1234567893 | ABC1       | ABC2        | CITY1   | GB       |
    And the following config values are set as admin:
      | showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution |
    When I am on "Course 001" course homepage
    Then I navigate to course participants
    And I press "Enrol users"
    And I click on "Select users" "field"
    And I type "[email protected]"
    Then I should see "[email protected], CITY1, GB, 1234567892, 1234567893, ABC1, ABC2"
    # Remove identity field in setting User policies
    And the following config values are set as admin:
      | showuseridentity | idnumber,email,phone1,phone2,department,institution |
    And I am on "Course 001" course homepage
    And I navigate to course participants
    And I press "Enrol users"
    And I click on "Select users" "field"
    And I type "[email protected]"
    And I should see "[email protected], 1234567892, 1234567893, ABC1, ABC2"

  @javascript
  Scenario: Custom user profile fields work for search and display, if user has permission
    Given the following config values are set as admin:
      | showuseridentity | email,profile_field_customid |
    And I navigate to course participants
    And I press "Enrol users"
    When I set the field "Select users" to "Q994"
    Then I should see "[email protected], Q994"
    And I click on "Cancel" "button" in the "Enrol users" "dialogue"
    And the following "permission overrides" exist:
      | capability                   | permission | role           | contextlevel | reference |
      | moodle/site:viewuseridentity | Prevent    | editingteacher | Course       | C001      |
    And I press "Enrol users"
    # Do this by keyboard because the 'I set the field' step doesn't let you set it to a missing value.
    And I press tab
    And I press tab
    And I press tab
    And I type "Q994"
    And I should see "No suggestions"

# The following tests are commented out as a result of MDL-66339.
#  @javascript
#  Scenario: Enrol user from participants page
#    Given I navigate to course participants
#    # Enrol user to course
#    And I press "Enrol users"
#    And I set the field "Select users" to "example.com"
#    And I expand the "Select users" autocomplete
#    When I click on "Student 099" item in the autocomplete list
#    Then I should see "Student 099" in the list of options for the "Select users" autocomplete
#    And I click on "Show more" "button"
#    # Fill data to input duration
#    And "input[name='timeend[enabled]'][checked=checked]" "css_element" should not exist
#    And the "Enrolment duration" "select" should be enabled
#    And I set the field "duration" to "2"
#    # Fill data to input end time
#    And I set the field "Starting from" to "2"
#    And I set the field "timeend[enabled]" to "1"
#    And I set the field "timeend[day]" to "10"
#    And the "Enrolment duration" "select" should be disabled
#    And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
#    And I am on "Course 001" course homepage
#    And I navigate to course participants
#    And I should see "Student 099" in the "participants" "table"
#    And I click on "Edit enrolment" "icon" in the "Student 099" "table_row"
#    And the field "timeend[day]" matches value "10"
#
#  @javascript
#  Scenario: Update Enrol user
#    Given I am on "Course 001" course homepage
#    And I navigate to course participants
#    When I click on "Edit enrolment" "icon" in the "Teacher 001" "table_row"
#    Then the "Enrolment duration" "select" should be enabled
#    # Fill duration
#    And "input[name='timeend[enabled]'][checked=checked]" "css_element" should not exist
#    And the "Enrolment duration" "select" should be enabled
#    And I set the field "duration" to "2"
#    # Fill end time
#    And I set the field "timeend[enabled]" to "1"
#    And I set the field "timeend[day]" to "28"
#    And the "Enrolment duration" "select" should be disabled
#    And I press "Save changes"
#    And I click on "Edit enrolment" "icon" in the "Teacher 001" "table_row"
#    And the field "timeend[day]" matches value "28"

Zerion Mini Shell 1.0