mirror of
https://github.com/plausible/analytics.git
synced 2024-11-30 00:58:54 +03:00
99fd101135
* Add basic test harness for browserstack/playwright * Refactor the tests * added the first test for outbound links * tests for outbound-links and file-downloads * added more browser versions to test on * Lint tracker test files * Update harness.js with BrowserStack example * Fix Playwright request mocks * Add test harness to CI * Remove Safari on Windows from browsers list Co-authored-by: Robert <robertjoonas16@gmail.com> Co-authored-by: Vinicius Brasil <vini@hey.com>
31 lines
838 B
JavaScript
31 lines
838 B
JavaScript
// global-setup.js
|
|
const { bsLocal, ensureCredentials, BS_LOCAL_ARGS } = require('./browserstack');
|
|
const { promisify } = require('util');
|
|
const { runLocalFileServer } = require('./server')
|
|
|
|
const sleep = promisify(setTimeout);
|
|
const redColour = '\x1b[31m';
|
|
const whiteColour = '\x1b[0m';
|
|
|
|
ensureCredentials()
|
|
|
|
module.exports = async () => {
|
|
console.log('Starting BrowserStackLocal ...');
|
|
runLocalFileServer()
|
|
// Starts the Local instance with the required arguments
|
|
let localResponseReceived = false;
|
|
bsLocal.start(BS_LOCAL_ARGS, (err) => {
|
|
if (err) {
|
|
console.error(
|
|
`${redColour}Error starting BrowserStackLocal${whiteColour}`
|
|
);
|
|
} else {
|
|
console.log('BrowserStackLocal Started');
|
|
}
|
|
localResponseReceived = true;
|
|
});
|
|
while (!localResponseReceived) {
|
|
await sleep(1000);
|
|
}
|
|
};
|