1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/tests/lib/screenshot-testing/run-tests.js
Stefan Giehl 5becf54bff Run each UI test suite in its own browser context (#22302)
* try using a new browser context for each test suite

* avoid clearing cookies before or after suite
this is now automatically done by creating a new browser context for each suite

* set browser language

* fix test

* Tweak code comment so it's easier to understand

---------

Co-authored-by: Michal Kleiner <michal@innocraft.com>
2024-06-11 09:00:49 +02:00

65 خطوط
1.7 KiB
JavaScript
Vendored

/*!
* Matomo - free/libre analytics platform
*
* UI test runner script
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; // ignore ssl errors
const path = require('path');
const puppeteer = require('puppeteer');
const setUpGlobals = require('./support/globals.js');
const Mocha = require('mocha');
const chai = require('chai');
const chaiFiles = require('chai-files');
require('./support/fs-extras');
main();
async function main() {
// require config and local config overrides
let config = require("./../../UI/config.dist");
try {
config = Object.assign({}, config, require("./../../UI/config"));
} catch (e) {
// ignore
}
const browser = await puppeteer.launch(config.browserConfig);
const originalUserAgent = await browser.userAgent();
// assume the URI points to a folder and make sure Piwik won't cut off the last path segment
if (config.phpServer.REQUEST_URI.slice(-1) !== '/') {
config.phpServer.REQUEST_URI += '/';
}
setUpGlobals(config, browser, originalUserAgent);
mocha = new Mocha({
ui: 'bdd',
bail: false,
reporter: config.reporter,
reporterOptions: config.reporterOptions,
color: 1,
timeout: options.timeout || 240000,
});
const imageAssert = require('./support/chai-extras');
chai.use(imageAssert());
chai.use(chaiFiles);
// run script
if (options['help']) {
app.printHelpAndExit();
}
// the mocha-super-suite imports the individual specs. kept for expedience when converting to chromium
// headless.
mocha.addFile(path.join(__dirname, 'mocha-super-suite.js'));
app.runTests(mocha)
}