libreoffice-online/cypress_test/plugins/tasks.js
Henry Castro 3c0731bf2c cypress: add emacs mode lines
Change-Id: I2cb19d34639ea6af55c693fad7bef8855a0ccba3
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-07-10 10:49:04 -04:00

40 lines
979 B
JavaScript

/* -*- js-indent-level: 8 -*- */
/* global require Promise */
var fs = require('fs');
var list = require('./selectorList').list;
function copyFile(args) {
return new Promise(function(resolve) {
var sourceFile = args.sourceDir + args.fileName;
var destFileName;
if (args.destFileName) {
destFileName = args.destFileName;
} else {
destFileName = args.fileName;
}
var destFile = args.destDir + destFileName;
if (fs.existsSync(sourceFile)) {
fs.mkdirSync(args.destDir, { recursive: true });
if (fs.existsSync(destFile)) {
fs.unlinkSync(destFile);
}
fs.writeFileSync(destFile, fs.readFileSync(sourceFile));
resolve('File ${sourceFile} copied to ${destFile}');
}
resolve('File ${sourceFile} does not exist');
});
}
function getSelectors(args) {
if (args.mode === 'notebookbar') {
return list[args.name][0];
} else {
return list[args.name][1];
}
}
module.exports.copyFile = copyFile;
module.exports.getSelectors = getSelectors;