@uuv/playwright
Version:
A solution to facilitate the writing and execution of E2E tests understandable by any human being using cucumber(BDD) and playwright
50 lines (49 loc) • 1.94 kB
JavaScript
/**
* Software Name : UUV
*
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT License,
* see the "LICENSE" file for more details
*
* Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
* Software description: Make test writing fast, understandable by any human
* understanding English or French.
*/
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const runner_playwright_1 = require("./runner-playwright");
const chokidar_1 = __importDefault(require("chokidar"));
const chalk_1 = __importDefault(require("chalk"));
const tempDir = process.argv[2];
const projectDir = process.argv[3];
const tags = process.argv[4];
if (!tempDir || !projectDir) {
console.log(chalk_1.default.redBright("An error occurred during test files watching"));
process.exit(-1);
}
chokidar_1.default.watch(`${projectDir}/e2e`, {
ignoreInitial: true,
ignored: (path, stats) => !!stats && stats.isFile() && !path.endsWith(".feature")
})
.on("change", path => {
console.log(chalk_1.default.yellowBright("\nRefreshing test files..."));
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
}
})
.on("add", path => {
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been added`));
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
}
})
.on("unlink", path => {
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been removed`));
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
}
});