FileSystem
FileSystem
Section titled “FileSystem”Extends Helper
Helper for testing filesystem. Can be easily used to check file structures:
I.amInPath('test');I.seeFile('codecept.js');I.seeInThisFile('FileSystem');I.dontSeeInThisFile("WebDriver");Configuration
Section titled “Configuration”Enable helper in config file:
helpers: { FileSystem: {},}Methods
Section titled “Methods”amInPath
Section titled “amInPath”Enters a directory In local filesystem. Starts from a current directory
Parameters
Section titled “Parameters”openPathstring
dontSeeFileContentsEqual
Section titled “dontSeeFileContentsEqual”Checks that contents of file found by seeFile doesn’t equal to text.
Parameters
Section titled “Parameters”dontSeeInThisFile
Section titled “dontSeeInThisFile”Checks that file found by seeFile doesn’t include text.
Parameters
Section titled “Parameters”grabFileNames
Section titled “grabFileNames”Returns file names in current directory.
I.handleDownloads();I.click('Download Files');I.amInPath('output/downloads');const downloadedFileNames = I.grabFileNames();seeFile
Section titled “seeFile”Checks that file exists
Parameters
Section titled “Parameters”namestring
seeFileContentsEqual
Section titled “seeFileContentsEqual”Checks that contents of file found by seeFile equal to text.
Parameters
Section titled “Parameters”seeFileContentsEqualReferenceFile
Section titled “seeFileContentsEqualReferenceFile”Checks that contents of the file found by seeFile equal to contents of the file at pathToReferenceFile.
Parameters
Section titled “Parameters”seeFileNameMatching
Section titled “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
Section titled “Parameters”textstring
seeInThisFile
Section titled “seeInThisFile”Checks that file found by seeFile includes a text.
Parameters
Section titled “Parameters”waitForFile
Section titled “waitForFile”Waits for the file to be present in the current directory.
I.handleDownloads('downloads/largeFilesName.txt');I.click('Download large File');I.amInPath('output/downloads');I.waitForFile('largeFilesName.txt', 10); // wait 10 seconds for fileParameters
Section titled “Parameters”writeToFile
Section titled “writeToFile”Writes text to file