Commit 07622451 authored by Marina Glancy's avatar Marina Glancy
Browse files

MDL-42174 behat: deprecate upload file to filepicker step in favour of filemanager

parent fcb6ed47
......@@ -19,7 +19,7 @@ Feature: Upload users
And I expand "Users" node
And I expand "Accounts" node
And I follow "Upload users"
When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filepicker
When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
And I press "Upload users"
Then I should see "Upload users preview"
And I should see "Tom"
......
......@@ -15,7 +15,7 @@ Feature: An admin can create courses using a CSV file
@javascript
Scenario: Creation of unexisting courses
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filemanager
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"
......@@ -29,7 +29,7 @@ Feature: An admin can create courses using a CSV file
@javascript
Scenario: Creation of existing courses
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filemanager
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"
......
......@@ -15,7 +15,7 @@ Feature: An admin can update courses using a CSV file
@javascript
Scenario: Updating a course fullname
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filepicker
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filemanager
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"
......
......@@ -36,7 +36,7 @@ Feature: Add badges to the system
| Description | Test badge description |
| issuername | Test Badge Site |
| issuercontact | testuser@test-badge-site.com |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
When I press "Create badge"
Then I should see "Edit details"
And I should see "Test Badge"
......
......@@ -18,7 +18,7 @@ Feature: Award badges
| Description | Test badge description |
| issuername | Test Badge Site |
| issuercontact | testuser@test-badge-site.com |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Profile completion" from "type"
And I check "First name"
......@@ -53,7 +53,7 @@ Feature: Award badges
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Manual issue by role" from "type"
And I check "Teacher"
......@@ -98,7 +98,7 @@ Feature: Award badges
| Name | Course Badge |
| Description | Course badge description |
| issuername | Tester of course badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Manual issue by role" from "type"
And I check "Teacher"
......@@ -156,7 +156,7 @@ Feature: Award badges
| Name | Course Badge |
| Description | Course badge description |
| issuername | Tester of course badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Activity completion" from "type"
And I check "Test assignment name"
......@@ -219,7 +219,7 @@ Feature: Award badges
| Name | Course Badge |
| Description | Course badge description |
| issuername | Tester of course badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Course completion" from "type"
And I fill the moodle form with:
......
......@@ -27,7 +27,7 @@ Feature: Upload users to a cohort
And I expand "Users" node
And I expand "Accounts" node
When I follow "Upload users"
And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filepicker
And I upload "lib/tests/fixtures/upload_users_cohorts.csv" file to "File" filemanager
And I press "Upload users"
And I press "Upload users"
And I press "Continue"
......
......@@ -22,7 +22,7 @@ Feature: Importing of groups and groupings
And I expand "Users" node
And I follow "Groups"
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filepicker
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
And I press "Continue"
Then I should see "group-id-1"
......@@ -47,7 +47,7 @@ Feature: Importing of groups and groupings
And I expand "Users" node
And I follow "Groups"
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filepicker
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
Then I should see "Group group-id-1 added successfully"
And I should see "Group group-id-2 added successfully"
......@@ -91,7 +91,7 @@ Feature: Importing of groups and groupings
And I expand "Users" node
And I follow "Groups"
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filepicker
When I upload "group/tests/fixtures/groups_import.csv" file to "Import" filemanager
And I press "Import groups"
And I press "Continue"
Then I select "group-id-1" from "groups"
......
......@@ -116,6 +116,27 @@ class behat_deprecated extends behat_base {
);
}
/**
* Uploads a file to the specified filemanager leaving other fields in upload form default. The paths should be relative to moodle codebase.
*
* @deprecated since 2.7
* @todo MDL-42862 This will be deleted in Moodle 2.9
* @see behat_repository_upload::i_upload_file_to_filemanager()
*
* @When /^I upload "(?P<filepath_string>(?:[^"]|\\")*)" file to "(?P<filepicker_field_string>(?:[^"]|\\")*)" filepicker$/
* @throws ExpectationException Thrown by behat_base::find
* @param string $filepath
* @param string $filepickerelement
*/
public function i_upload_file_to_filepicker($filepath, $filepickerelement) {
$alternative = 'I upload "' . $this->escape($filepath) . '" file to "' .
$this->escape($filepickerelement) . '" filemanager';
$this->deprecated_message($alternative);
return array(
new Given($alternative)
);
}
/**
* Throws an exception if $CFG->behat_usedeprecated is not allowed.
*
......
......@@ -31,13 +31,13 @@ Feature: In an assignment, students can upload files for assessment
And I follow "Course 1"
And I follow "Test assignment name"
When I press "Add submission"
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filepicker
And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager
And I press "Save changes"
Then I should see "Submitted for grading"
And I should see "empty.txt"
And I should see "Not graded"
And I press "Edit submission"
And I upload "lib/tests/fixtures/upload_users.csv" file to "File submissions" filepicker
And I upload "lib/tests/fixtures/upload_users.csv" file to "File submissions" filemanager
And ".ffilemanager .fm-maxfiles .fp-btn-add" "css_element" should exists
And I press "Save changes"
And I should see "Submitted for grading"
......
......@@ -21,7 +21,7 @@ Feature: Add scorm activity
And I follow "Course 1"
And I turn editing mode on
And I add a "SCORM package" to section "1"
And I upload "mod/scorm/tests/packages/singlescobasic.zip" file to "Package file" filepicker
And I upload "mod/scorm/tests/packages/singlescobasic.zip" file to "Package file" filemanager
And I fill the moodle form with:
| Name | Awesome SCORM package |
| Description | Description |
......
......@@ -12,8 +12,8 @@ Feature: Recent files repository lists the recently used files
And I log in as "admin"
And I expand "My profile" node
And I follow "My private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filepicker
And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filepicker
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager
And I press "Save changes"
And I am on homepage
And I follow "Course 1"
......
......@@ -12,7 +12,7 @@ Feature: A selected file can be cancelled
And I log in as "admin"
And I expand "My profile" node
And I follow "My private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filepicker
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I am on homepage
And I follow "Course 1"
......@@ -21,7 +21,7 @@ Feature: A selected file can be cancelled
And I fill the moodle form with:
| Name | Folder name |
| Description | Folder description |
And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filepicker
And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager
And I click on "#fitem_id_files .fp-btn-add a" "css_element"
And I click on "Recent files" "link" in the ".fp-repo-area" "css_element"
And I click on "//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-file ')][normalize-space(.)='empty.txt']" "xpath_element"
......
......@@ -9,7 +9,7 @@ Feature: Delete files and folders from the file manager
Given I log in as "admin"
And I expand "My profile" node
And I follow "My private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filepicker
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I create "Delete me" folder in "Files" filepicker
And I press "Save changes"
When I delete "empty.txt" from "Files" filepicker
......
......@@ -42,18 +42,6 @@ use Behat\Mink\Exception\ExpectationException as ExpectationException,
*/
class behat_repository_upload extends behat_files {
/**
* Uploads a file to the specified filemanager leaving other fields in upload form default. The paths should be relative to moodle codebase.
*
* @When /^I upload "(?P<filepath_string>(?:[^"]|\\")*)" file to "(?P<filepicker_field_string>(?:[^"]|\\")*)" filepicker$/
* @throws ExpectationException Thrown by behat_base::find
* @param string $filepath
* @param string $filepickerelement
*/
public function i_upload_file_to_filepicker($filepath, $filepickerelement) {
$this->upload_file_to_filemanager($filepath, $filepickerelement, new TableNode(), false);
}
/**
* Uploads a file to the specified filemanager leaving other fields in upload form default. The paths should be relative to moodle codebase.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment