Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_uploadcourse @_file_upload
2
Feature: An admin can create courses with meta enrolments using a CSV file
3
  In order to create courses using a CSV file with meta enrolment
4
  As an admin
5
  I need to be able to upload a CSV file and navigate through the import process
6
 
7
  Background:
8
    Given the following "categories" exist:
9
      | name  | category | idnumber |
10
      | Cat 0 | 0        | CAT0     |
11
      | Cat 1 | CAT0     | CAT1     |
12
      | Cat 1 | CAT0     | CAT2     |
13
    And the following "courses" exist:
14
      | fullname | shortname | category |
15
      | Course 1 | C1        | CAT1     |
16
      | Course 2 | C2        | CAT1     |
17
    And I log in as "admin"
18
    And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
19
    And I click on "Enable" "link" in the "Course meta link" "table_row"
20
    And I navigate to "Courses > Upload courses" in site administration
21
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
22
    And I set the field "Update mode" to "Update with CSV data only"
23
 
24
  @javascript
25
  Scenario: Validation of meta link course shortname for uploaded courses
26
    Given I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_meta.csv" file to "File" filemanager
27
    And I click on "Preview" "button"
28
    And I should see "Unknown meta course shortname"
29
    And I should see "You can't add a meta link to the same course."
30
    When I click on "Upload courses" "button"
31
    And I should see "Unknown meta course shortname"
32
    And I should see "You can't add a meta link to the same course."
33
    And I should see "Courses created: 1"
34
    And I should see "Courses updated: 0"
35
    And I should see "Courses errors: 2"
36
    And I am on the "Course 4" "enrolment methods" page
37
    Then I should see "Course meta link (Course 1)"
38
    And I click on "Edit" "link" in the "Course meta link" "table_row"
39
    And the field "Add to group" matches value "None"
40
    And I am on the "Course 1" "enrolment methods" page
41
    And I should not see "Course meta link (Course 1)"
42
 
43
  @javascript
44
  Scenario: Validation of groups for uploaded courses with meta enrolments
45
    Given the following "groups" exist:
46
      | name    | course | idnumber |
47
      | group1  | C2     | G1       |
48
    And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_meta_addtogroup_groupname.csv" file to "File" filemanager
49
    And I click on "Preview" "button"
50
    And I should see "You cannot specify groupname when addtogroup is set."
51
 
52
    And I navigate to "Courses > Upload courses" in site administration
53
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
54
    And I set the field "Update mode" to "Update with CSV data only"
55
    And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_meta_addtogroup.csv" file to "File" filemanager
56
    And I click on "Preview" "button"
57
    And I click on "Upload courses" "button"
58
    And I should see "Courses created: 2"
59
    And I should see "Courses errors: 0"
60
    And I am on the "Course 3" "enrolment methods" page
61
    And I should see "Course meta link (Course 1)"
62
    And I click on "Edit" "link" in the "Course meta link" "table_row"
63
    And the field "Add to group" matches value "Course 1 course"
64
    And I am on the "Course 3" "groups" page
65
    And I should see "Course 1 course"
66
    And I am on the "Course 4" "enrolment methods" page
67
    And I should see "Course meta link (Course 1)"
68
    And I click on "Edit" "link" in the "Course meta link" "table_row"
69
    And the field "Add to group" matches value "None"
70
    And I am on the "Course 4" "groups" page
71
    And I should not see "Course 1 course"
72
 
73
    And I navigate to "Courses > Upload courses" in site administration
74
    And I set the field "Upload mode" to "Create new courses, or update existing ones"
75
    And I set the field "Update mode" to "Update with CSV data only"
76
    And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_meta_groups.csv" file to "File" filemanager
77
    And I click on "Preview" "button"
78
    And I should see "Error, invalid group notexist"
79
    When I click on "Upload courses" "button"
80
    And I should see "Error, invalid group notexist"
81
    And I should see "Courses updated: 1"
82
    And I should see "Courses errors: 1"
83
    And I am on the "Course 2" "enrolment methods" page
84
    Then I should see "Course meta link (Course 1)"
85
    And I click on "Edit" "link" in the "Course meta link" "table_row"
86
    And the field "Add to group" matches value "group1"
87
    And I am on the "Course 2" "groups" page
88
    And I should see "group1"