[chore] remove webdriver dependencies / scripts (#1488)
This PR removes scripts and other dependencies associated with webdriver tests. ### Change Type - [x] `internal` — Any other changes that don't affect the published package (will not publish a new version)
This commit is contained in:
parent
a220b2eff1
commit
3753acf5ce
11 changed files with 13 additions and 800 deletions
|
@ -1,7 +0,0 @@
|
|||
import seleniumGrid from './selenium-grid'
|
||||
import serve from './serve'
|
||||
import testBrowserstack from './test-browserstack'
|
||||
import testCi from './test-ci'
|
||||
import testLocal from './test-local'
|
||||
|
||||
export { testCi, testLocal, testBrowserstack, seleniumGrid, serve }
|
|
@ -1,36 +0,0 @@
|
|||
import { promiseSpawn } from './util'
|
||||
|
||||
export default async function seleniumGrid() {
|
||||
// NOTE: This should work on non-macos, but it's only be tested on macos with M1 chipset
|
||||
const command = 'docker'
|
||||
let args: string[] = []
|
||||
if (process.arch === 'arm64') {
|
||||
args = [
|
||||
`run`,
|
||||
`-t`,
|
||||
`--platform`,
|
||||
`linux/amd64`,
|
||||
`-p`,
|
||||
`4444:4444`,
|
||||
`-p`,
|
||||
`7900:7900`,
|
||||
`--shm-size=2g`,
|
||||
`seleniarm/standalone-firefox:latest`,
|
||||
]
|
||||
} else {
|
||||
args = [
|
||||
'run',
|
||||
'-t',
|
||||
'-p',
|
||||
'4444:4444',
|
||||
'-p',
|
||||
'7900:7900',
|
||||
`--shm-size=2g`,
|
||||
`selenium/standalone-firefox:latest`,
|
||||
]
|
||||
}
|
||||
|
||||
return promiseSpawn(command, args, {
|
||||
stdio: [0, 0, 0], // Use parent's [stdin, stdout, stderr]
|
||||
})
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
import { promiseSpawn } from './util'
|
||||
|
||||
export default async function serve() {
|
||||
return promiseSpawn('yarn', ['dev-webdriver'], {
|
||||
stdio: [0, 0, 0],
|
||||
env: { ...process.env },
|
||||
})
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import { promiseSpawn } from './util'
|
||||
|
||||
export default async function testBrowserstack({
|
||||
os,
|
||||
browser,
|
||||
}: {
|
||||
os: string[]
|
||||
browser: string[]
|
||||
}) {
|
||||
const command = `yarn`
|
||||
const args = [`workspace`, `@tldraw/e2e`, `test:remote`]
|
||||
return promiseSpawn(command, args, {
|
||||
env: {
|
||||
...process.env,
|
||||
BROWSERS: browser.join(','),
|
||||
OS: os.join(','),
|
||||
},
|
||||
stdio: [0, 0, 0], // Use parent's [stdin, stdout, stderr]
|
||||
})
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
import { ChildProcess, spawn } from 'node:child_process'
|
||||
import kill from 'tree-kill'
|
||||
import { exec } from '../../lib/exec'
|
||||
import { promiseSpawn } from './util'
|
||||
|
||||
export default async function testCi({ testEnv }: { testEnv: string }) {
|
||||
await promiseSpawn('yarn', ['workspace', '@tldraw/tldraw', 'prebuild'], {
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
stdio: [0, 0, 0], // Use parent's [stdin, stdout, stderr]
|
||||
})
|
||||
|
||||
const { success: foundStartMessage, commandProcess } = await new Promise<{
|
||||
success: boolean
|
||||
commandProcess: ChildProcess
|
||||
}>((resolve, reject) => {
|
||||
const p = spawn('yarn', ['dev-webdriver'], {
|
||||
env: {
|
||||
...process.env,
|
||||
ENABLE_SSL: '1',
|
||||
ENABLE_NETWORK_CACHING: '1',
|
||||
},
|
||||
})
|
||||
|
||||
const endHandler = () => {
|
||||
p.stdout.off('end', endHandler)
|
||||
reject({ success: false, commandProcess: p })
|
||||
}
|
||||
|
||||
const dataHandler = (data: any) => {
|
||||
if (data.toString().match(/\[tldraw:process_ready\]/gm)) {
|
||||
// p.stdout.off('data', dataHandler)
|
||||
resolve({ success: true, commandProcess: p })
|
||||
}
|
||||
console.log(`stdout: ${data}`)
|
||||
}
|
||||
p.stdout.on('data', dataHandler)
|
||||
p.stdout.on('close', endHandler)
|
||||
})
|
||||
|
||||
if (!foundStartMessage) {
|
||||
console.error('Failed to start server')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const exitCode = await exec('yarn', ['workspace', '@tldraw/e2e', `test:${testEnv}`], {
|
||||
env: {
|
||||
...process.env,
|
||||
BROWSERS: ['chrome'].join(','),
|
||||
// OS: [process.platform].join(','),
|
||||
},
|
||||
})
|
||||
|
||||
if (commandProcess.pid) {
|
||||
kill(commandProcess.pid)
|
||||
}
|
||||
|
||||
return exitCode
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import { promiseSpawn } from './util'
|
||||
|
||||
export default async function testLocal({ os, browser }: { os: string; browser: string[] }) {
|
||||
const command = `yarn`
|
||||
const args = [`workspace`, `@tldraw/e2e`, `test:local`]
|
||||
return promiseSpawn(command, args, {
|
||||
env: {
|
||||
...process.env,
|
||||
BROWSERS: browser.join(','),
|
||||
OS: os,
|
||||
},
|
||||
stdio: [0, 0, 0], // Use parent's [stdin, stdout, stderr]
|
||||
})
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import { SpawnOptions, spawn } from 'child_process'
|
||||
import kill from 'tree-kill'
|
||||
|
||||
export function promiseSpawn(command: string, args: string[], opts: SpawnOptions) {
|
||||
return new Promise<number>((resolve) => {
|
||||
const p = spawn(command, args, opts)
|
||||
p.on('close', (exitCode) => {
|
||||
resolve(exitCode ?? 0)
|
||||
})
|
||||
process.on('SIGINT', () => {
|
||||
if (p.pid) {
|
||||
kill(p.pid)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
import { hideBin } from 'yargs/helpers'
|
||||
import yargs from 'yargs/yargs'
|
||||
import * as commands from './commands'
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
.usage('Usage: $0 <command> [options]')
|
||||
.scriptName('yarn e2e')
|
||||
.command(
|
||||
'serve',
|
||||
'start test server',
|
||||
(yargs) => {
|
||||
return yargs
|
||||
},
|
||||
async () => {
|
||||
const exitCode = await commands.serve()
|
||||
process.exit(exitCode)
|
||||
}
|
||||
)
|
||||
.command(
|
||||
'test:ci [env]',
|
||||
'runner for CI (github-actions)',
|
||||
(yargs) => {
|
||||
return yargs.positional('env', {
|
||||
type: 'string',
|
||||
default: 'local',
|
||||
choices: ['local', 'nightly'],
|
||||
})
|
||||
},
|
||||
async (argv) => {
|
||||
await commands.testCi({ testEnv: argv.env })
|
||||
// process.exit(exitCode)
|
||||
}
|
||||
)
|
||||
.command(
|
||||
'test:local',
|
||||
'run webdriver tests locally',
|
||||
(yargs) => {
|
||||
return yargs
|
||||
.option('browser', {
|
||||
alias: 'b',
|
||||
type: 'array',
|
||||
description: 'run with browsers',
|
||||
choices: ['chrome', 'firefox', 'safari', 'edge', 'vscode'],
|
||||
default: ['chrome'],
|
||||
})
|
||||
.option('os', {
|
||||
type: 'string',
|
||||
description: 'OS to run on (experimental)',
|
||||
choices: [process.platform, 'linux'],
|
||||
default: process.platform,
|
||||
})
|
||||
},
|
||||
async (argv) => {
|
||||
const exitCode = await commands.testLocal(argv)
|
||||
process.exit(exitCode)
|
||||
}
|
||||
)
|
||||
.command(
|
||||
'test:browserstack',
|
||||
'run webdriver tests on browserstack',
|
||||
(yargs) => {
|
||||
return yargs
|
||||
.option('browser', {
|
||||
alias: 'b',
|
||||
type: 'array',
|
||||
description: 'run with browsers',
|
||||
choices: ['chrome', 'firefox', 'safari', 'edge'],
|
||||
default: ['chrome'],
|
||||
})
|
||||
.option('os', {
|
||||
type: 'array',
|
||||
description: 'OS to run on (experimental)',
|
||||
choices: [process.platform, 'linux'],
|
||||
default: [process.platform],
|
||||
})
|
||||
},
|
||||
async (argv) => {
|
||||
const exitCode = await commands.testBrowserstack(argv)
|
||||
process.exit(exitCode)
|
||||
}
|
||||
)
|
||||
.command(
|
||||
'selenium:grid',
|
||||
'start selenium grid (test linux)',
|
||||
(yargs) => {
|
||||
return yargs
|
||||
},
|
||||
async () => {
|
||||
const exitCode = await commands.seleniumGrid()
|
||||
process.exit(exitCode)
|
||||
}
|
||||
)
|
||||
.strict()
|
||||
.parse()
|
Loading…
Add table
Add a link
Reference in a new issue