MDL-13114 tool_uploadcourse: Simple Behat tests for create and update
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
@tool @tool_uploadcourse @_only_local
|
||||
Feature: An admin can create courses using a CSV file
|
||||
In order to create courses using a CSV file
|
||||
As an admin
|
||||
I need to be able to upload a CSV file and navigate through the import process
|
||||
|
||||
Background:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| First course | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I expand "Site administration" node
|
||||
And I expand "Courses" node
|
||||
And I follow "Upload courses"
|
||||
|
||||
@javascript
|
||||
Scenario: Creation of unexisting courses
|
||||
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
|
||||
And I click on "Preview" "button"
|
||||
When I click on "Upload courses" "button"
|
||||
Then I should see "The course exists and update is not allowed"
|
||||
And I should see "Course created"
|
||||
And I should see "Courses total: 3"
|
||||
And I should see "Courses created: 2"
|
||||
And I should see "Courses errors: 1"
|
||||
And I follow "Home"
|
||||
And I should see "Course 2"
|
||||
And I should see "Course 3"
|
||||
|
||||
@javascript
|
||||
Scenario: Creation of existing courses
|
||||
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
|
||||
And I select "Create all, increment shortname if needed" from "Upload mode"
|
||||
And I click on "Preview" "button"
|
||||
When I click on "Upload courses" "button"
|
||||
Then I should see "Course created"
|
||||
And I should see "Course shortname incremented C1 -> C2"
|
||||
And I should see "Course shortname incremented C2 -> C3"
|
||||
And I should see "Course shortname incremented C3 -> C4"
|
||||
And I should see "Courses total: 3"
|
||||
And I should see "Courses created: 3"
|
||||
And I should see "Courses errors: 0"
|
||||
And I follow "Home"
|
||||
And I should see "Course 1"
|
||||
And I should see "Course 2"
|
||||
And I should see "Course 3"
|
||||
@@ -0,0 +1,32 @@
|
||||
@tool @tool_uploadcourse @_only_local
|
||||
Feature: An admin can update courses using a CSV file
|
||||
In order to update courses using a CSV file
|
||||
As an admin
|
||||
I need to be able to upload a CSV file and navigate through the import process
|
||||
|
||||
Background:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Some random name | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I expand "Site administration" node
|
||||
And I expand "Courses" node
|
||||
And I follow "Upload courses"
|
||||
|
||||
@javascript
|
||||
Scenario: Updating a course fullname
|
||||
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
|
||||
And I select "Only update existing courses" from "Upload mode"
|
||||
And I select "Update with CSV data only" from "Update mode"
|
||||
And I click on "Preview" "button"
|
||||
When I click on "Upload courses" "button"
|
||||
Then I should see "Course updated"
|
||||
And I should see "The course does not exist and creating course is not allowed"
|
||||
And I should see "Courses total: 3"
|
||||
And I should see "Courses updated: 1"
|
||||
And I should see "Courses created: 0"
|
||||
And I should see "Courses errors: 2"
|
||||
And I follow "Home"
|
||||
And I should see "Course 1"
|
||||
And I should not see "Course 2"
|
||||
And I should not see "Course 3"
|
||||
@@ -0,0 +1,4 @@
|
||||
shortname,fullname,summary,category,idnumber
|
||||
C1,Course 1,Summary 1,1,ID1
|
||||
C2,Course 2,Summary 2,1,ID2
|
||||
C3,Course 3,Summary 3,1,ID3
|
||||
|
Reference in New Issue
Block a user