tldraw/scripts/e2e/commands/selenium-grid.ts
Orange Mug 545e421423
Adds CI for webdriver tests (#1343)
Github action CI workflows added for webdriver tests.

I've also refactored the `./scripts/e2e-*` scripts. These scripts were
somewhat unique compared to the other scripts. They are now more inline
with the other scripts in that directory and run via

```
% yarn e2e --help                               
Usage: yarn e2e <command> [options]

Commands:
  yarn e2e serve              start test server
  yarn e2e test:ci [env]      runner for CI (github-actions)
  yarn e2e test:local         run webdriver tests locally
  yarn e2e test:browserstack  run webdriver tests on browserstack
  yarn e2e selenium:grid      start selenium grid (test linux)

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]
``` 

I've also added an experimental linux runner see 


2cca4ddb77/e2e/README.md (L320-L333)

### Change Type

- [x] `tests` — Changes to any testing-related code only (will not
publish a new version)


### Release Notes

- Github action CI workflows added for webdriver tests
- Refactored e2e test runner
2023-05-12 15:25:14 +00:00

36 lines
704 B
TypeScript

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]
})
}