[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/cohort/tests/behat/ -> upload_cohorts.feature (source)

   1  @core @core_cohort @_file_upload
   2  Feature: A privileged user can create cohorts using a CSV file
   3    In order to create cohorts using a CSV file
   4    As an admin
   5    I need to be able to upload a CSV file and navigate through the upload process
   6  
   7    Background:
   8      Given the following "categories" exist:
   9        | name  | category | idnumber |
  10        | Cat 1 | 0        | CAT1     |
  11        | Cat 2 | 0        | CAT2     |
  12        | Cat 3 | CAT1     | CAT3     |
  13  
  14    @javascript
  15    Scenario: Upload cohorts with default System context as admin
  16      When I log in as "admin"
  17      And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
  18      And I follow "Upload cohorts"
  19      And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
  20      And I click on "Preview" "button"
  21      Then the following should exist in the "previewuploadedcohorts" table:
  22        | name          | idnumber  | description       | Context       | visible | Status |
  23        | cohort name 1 | cohortid1 | first description | System        | 1       |        |
  24        | cohort name 2 | cohortid2 |                   | System        | 1       |        |
  25        | cohort name 3 | cohortid3 |                   | Miscellaneous | 0       |        |
  26        | cohort name 4 | cohortid4 |                   | Cat 1         | 1       |        |
  27        | cohort name 5 | cohortid5 |                   | Cat 2         | 0       |        |
  28        | cohort name 6 | cohortid6 |                   | Cat 3         | 1       |        |
  29      And I press "Upload cohorts"
  30      And I should see "Uploaded 6 cohorts"
  31      And I press "Continue"
  32      And the following should exist in the "cohorts" table:
  33        | Name          | Cohort ID | Description | Cohort size | Source           |
  34        | cohort name 1 | cohortid1 | first description | 0           | Created manually |
  35        | cohort name 2 | cohortid2 |             | 0           | Created manually |
  36      And I follow "All cohorts"
  37      And the following should exist in the "cohorts" table:
  38        | Category      | Name          | Cohort ID | Description       | Cohort size | Source           |
  39        | System        | cohort name 1 | cohortid1 | first description | 0           | Created manually |
  40        | System        | cohort name 2 | cohortid2 |                   | 0           | Created manually |
  41        | Miscellaneous | cohort name 3 | cohortid3 |                   | 0           | Created manually |
  42        | Cat 1         | cohort name 4 | cohortid4 |                   | 0           | Created manually |
  43        | Cat 2         | cohort name 5 | cohortid5 |                   | 0           | Created manually |
  44        | Cat 3         | cohort name 6 | cohortid6 |                   | 0           | Created manually |
  45      And ".dimmed_text" "css_element" should not exist in the "cohort name 1" "table_row"
  46      And ".dimmed_text" "css_element" should not exist in the "cohort name 2" "table_row"
  47      And ".dimmed_text" "css_element" should exist in the "cohort name 3" "table_row"
  48      And the "class" attribute of "cohort name 3" "table_row" should contain "dimmed_text"
  49      And ".dimmed_text" "css_element" should not exist in the "cohort name 4" "table_row"
  50      And the "class" attribute of "cohort name 5" "table_row" should contain "dimmed_text"
  51      And ".dimmed_text" "css_element" should not exist in the "cohort name 6" "table_row"
  52  
  53    @javascript
  54    Scenario: Upload cohorts with default category context as admin
  55      When I log in as "admin"
  56      And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
  57      And I follow "Upload cohorts"
  58      And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
  59      And I set the field "Default context" to "Cat 1 / Cat 3"
  60      And I click on "Preview" "button"
  61      Then the following should exist in the "previewuploadedcohorts" table:
  62        | name          | idnumber  | description       | Context                 | Status |
  63        | cohort name 1 | cohortid1 | first description | Cat 3         |        |
  64        | cohort name 2 | cohortid2 |                   | Cat 3         |        |
  65        | cohort name 3 | cohortid3 |                   | Miscellaneous |        |
  66        | cohort name 4 | cohortid4 |                   | Cat 1         |        |
  67        | cohort name 5 | cohortid5 |                   | Cat 2         |        |
  68        | cohort name 6 | cohortid6 |                   | Cat 3         |        |
  69      And I press "Upload cohorts"
  70      And I should see "Uploaded 6 cohorts"
  71      And I press "Continue"
  72      And I should see "Category: Cat 3: available cohorts (3)"
  73      And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
  74      And I follow "All cohorts"
  75      And the following should exist in the "cohorts" table:
  76        | Category      | Name          | Cohort ID | Description       | Cohort size | Source           |
  77        | Cat 3         | cohort name 1 | cohortid1 | first description | 0           | Created manually |
  78        | Cat 3         | cohort name 2 | cohortid2 |                   | 0           | Created manually |
  79        | Miscellaneous | cohort name 3 | cohortid3 |                   | 0           | Created manually |
  80        | Cat 1         | cohort name 4 | cohortid4 |                   | 0           | Created manually |
  81        | Cat 2         | cohort name 5 | cohortid5 |                   | 0           | Created manually |
  82        | Cat 3         | cohort name 6 | cohortid6 |                   | 0           | Created manually |
  83  
  84    @javascript
  85    Scenario: Upload cohorts with default category context as manager
  86      Given the following "users" exist:
  87        | username | firstname | lastname | email                  |
  88        | user1    | User      | 1        | user1@example.com |
  89      And the following "role assigns" exist:
  90        | user  | role    | contextlevel | reference |
  91        | user1 | manager | Category     | CAT1      |
  92      When I log in as "user1"
  93      And I follow "Courses"
  94      And I follow "Cat 1"
  95      And I navigate to "Cohorts" node in "Category: Cat 1"
  96      And I follow "Upload cohorts"
  97      And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
  98      And I click on "Preview" "button"
  99      Then the following should exist in the "previewuploadedcohorts" table:
 100        | name          | idnumber  | description       | Context | Status |
 101        | cohort name 1 | cohortid1 | first description | Cat 1   |        |
 102        | cohort name 2 | cohortid2 |                   | Cat 1   |        |
 103        | cohort name 3 | cohortid3 |                   | Cat 1   | Category Miscellaneous not found or you don't have permission to create a cohort there. The default context will be used. |
 104        | cohort name 4 | cohortid4 |                   | Cat 1   |        |
 105        | cohort name 5 | cohortid5 |                   | Cat 1   | Category CAT2 not found or you don't have permission to create a cohort there. The default context will be used. |
 106        | cohort name 6 | cohortid6 |                   | Cat 3   |        |
 107      And I press "Upload cohorts"
 108      And I should see "Uploaded 6 cohorts"
 109  
 110    @javascript
 111    Scenario: Upload cohorts with conflicting id number
 112      Given the following "cohorts" exist:
 113        | name   | idnumber  |
 114        | Cohort | cohortid2 |
 115      When I log in as "admin"
 116      And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
 117      And I follow "Upload cohorts"
 118      And I upload "cohort/tests/fixtures/uploadcohorts1.csv" file to "File" filemanager
 119      And I click on "Preview" "button"
 120      Then I should see "Errors were found in CSV data. See details below."
 121      Then the following should exist in the "previewuploadedcohorts" table:
 122        | name | idnumber | description | Context | Status |
 123        | cohort name 1 | cohortid1 | first description | System |  |
 124        | cohort name 2 | cohortid2 |  | System | Cohort with the same ID number already exists |
 125        | cohort name 3 | cohortid3 |  | Miscellaneous |  |
 126        | cohort name 4 | cohortid4 |  | Cat 1 |  |
 127        | cohort name 5 | cohortid5 |  | Cat 2 |  |
 128        | cohort name 6 | cohortid6 |  | Cat 3 |  |
 129      And "Upload cohorts" "button" should not exist
 130  
 131    @javascript
 132    Scenario: Upload cohorts with different ways of specifying context
 133      When I log in as "admin"
 134      And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
 135      And I follow "Upload cohorts"
 136      And I upload "cohort/tests/fixtures/uploadcohorts2.csv" file to "File" filemanager
 137      And I click on "Preview" "button"
 138      Then the following should exist in the "previewuploadedcohorts" table:
 139        | name                         | idnumber  | description | Context       | Status |
 140        | Specify category as name     | cohortid1 |             | Miscellaneous |        |
 141        | Specify category as idnumber | cohortid2 |             | Cat 1         |        |
 142        | Specify category as id       | cohortid3 |             | Miscellaneous |        |
 143        | Specify category as path     | cohortid4 |             | Cat 3         |        |
 144        | Specify category_id          | cohortid5 |             | Miscellaneous |        |
 145        | Specify category_idnumber    | cohortid6 |             | Cat 1         |        |
 146        | Specify category_path        | cohortid7 |             | Cat 3         |        |
 147      And I should not see "not found or you"
 148      And I press "Upload cohorts"
 149      And I should see "Uploaded 7 cohorts"
 150      And I press "Continue"
 151      And I follow "Upload cohorts"
 152      And I upload "cohort/tests/fixtures/uploadcohorts3.csv" file to "File" filemanager
 153      And I click on "Preview" "button"
 154      And the following should exist in the "previewuploadedcohorts" table:
 155        | name                                         | idnumber   | description | Context | Status |
 156        | Specify context as id (system)               | cohortid8  |             | System  |        |
 157        | Specify context as name (system)             | cohortid9  |             | System  |        |
 158        | Specify context as category name only        | cohortid10 |             | Cat 1   |        |
 159        | Specify context as category path             | cohortid12 |             | Cat 3   |        |
 160        | Specify context as category idnumber         | cohortid13 |             | Cat 2   |        |
 161      And I should not see "not found or you"
 162      And I press "Upload cohorts"
 163      And I should see "Uploaded 5 cohorts"


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1