chore: add mock license server
This commit is contained in:
28
packages/e2e-tests/license-server-with-mock.js
Normal file
28
packages/e2e-tests/license-server-with-mock.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const fs = require('node:fs');
|
||||
const https = require('node:https');
|
||||
const path = require('node:path');
|
||||
const { run, send } = require('micro');
|
||||
|
||||
const options = {
|
||||
key: fs.readFileSync(path.join(__dirname, './automatisch.io+4-key.pem')),
|
||||
cert: fs.readFileSync(path.join(__dirname, './automatisch.io+4.pem')),
|
||||
};
|
||||
|
||||
const microHttps = (fn) =>
|
||||
https.createServer(options, (req, res) => run(req, res, fn));
|
||||
|
||||
const server = microHttps(async (req, res) => {
|
||||
const data = {
|
||||
id: '7f22d7dd-1fda-4482-83fa-f35bf974a21f',
|
||||
name: 'Mocked license',
|
||||
expireAt: '2030-08-09T10:56:54.144Z',
|
||||
};
|
||||
|
||||
send(res, 200, data);
|
||||
});
|
||||
|
||||
server
|
||||
.once('listening', () => {
|
||||
console.log('The mock server is up.');
|
||||
})
|
||||
.listen(443);
|
@@ -5,6 +5,7 @@
|
||||
"private": true,
|
||||
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
||||
"scripts": {
|
||||
"start-mock-license-server": "node ./license-server-with-mock.js",
|
||||
"test": "playwright test",
|
||||
"test:fast": "yarn test -j 90% --quiet --reporter null --ignore-snapshots -x"
|
||||
},
|
||||
@@ -26,6 +27,7 @@
|
||||
"@playwright/test": "^1.36.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv": "^16.3.1"
|
||||
"dotenv": "^16.3.1",
|
||||
"micro": "^10.0.1"
|
||||
}
|
||||
}
|
||||
|
@@ -22,15 +22,16 @@ module.exports = defineConfig({
|
||||
/* Timeout threshold for each test */
|
||||
timeout: 30000,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: process.env.CI ? 'github' : 'html',
|
||||
reporter: process.env.CI
|
||||
? [['html', { open: 'never' }], ['github']]
|
||||
: [['html', { open: 'never' }]],
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: process.env.BASE_URL
|
||||
|| 'http://localhost:3001',
|
||||
baseURL: process.env.BASE_URL || 'http://localhost:3001',
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
trace: 'retain-on-failure',
|
||||
testIdAttribute: 'data-test',
|
||||
viewport: { width: 1280, height: 720 },
|
||||
},
|
||||
|
Reference in New Issue
Block a user