Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
behat_filepicker Class Reference

Steps definitions to deal with the filemanager and filepicker. More...

Inheritance diagram for behat_filepicker:
behat_base behat_session_interface

Public Member Functions

 getSession ($name=null)
 Returns the Mink session.
 
 i_add_and_overwrite_file_from_repository_to_filemanager ($filepath, $repository, $filemanagerelement)
 Picks the file from repository leaving default values in select file dialogue and confirming to overwrite an existing file.
 
 i_add_and_overwrite_file_from_repository_to_filemanager_as ($filepath, $repository, $filemanagerelement, TableNode $data)
 Picks the file from repository confirming to overwrite an existing file.
 
 i_add_file_from_repository_to_filemanager ($filepath, $repository, $filemanagerelement)
 Picks the file from repository leaving default values in select file dialogue.
 
 i_add_file_from_repository_to_filemanager_as ($filepath, $repository, $filemanagerelement, TableNode $data)
 Picks the file from repository filling the form in Select file dialogue.
 
 i_click_on_element_in_filepicker_repository ($elementname, $elementtype)
 Clicks on a specific element (file or folder) in the repository content area in the file picker.
 
 i_create_folder_in_filemanager ($foldername, $filemanagerelement)
 Creates a folder with specified name in the current folder and in the specified filemanager field.
 
 i_delete_file_from_filemanager ($name, $filemanagerelement)
 Deletes the specified file or folder from the specified filemanager field.
 
 i_open_folder_from_filemanager ($foldername, $filemanagerelement)
 Opens the contents of a filemanager folder.
 
 i_select_filepicker_repository ($repositoryname)
 Selects a repository from the repository list in the file picker.
 
 i_should_see_breadcrumb_navigation_in_filepicker_repository ($breadcrumbs)
 Makes sure the user can see a specific breadcrumb navigation structure in the file picker repository.
 
 i_should_see_element_in_filepicker_repository ($elementname, $elementtype)
 Makes sure user can see a specific element (file or folder) in the repository content area in the file picker.
 
 i_should_see_elements_in_filemanager ($elementscount, $filemanagerelement)
 Makes sure user can see the exact number of elements (files in folders) in the filemanager.
 
 i_should_see_elements_in_filepicker_repository ($expectedcount)
 Makes sure user can see the exact number of elements (files and folders) in the repository content area in the file picker.
 
 i_unzip_file_from_filemanager ($filename, $filemanagerelement)
 Unzips the specified file from the specified filemanager field.
 
 i_zip_folder_from_filemanager ($foldername, $filemanagerelement)
 Zips the specified folder from the specified filemanager field.
 

Public Attributes

const PAGE_READY_JS
 The JS code to check that the page is ready.
 

Protected Member Functions

 add_file_from_repository_to_filemanager ($filepath, $repository, $filemanagerelement, TableNode $data, $overwriteaction=false)
 Picks the file from private files repository.
 
 get_element_in_filepicker_repository ($elementname, $elementtype)
 Returns a specific element (file or folder) in the repository content area in the file picker.
 

Detailed Description

Steps definitions to deal with the filemanager and filepicker.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_file_from_repository_to_filemanager()

behat_filepicker::add_file_from_repository_to_filemanager ( $filepath,
$repository,
$filemanagerelement,
TableNode $data,
$overwriteaction = false )
protected

Picks the file from private files repository.

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filepath
string$repository
string$filemanagerelement
TableNode$dataData to fill the form in Select file dialogue
false | string$overwriteactionfalse if we don't expect that file with the same name already exists, or button text in overwrite dialogue ("Overwrite", "Rename to ...", "Cancel")

◆ get_element_in_filepicker_repository()

behat_filepicker::get_element_in_filepicker_repository ( $elementname,
$elementtype )
protected

Returns a specific element (file or folder) in the repository content area in the file picker.

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$elementnameThe name of the element
string$elementtypeThe type of the element ("file" or "folder")
Return values
NodeElement

◆ getSession()

behat_session_interface::getSession ( $name = null)
inherited

Returns the Mink session.

Parameters
string | null$namename of the session OR active session will be used
Return values
Behat\Mink\Session

Implemented in behat_form_field.

◆ i_add_and_overwrite_file_from_repository_to_filemanager()

behat_filepicker::i_add_and_overwrite_file_from_repository_to_filemanager ( $filepath,
$repository,
$filemanagerelement )

Picks the file from repository leaving default values in select file dialogue and confirming to overwrite an existing file.

@When /^I add and overwrite "(?P<filepath_string>(?:[^"]|::")*)" file from "(?P<repository_string>(?:[^"]|")*)" to "(?P<filemanagerelement_string>(?:[^"]|::")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filepath
string$repository
string$filemanagerelement

◆ i_add_and_overwrite_file_from_repository_to_filemanager_as()

behat_filepicker::i_add_and_overwrite_file_from_repository_to_filemanager_as ( $filepath,
$repository,
$filemanagerelement,
TableNode $data )

Picks the file from repository confirming to overwrite an existing file.

@When /^I add and overwrite "(?P<filepath_string>(?:[^"]|::")*)" file from "(?P<repository_string>(?:[^"]|")*)" to "(?P<filemanager_field_string>(?:[^"]|::")*)" filemanager as:$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filepath
string$repository
string$filemanagerelement
TableNode$dataData to fill the form in Select file dialogue

◆ i_add_file_from_repository_to_filemanager()

behat_filepicker::i_add_file_from_repository_to_filemanager ( $filepath,
$repository,
$filemanagerelement )

Picks the file from repository leaving default values in select file dialogue.

