Sets up the core infrastructure for Playwright-based automated testing, including: - Docker support for consistent environments - Azure Pipelines configuration for CI/CD - Page Object Model structure for maintainable tests - Test data, validation, and rule engine implementation - Test configuration for alerts and other scenarios
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);
|
|
}
|
|
}
|