tm-playwright-framework
Version:
Playwright Cucumber TS framework - The easiest way to learn
51 lines (50 loc) • 3.06 kB
TypeScript
/**
* FILES.TS
*
* This TypeScript file contains methods to handle file management operations.
*
* @author Sasitharan, Govindharam
* @reviewer Sahoo, AshokKumar
* @version 1.0 - 1st-JUNE-2025
*
* @methods
* - `uploadFile`: Accepts an element locator as a `string` or Element and uploads a file from the given absolute or relative path.
* - `uploadMultipleFiles`: Accepts an element locator as a `string` or Element and uploads selected files from the given absolute or relative path.
* - `uploadFileByRelativePath`: Accepts an element locator as a `string` or Element and uploads a file from the given relative path.
* - `uploadMultipleFilesByRelativePath`: Accepts an element locator as a `string` or Element and uploads selected files from the given relative path.
*/
export default class FileUploadActions {
constructor();
/**
* Accepts an element locator as a `string` or Element and uploads a file from the given absolute or relative path.
* @param {any} locator - The locator string or Element to identify the input field.
* @param {string} filePath - The absolute path or relative file path of the file to upload.
* @param {number} [timeOut=30000] - Optional timeout in milliseconds.
* @returns {Promise<void>} - Resolves when the file is uploaded.
*/
uploadFile(locator: any, filePath: string, timeOut?: number): Promise<void>;
/**
* Accepts an element locator as a `string` or Element and uploads selected files from the given absolute or relative path.
* @param {string} locator - The locator string or Element to identify the input field.
* @param {string[]} filePath - An array of absolute paths of the files to upload.
* @param {number} [timeOut=30000] - Optional timeout in milliseconds.
* @returns {Promise<void>} - Resolves when the files are uploaded.
*/
uploadMultipleFiles(locator: string, filePath: string[], timeOut?: number): Promise<void>;
/**
* Accepts an element locator as a `string` or Element and uploads a file from the given relative path.
* @param {string} locator - The locator string or Element to identify the input field.
* @param {string} filePath - The relative path of the file to upload.
* @param {number} [timeOut=30000] - Optional timeout in milliseconds.
* @returns {Promise<void>} - Resolves when the file is uploaded.
*/
uploadFileByRelativePath(locator: string, filePath: string, timeOut?: number): Promise<void>;
/**
* Accepts an element locator as a `string` or Element and uploads selected files from the given relative path.
* @param {string} locator - The locator string or Element to identify the input field.
* @param {string[]} filePath - An array of relative paths of the files to upload.
* @param {number} [timeOut=30000] - Optional timeout in milliseconds.
* @returns {Promise<void>} - Resolves when the files are uploaded.
*/
uploadMultipleFilesByRelativePath(locator: string, filePath: string[], timeOut?: number): Promise<void>;
}