545e421423
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
289 lines
6.6 KiB
JavaScript
289 lines
6.6 KiB
JavaScript
const { BUILD_NAME, logBrowserstackUrl } = require('./wdio.util')
|
|
|
|
global.webdriverService = 'browserstack'
|
|
global.webdriverTestUrl = 'http://localhost:5420/'
|
|
|
|
exports.config = {
|
|
user: process.env.BROWSERSTACK_USER,
|
|
key: process.env.BROWSERSTACK_KEY,
|
|
hostname: 'hub.browserstack.com',
|
|
specs: ['./test/specs/index.ts'],
|
|
services: [
|
|
[
|
|
'browserstack',
|
|
{
|
|
browserstackLocal: true,
|
|
testObservability: true,
|
|
testObservabilityOptions: {
|
|
projectName: 'tldraw',
|
|
buildName: BUILD_NAME,
|
|
buildTag: process.env.GITHUB_SHA || 'local',
|
|
},
|
|
opts: {
|
|
verbose: 'true',
|
|
},
|
|
},
|
|
],
|
|
],
|
|
exclude: [],
|
|
maxInstances: 1,
|
|
waitforInterval: 200,
|
|
/**
|
|
* Capabilities can be configured via <https://www.browserstack.com/automate/capabilities>
|
|
*
|
|
* The once commented out currently fail on because of insecure certs, details <https://www.browserstack.com/guide/how-to-test-https-websites-from-localhost>
|
|
*/
|
|
capabilities: [
|
|
/**
|
|
* ====================================================================
|
|
* Windows 11
|
|
* ====================================================================
|
|
*/
|
|
{
|
|
'bstack:options': {
|
|
os: 'Windows',
|
|
osVersion: '11',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '3.14.0',
|
|
},
|
|
browserName: 'Chrome',
|
|
'tldraw:options': {
|
|
browser: 'chrome',
|
|
os: 'windows',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
os: 'Windows',
|
|
osVersion: '11',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '4.6.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'Edge',
|
|
'tldraw:options': {
|
|
browser: 'edge',
|
|
os: 'windows',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
os: 'Windows',
|
|
osVersion: '11',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '4.6.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'Firefox',
|
|
'tldraw:options': {
|
|
browser: 'firefox',
|
|
os: 'windows',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
/**
|
|
* ====================================================================
|
|
* MacOS
|
|
* ====================================================================
|
|
*/
|
|
// {
|
|
// 'bstack:options' : {
|
|
// "os" : "OS X",
|
|
// "osVersion" : "Ventura",
|
|
// "browserVersion" : "16.0",
|
|
// "seleniumVersion" : "4.6.0",
|
|
// },
|
|
// "acceptInsecureCerts" : "true",
|
|
// "browserName" : "Safari",
|
|
// },
|
|
{
|
|
'bstack:options': {
|
|
os: 'OS X',
|
|
osVersion: 'Ventura',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '4.6.0',
|
|
},
|
|
browserName: 'Chrome',
|
|
'tldraw:options': {
|
|
browser: 'chrome',
|
|
os: 'macos',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
os: 'OS X',
|
|
osVersion: 'Ventura',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '4.6.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'Firefox',
|
|
'tldraw:options': {
|
|
browser: 'firefox',
|
|
os: 'macos',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
os: 'OS X',
|
|
osVersion: 'Ventura',
|
|
browserVersion: 'latest',
|
|
seleniumVersion: '4.6.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'Edge',
|
|
'tldraw:options': {
|
|
browser: 'edge',
|
|
os: 'macos',
|
|
ui: 'desktop',
|
|
device: 'desktop',
|
|
input: ['mouse'],
|
|
},
|
|
},
|
|
/**
|
|
// * ====================================================================
|
|
// * Android
|
|
// * ====================================================================
|
|
// */
|
|
{
|
|
'bstack:options': {
|
|
osVersion: '13.0',
|
|
deviceName: 'Google Pixel 7',
|
|
appiumVersion: '1.22.0',
|
|
},
|
|
browserName: 'chrome',
|
|
'tldraw:options': {
|
|
appium: true,
|
|
browser: 'chrome',
|
|
os: 'android',
|
|
ui: 'mobile',
|
|
device: 'mobile',
|
|
input: ['touch'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
osVersion: '11.0',
|
|
deviceName: 'Samsung Galaxy S21',
|
|
appiumVersion: '1.22.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'samsung',
|
|
'tldraw:options': {
|
|
appium: true,
|
|
browser: 'samsung',
|
|
os: 'android',
|
|
ui: 'mobile',
|
|
device: 'mobile',
|
|
input: ['touch'],
|
|
},
|
|
},
|
|
{
|
|
'bstack:options': {
|
|
osVersion: '11.0',
|
|
deviceName: 'Samsung Galaxy S21',
|
|
appiumVersion: '1.22.0',
|
|
},
|
|
acceptInsecureCerts: 'true',
|
|
browserName: 'chrome',
|
|
'tldraw:options': {
|
|
appium: true,
|
|
browser: 'chrome',
|
|
os: 'android',
|
|
ui: 'mobile',
|
|
device: 'mobile',
|
|
input: ['touch'],
|
|
},
|
|
},
|
|
/**
|
|
* ====================================================================
|
|
* iOS
|
|
* ====================================================================
|
|
*/
|
|
// {
|
|
// 'bstack:options': {
|
|
// "osVersion" : "16",
|
|
// "deviceName" : "iPhone 14",
|
|
// "appiumVersion": "1.22.0"
|
|
// },
|
|
// "acceptInsecureCerts" : "true",
|
|
// "browserName" : "safari",
|
|
// },
|
|
// {
|
|
// 'bstack:options': {
|
|
// "osVersion" : "16",
|
|
// "deviceName" : "iPad Pro 12.9 2022",
|
|
// "appiumVersion": "1.22.0"
|
|
// },
|
|
// "acceptInsecureCerts" : "true",
|
|
// "browserName" : "safari",
|
|
// },
|
|
]
|
|
.map((capability) => {
|
|
return {
|
|
...capability,
|
|
acceptInsecureCerts: true,
|
|
'bstack:options': {
|
|
...capability['bstack:options'],
|
|
projectName: 'tldraw',
|
|
buildName: BUILD_NAME,
|
|
consoleLogs: 'verbose',
|
|
},
|
|
'tldraw:options': {
|
|
...capability['tldraw:options'],
|
|
},
|
|
}
|
|
})
|
|
.filter((capability) => {
|
|
const { os, browser } = capability['tldraw:options']
|
|
const envOsKey = `WD_OS_${os.toUpperCase()}`
|
|
const envBrowserKey = `WD_BROWSER_${browser.toUpperCase()}`
|
|
const envOsValue = process.env[envOsKey]
|
|
const envBrowserValue = process.env[envBrowserKey]
|
|
return !(envOsValue === 'false' || envBrowserValue === 'false')
|
|
}),
|
|
bail: 0,
|
|
waitforTimeout: 10000,
|
|
connectionRetryTimeout: 120000,
|
|
connectionRetryCount: 3,
|
|
framework: 'mocha',
|
|
reporters: ['spec'],
|
|
mochaOpts: {
|
|
ui: 'bdd',
|
|
timeout: 5 * 60 * 1000,
|
|
},
|
|
logLevel: process.env.WD_LOG_LEVEL ?? 'info',
|
|
coloredLogs: true,
|
|
screenshotPath: './errorShots/',
|
|
waitforTimeout: 30000,
|
|
connectionRetryTimeout: 90000,
|
|
connectionRetryCount: 3,
|
|
beforeSession: (_config, capabilities) => {
|
|
global.tldrawOptions = capabilities['tldraw:options']
|
|
},
|
|
afterSession: async (_config, capabilities, _specs) => {
|
|
await logBrowserstackUrl()
|
|
},
|
|
autoCompileOpts: {
|
|
autoCompile: true,
|
|
tsNodeOpts: {
|
|
transpileOnly: true,
|
|
swc: true,
|
|
project: './tsconfig.json',
|
|
},
|
|
},
|
|
}
|