UNPKG

askui

Version:

Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on

24 lines (23 loc) 1.13 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnnotationWriter = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const logger_1 = require("../../lib/logger"); class AnnotationWriter { static write(html, outputFolder = 'report', fileNamePrefix = 'annotation') { const currentDateTime = new Date(); const currentTimeStringOnlyNumbers = currentDateTime.toISOString().replace(/\D/g, ''); const fileName = `${currentTimeStringOnlyNumbers}_${fileNamePrefix}.html`; const outputFilePath = path_1.default.join(outputFolder, fileName); if (!(fs_1.default.existsSync(outputFolder))) { fs_1.default.mkdirSync(outputFolder, { recursive: true }); } fs_1.default.writeFileSync(outputFilePath, html.serialize()); logger_1.logger.info(`Annotation saved under "${outputFilePath}".`); } } exports.AnnotationWriter = AnnotationWriter;