File Input
The FileInput class simplifies select & upload interactions in Spartify tests, offering selecting, assertion, and scrolling functionalities. These methods improve test maintainability and execution efficiency, ensuring a robust test framework
Class : FileInput
The FileInput class is designed to interact with the file-upload & drag-drop element
import { SpartiUI } from "@spartify.io/spartify-engine";
SpartiUI.fileInput(this.file_element).selectFile(‘c:/myfile.png’):
Methods & Usage
Navigation Methods
selectFile(filePath: string): void
Selects a file for the file input element.
@param filePath - the path of the file to be selected.
@return void
SpartiUI.fileInput(this.file_element).selectFile(‘c:/myfile.png’);
clearFileInput(): void
Clears the file input element.
@return void
SpartiUI.fileInput(this.file_element).clearFileInput();
uploadMultipleFiles(filePaths: string[]): void
Uploads multiple files to the file input element.
@param filePaths - an array of file paths to be uploaded
@return void
SpartiUI.fileInput(this.file_element).uploadMultipleFiles([‘c:/file.png’, ‘c:image.png’]);
checkFileInputValue(expectedFileName: string): void
Checks the value of the file input element against the expected file name.
@param expectedFileName - the expected file name
@return void
SpartiUI.fileInput(this.file_element).checkFileInputValue(‘file.png’);
Assertions
assertFileInputExists(): void
Asserts that the file input element exists in the DOM.
@return void
SpartiUI.fileInput(this.file_element).assertFileInputExists();
assertFileInputIsVisible(): void
Asserts that the file input element is visible.
@return void
SpartiUI.fileInput(this.file_element).assertFileInputIsVisible();