1 import { ChildProcessWithoutNullStreams } from 'child_process'
2 import { basename } from 'path'
3 import { runCommand, runServer } from './server'
5 let appInstance: string
6 let app: ChildProcessWithoutNullStreams
8 async function beforeLocalSuite (suite: any) {
9 const config = buildConfig(suite.file)
11 await runCommand('npm run clean:server:test -- ' + appInstance)
12 app = runServer(appInstance, config)
15 function afterLocalSuite () {
20 function beforeLocalSession (config: { baseUrl: string }, capabilities: { browserName: string }) {
21 appInstance = capabilities['browserName'] === 'chrome' ? '1' : '2'
22 config.baseUrl = 'http://localhost:900' + appInstance
25 async function onBrowserStackPrepare () {
26 const appInstance = '1'
28 await runCommand('npm run clean:server:test -- ' + appInstance)
29 app = runServer(appInstance)
32 function onBrowserStackComplete () {
41 onBrowserStackPrepare,
42 onBrowserStackComplete
45 // ---------------------------------------------------------------------------
47 function buildConfig (suiteFile: string = undefined) {
48 const filename = basename(suiteFile)
50 if (filename === 'custom-server-defaults.e2e-spec.ts') {
54 download_enabled: false,
55 comments_enabled: false,
71 if (filename === 'signup.e2e-spec.ts') {