Skip to content

Commit

Permalink
MDL-42174 behat: deprecate upload file to filepicker step in favour o…
Browse files Browse the repository at this point in the history
…f filemanager
  • Loading branch information
marinaglancy committed Dec 5, 2013
1 parent fcb6ed4 commit 0762245
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 34 deletions.
2 changes: 1 addition & 1 deletion admin/tests/behat/upload_users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/uploadcourse/tests/behat/create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploadcourse/tests/behat/update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion badges/tests/behat/add_badge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions badges/tests/behat/award_badge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cohort/tests/behat/upload_cohort_users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions group/tests/behat/groups_import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
21 changes: 21 additions & 0 deletions lib/tests/behat/behat_deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ public function i_add_file_from_recent_files_to_filepicker($filename, $filepicke
);
}

/**
* 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.
*
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/tests/behat/file_submission.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/tests/behat/add_scorm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions repository/recent/tests/behat/add_recent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions repository/tests/behat/cancel_add_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion repository/tests/behat/delete_files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions repository/upload/tests/behat/behat_repository_upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@
*/
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.
*
Expand Down

0 comments on commit 0762245

Please sign in to comment.