Initial commit of the Playwright test framework, including: - Configuration files for Playwright, Docker, and Sauce Labs - Test case structure and page object models - CI/CD pipeline configuration - Utilities and business logic implementations This framework will be used for end-to-end testing of the FMG application.
22 lines
691 B
TypeScript
22 lines
691 B
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
export function writeFileToLocalCache(fileNameWithExtension: string, fileContents: string) {
|
|
const folderPath = path.join(process.cwd(), '.debug', '.cache');
|
|
const filePath = path.join(folderPath, fileNameWithExtension);
|
|
|
|
|
|
try {
|
|
// Create the folder if it doesn't exist
|
|
if (!fs.existsSync(folderPath)) {
|
|
fs.mkdirSync(folderPath, { recursive: true });
|
|
}
|
|
|
|
// Write the data to the file
|
|
fs.writeFileSync(filePath, fileContents);
|
|
|
|
console.log(`File "${filePath}" created successfully.`);
|
|
} catch (error) {
|
|
console.error('Error creating the file:', error);
|
|
}
|
|
}
|