libreoffice-online/cypress_test/plugins/index.js
Tamás Zolnai 53642adf96 cypress: remove getLOVersion() method.
By now, we don't run the same online branch against more
core branches, so this code is obsolete.

Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I90768d16628e735129880cc4cf823bf0b7d9ad1e
2021-02-05 16:38:23 +01:00

88 lines
2.3 KiB
JavaScript

/* global require */
var process = require('process');
var uuid = require('uuid');
var tasks = require('./tasks');
var blacklists = require('./blacklists');
var selectTests = require('cypress-select-tests');
function plugin(on, config) {
if (config.env.COVERAGE_RUN)
require('@cypress/code-coverage/task')(on, config);
on('task', {
copyFile: tasks.copyFile,
failed: require('cypress-failed-log/src/failed')()
});
if (process.env.ENABLE_VIDEO_REC) {
config.video = true;
}
if (process.env.ENABLE_CONSOLE_LOG) {
require('cypress-log-to-output').install(on, function(type, event) {
if (event.level === 'error' || event.type === 'error') {
return true;
}
return false;
});
}
if (process.env.ENABLE_LOGGING) {
on('before:browser:launch', function(browser, launchOptions) {
if (browser.family === 'chromium') {
launchOptions.args.push('--enable-logging=stderr');
launchOptions.args.push('--v=2');
return launchOptions;
}
});
}
if (process.env.CYPRESS_INTEGRATION === 'php-proxy') {
config.defaultCommandTimeout = 10000;
}
on('file:preprocessor', (file) => {
if (file.outputPath.endsWith('support/index.js')) {
var runUuid = uuid.v4();
var truncLength = file.outputPath.length - ('index.js').length;
file.outputPath = file.outputPath.substring(0, truncLength);
file.outputPath += runUuid + 'index.js';
}
return selectTests(config, pickTests)(file);
});
return config;
}
function removeBlacklistedTest(filename, testsToRun, blackList) {
for (var i = 0; i < blackList.length; i++) {
if (filename.endsWith(blackList[i][0])) {
if (blackList[i][1].length === 0) // skip the whole test suite
return [];
return testsToRun.filter(fullTestName => !blackList[i][1].includes(fullTestName[1]));
}
}
return testsToRun;
}
function pickTests(filename, foundTests) {
var testsToRun = foundTests;
if (process.env.CYPRESS_INTEGRATION === 'nextcloud') {
testsToRun = removeBlacklistedTest(filename, testsToRun, blacklists.nextcloudBlackList);
} else {
testsToRun = removeBlacklistedTest(filename, testsToRun, blacklists.nextcloudOnlyList);
}
if (process.env.CYPRESS_INTEGRATION === 'php-proxy') {
var ProxyblackList = blacklists.phpProxyBlackList;
testsToRun = removeBlacklistedTest(filename, testsToRun, ProxyblackList);
}
return testsToRun;
}
module.exports = plugin;