-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(mux-player): Basic POC and impl for web-test-runner + SauceLabs.
- Loading branch information
1 parent
f6f99b3
commit 00c757d
Showing
3 changed files
with
2,767 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
packages/mux-player/test/web-test-runner.saucelabs.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import { esbuildPlugin } from '@web/dev-server-esbuild'; | ||
import { importMapsPlugin } from '@web/dev-server-import-maps'; | ||
import { createSauceLabsLauncher } from '@web/test-runner-saucelabs'; | ||
import { legacyPlugin } from '@web/dev-server-legacy'; | ||
|
||
// configure the local Sauce Labs proxy, use the returned function to define the | ||
// browsers to test | ||
const sauceLabsLauncher = createSauceLabsLauncher({ | ||
// your username and key for Sauce Labs, you can get this from your Sauce Labs account | ||
// it's recommended to store these as environment variables | ||
// Example for macOS/Linux: | ||
// export SAUCE_USERNAME=my_username | ||
// export SAUCE_ACCESS_KEY=my_access_key | ||
// Permanent (zsh) | ||
// echo 'export SAUCE_USERNAME=my_username' >> ~/.zshenv | ||
// echo 'export SAUCE_ACCESS_KEY=my_access_key' >> ~/.zshenv | ||
// # to reload/apply immediately in current terminal | ||
// source ~/.zshenv | ||
user: process.env.SAUCE_USERNAME, | ||
key: process.env.SAUCE_ACCESS_KEY, | ||
// the Sauce Labs datacenter to run your tests on, defaults to 'us-west-1' | ||
// region: "eu-central-1", | ||
}); | ||
|
||
const sharedCapabilities = { | ||
'sauce:options': { | ||
name: `${process.env.npm_package_name} required tests`, | ||
// if you are running tests in a CI, the build id might be available as an | ||
// environment variable. this is useful for identifying test runs | ||
// this is for example the name for github actions | ||
build: `package: ${process.env.npm_package_name} ${process.env.GITHUB_REF || 'local'} build ${process.env.GITHUB_RUN_NUMBER || ''}`, | ||
}, | ||
}; | ||
|
||
/** @TODO Should probably share these (whatever ends up being shareable in the full impl) between this and web-test-runner.config.mjs (CJP) */ | ||
const config = { | ||
nodeResolve: true, | ||
plugins: [ | ||
importMapsPlugin({ | ||
inject: { | ||
importMap: { | ||
imports: { | ||
'/test/': '/packages/mux-player/test/', | ||
}, | ||
}, | ||
}, | ||
}), | ||
esbuildPlugin({ | ||
ts: true, | ||
json: true, | ||
loaders: { '.css': 'text', '.svg': 'text', '.html': 'text' }, | ||
}), | ||
], | ||
coverageConfig: { | ||
report: true, | ||
include: ['src/**/*'], | ||
}, | ||
testsFinishTimeout: 600000, | ||
}; | ||
|
||
export default { | ||
...config, | ||
concurrentBrowsers: 2, | ||
concurrency: 6, | ||
browserStartTimeout: 1000 * 30 * 5, | ||
sessionStartTimeout: 1000 * 30 * 5, | ||
sessionFinishTimeout: 1000 * 30 * 5, | ||
browsers: [ | ||
sauceLabsLauncher({ | ||
...sharedCapabilities, | ||
browserName: 'chrome', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 10', | ||
}), | ||
// sauceLabsLauncher({ | ||
// ...sharedCapabilities, | ||
// browserName: "chrome", | ||
// browserVersion: "latest-1", | ||
// platformName: "Windows 10", | ||
// }), | ||
sauceLabsLauncher({ | ||
...sharedCapabilities, | ||
browserName: 'firefox', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 10', | ||
}), | ||
sauceLabsLauncher({ | ||
...sharedCapabilities, | ||
browserName: 'MicrosoftEdge', | ||
browserVersion: 'latest', | ||
platformName: 'Windows 10', | ||
}), | ||
// sauceLabsLauncher({ | ||
// ...sharedCapabilities, | ||
// browserName: "MicrosoftEdge", | ||
// browserVersion: "18", | ||
// platformName: "Windows 10", | ||
// }), | ||
// sauceLabsLauncher({ | ||
// ...sharedCapabilities, | ||
// browserName: 'internet explorer', | ||
// browserVersion: '11.0', | ||
// platformName: 'Windows 7', | ||
// }), | ||
sauceLabsLauncher({ | ||
...sharedCapabilities, | ||
browserName: 'safari', | ||
browserVersion: 'latest', | ||
platformName: 'macOS 10.15', | ||
}), | ||
], | ||
// NOTE: Could consider a deep merge to avoid unintentional overwrites using simple spread (CJP) | ||
plugins: [...config.plugins, legacyPlugin()], | ||
testFramework: { | ||
config: { | ||
timeout: '10000', | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.