@When /^I add "(?P<filepath_string>(?:[^"]|::")*)" file from "(?P<repository_string>(?:[^"]|")*)" to "(?P<filemanagerelement_string>(?:[^"]|::")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filepath
string$repository
string$filemanagerelement

◆ i_add_file_from_repository_to_filemanager_as()

behat_filepicker::i_add_file_from_repository_to_filemanager_as ( $filepath,
$repository,
$filemanagerelement,
TableNode $data )

Picks the file from repository filling the form in Select file dialogue.

@When /^I add "(?P<filepath_string>(?:[^"]|::")*)" file from "(?P<repository_string>(?:[^"]|")*)" to "(?P<filemanager_field_string>(?:[^"]|::")*)" filemanager as:$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filepath
string$repository
string$filemanagerelement
TableNode$dataData to fill the form in Select file dialogue

◆ i_click_on_element_in_filepicker_repository()

behat_filepicker::i_click_on_element_in_filepicker_repository ( $elementname,
$elementtype )

Clicks on a specific element (file or folder) in the repository content area in the file picker.

@Then /^I click on "(?P<element_name_string>(?:[^"]|::")*)" "(?P<element_type_string>(?:[^"]|")*)" in repository content area$/ @throws ExpectationException Thrown by behat_base::find @param string $elementname The name of the element @param string $elementtype The type of the element ("file" or "folder")

◆ i_create_folder_in_filemanager()

behat_filepicker::i_create_folder_in_filemanager ( $foldername,
$filemanagerelement )

Creates a folder with specified name in the current folder and in the specified filemanager field.

@Given /^I create "(?P<foldername_string>(?:[^"]|::")*)" folder in "(?P<filemanager_field_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$foldername
string$filemanagerelement

◆ i_delete_file_from_filemanager()

behat_filepicker::i_delete_file_from_filemanager ( $name,
$filemanagerelement )

Deletes the specified file or folder from the specified filemanager field.

@Given /^I delete "(?P<file_or_folder_name_string>(?:[^"]|::")*)" from "(?P<filemanager_field_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$name
string$filemanagerelement

◆ i_open_folder_from_filemanager()

behat_filepicker::i_open_folder_from_filemanager ( $foldername,
$filemanagerelement )

Opens the contents of a filemanager folder.

It looks for the folder in the current folder and in the path bar.

@Given /^I open "(?P<foldername_string>(?:[^"]|::")*)" folder from "(?P<filemanager_field_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$foldername
string$filemanagerelement

◆ i_select_filepicker_repository()

behat_filepicker::i_select_filepicker_repository ( $repositoryname)

Selects a repository from the repository list in the file picker.

@Then /^I select "(?P<repository_name_string>(?:[^"]|::")*)" repository in file picker$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$repositoryname

◆ i_should_see_breadcrumb_navigation_in_filepicker_repository()

behat_filepicker::i_should_see_breadcrumb_navigation_in_filepicker_repository ( $breadcrumbs)

Makes sure the user can see a specific breadcrumb navigation structure in the file picker repository.

@Then /^I should see "(?P<breadcrumb_navigation_string>(?:[^"]|::")*)" breadcrumb navigation in repository$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$breadcrumbsThe breadcrumb navigation structure (ex. "System > Category > Course")

◆ i_should_see_element_in_filepicker_repository()

behat_filepicker::i_should_see_element_in_filepicker_repository ( $elementname,
$elementtype )

Makes sure user can see a specific element (file or folder) in the repository content area in the file picker.

@Then /^I should see "(?P<element_name_string>(?:[^"]|::")*)" "(?P<element_type_string>(?:[^"]|")*)" in repository content area$/ @throws ExpectationException Thrown by behat_base::find @param string $elementname The name of the element @param string $elementtype The type of the element ("file" or "folder")

◆ i_should_see_elements_in_filemanager()

behat_filepicker::i_should_see_elements_in_filemanager ( $elementscount,
$filemanagerelement )

Makes sure user can see the exact number of elements (files in folders) in the filemanager.

@Then /^I should see "(?P<elementscount_number>::d+)" elements in "(?P<filemanagerelement_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
int$elementscount
string$filemanagerelement

◆ i_should_see_elements_in_filepicker_repository()

behat_filepicker::i_should_see_elements_in_filepicker_repository ( $expectedcount)

Makes sure user can see the exact number of elements (files and folders) in the repository content area in the file picker.

@Then /^I should see "(?P<elements_number>::d+)" elements in repository content area$/

Exceptions
ExpectationExceptionThrown by behat_base\find_all
Parameters
int$expectedcount

◆ i_unzip_file_from_filemanager()

behat_filepicker::i_unzip_file_from_filemanager ( $filename,
$filemanagerelement )

Unzips the specified file from the specified filemanager field.

The zip file has to be visible in the current folder.

@Given /^I unzip "(?P<filename_string>(?:[^"]|::")*)" file from "(?P<filemanager_field_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$filename
string$filemanagerelement

◆ i_zip_folder_from_filemanager()

behat_filepicker::i_zip_folder_from_filemanager ( $foldername,
$filemanagerelement )

Zips the specified folder from the specified filemanager field.

The folder has to be in the current folder.

@Given /^I zip "(?P<filename_string>(?:[^"]|::")*)" folder from "(?P<filemanager_field_string>(?:[^"]|")*)" filemanager$/

Exceptions
ExpectationExceptionThrown by behat_base\find
Parameters
string$foldername
string$filemanagerelement

Member Data Documentation

◆ PAGE_READY_JS

const behat_session_interface::PAGE_READY_JS
inherited
Initial value:
= "document.readyState === 'complete' && " .
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)"

The JS code to check that the page is ready.

The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.


The documentation for this class was generated from the following file: