FileSystem
Extends Helper
Helper for testing filesystem. Can be easily used to check file structures:
I.amInPath('test');
I.seeFile('codecept.json');
I.seeInThisFile('FileSystem');
I.dontSeeInThisFile("WebDriverIO");
Methods
amInPath
Enters a directory In local filesystem. Starts from a current directory
Parameters
-
openPathstring (opens new window)
dontSeeFileContentsEqual
Checks that contents of file found by seeFile doesn't equal to text.
Parameters
-
textstring (opens new window) -
encodingstring (opens new window)
dontSeeInThisFile
Checks that file found by seeFile doesn't include text.
Parameters
-
textstring (opens new window) -
encodingstring (opens new window)
grabFileNames
Returns file names in current directory.
I.handleDownloads();
I.click('Download Files');
I.amInPath('output/downloads');
const downloadedFileNames = I.grabFileNames();
seeFile
Checks that file exists
Parameters
seeFileContentsEqual
Checks that contents of file found by seeFile equal to text.
Parameters
-
textstring (opens new window) -
encodingstring (opens new window)
seeFileContentsEqualReferenceFile
Checks that contents of the file found by seeFile equal to contents of the file at pathToReferenceFile.
Parameters
-
pathToReferenceFilestring (opens new window) -
encodingstring (opens new window) -
encodingReferencestring (opens new window)
seeFileNameMatching
Checks that file with a name including given text exists in the current directory.
I.handleDownloads();
I.click('Download as PDF');
I.amInPath('output/downloads');
I.seeFileNameMatching('.pdf');
Parameters
text
seeInThisFile
Checks that file found by seeFile includes a text.
Parameters
-
textstring (opens new window) -
encodingstring (opens new window)
waitForFile
Waits for file to be present in current directory.
I.handleDownloads();
I.click('Download large File');
I.amInPath('output/downloads');
I.waitForFile('largeFilesName.txt', 10); // wait 10 seconds for file
Parameters
-
namestring (opens new window) -
secnumber (opens new window) seconds to wait
writeToFile
Writes test to file
Parameters
getFileContents
Parameters
-
filestring (opens new window) -
encodingstring (opens new window)
Returns string (opens new window)
isFileExists
Parameters
-
filestring (opens new window) -
timeoutnumber (opens new window)
Returns Promise (opens new window)<any>
© 2015 DavertMik <[email protected]> (http://codegyre.com)
Licensed under the MIT License.
https://codecept.io/helpers/FileSystem/