mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-14 01:55:39 +00:00
* cicd: Move cypress to selenium+mocha * cicd: with is not supported unless using an a container * cicd: relative path to mocha * cicd: the integration-tests runner now starts/stops OliveTin * cicd: Knowing the CWD helps debugging * cicd: Headless chrome * cicd: wait for integration-test server to be started * fmt: Mostly fix isses from eslint * cicd: #169 - Test multiple combo boxes * fmt: let should be const * cicd: Remove cypress entirely
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
import process from 'node:process'
|
|
import waitOn from 'wait-on'
|
|
import { spawn } from 'node:child_process'
|
|
|
|
let ot = null
|
|
|
|
export default function getRunner () {
|
|
const type = process.env.OLIVETIN_TEST_RUNNER
|
|
|
|
console.log('OLIVETIN_TEST_RUNNER env value is: ', type)
|
|
|
|
switch (type) {
|
|
case 'local':
|
|
return new OliveTinTestRunnerLocalProcess()
|
|
case 'vm':
|
|
return null
|
|
case 'container':
|
|
return null
|
|
default:
|
|
return new OliveTinTestRunnerLocalProcess()
|
|
}
|
|
}
|
|
|
|
class OliveTinTestRunnerLocalProcess {
|
|
async start (cfg) {
|
|
ot = spawn('./../OliveTin', ['-configdir', 'configs/' + cfg + '/'])
|
|
|
|
const logStdout = process.env.OLIVETIN_TEST_RUNNER_LOG_STDOUT === '1'
|
|
|
|
if (logStdout) {
|
|
ot.stdout.on('data', (data) => {
|
|
console.log(`stdout: ${data}`)
|
|
})
|
|
|
|
ot.stderr.on('data', (data) => {
|
|
console.error(`stderr: ${data}`)
|
|
})
|
|
}
|
|
|
|
ot.on('close', (code) => {
|
|
if (code != null) {
|
|
console.log(`child process exited with code ${code}`)
|
|
}
|
|
})
|
|
|
|
/*
|
|
this.server = await startSomeServer({port: process.env.TEST_PORT});
|
|
console.log(`server running on port ${this.server.port}`);
|
|
*/
|
|
|
|
await waitOn({
|
|
'resources': ['http://localhost:1337/']
|
|
})
|
|
|
|
return ot
|
|
}
|
|
|
|
async stop () {
|
|
await ot.kill()
|
|
}
|
|
}
|