-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(ui): implement automated browser testing #687
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,9 @@ | ||
/** | ||
* @overview Karma SauceLabs start up script. | ||
* | ||
* Used to initialize minified HelixUI ES Modules for testing. | ||
*/ | ||
|
||
import HelixUI from './dist/js/helix-ui.module.min.js'; | ||
|
||
HelixUI.initialize(); |
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,98 @@ | ||
/* eslint-env node */ | ||
const { createDefaultConfig } = require('@open-wc/testing-karma'); | ||
const merge = require('deepmerge'); | ||
|
||
const customLaunchers = { | ||
mac_firefox: { | ||
base: 'SauceLabs', | ||
browserName: 'firefox', | ||
platform: 'OS X 10.13', | ||
version: 'latest-1' | ||
}, | ||
mac_safari: { | ||
base: 'SauceLabs', | ||
browserName: 'safari', | ||
platform: 'OS X 10.13', | ||
version: 'latest-1' | ||
}, | ||
mac_chrome: { | ||
base: 'SauceLabs', | ||
browserName: 'chrome', | ||
platform: 'OS X 10.13', | ||
version: 'latest-1' | ||
}, | ||
win_edge_legacy: { | ||
base: 'SauceLabs', | ||
browserName: 'microsoftedge', | ||
platform: 'Windows 10', | ||
version: '18.17763' | ||
}, | ||
win_10_ie_11: { | ||
base: 'SauceLabs', | ||
browserName: 'internet explorer', | ||
platform: 'Windows 10', | ||
version: '11.285', | ||
}, | ||
// win_edge_chromium: { // Current SL config only allows 5 browsers per test run | ||
// base: 'SauceLabs', | ||
// browserName: 'microsoftedge', | ||
// platform: 'Windows 10', | ||
// version: 'latest' | ||
// }, | ||
}; | ||
|
||
module.exports = config => { | ||
config.set( | ||
merge(createDefaultConfig(config), { | ||
files: [ | ||
// runs all files ending with .test in the test folder, | ||
// can be overwritten by passing a --grep flag. examples: | ||
// | ||
// npm run test -- --grep test/foo/bar.test.js | ||
// npm run test -- --grep test/bar/* | ||
{ pattern: 'karma-sauce-init.js', | ||
type: 'module' | ||
}, | ||
{ pattern: config.grep ? config.grep : 'src/elements/**/*.spec.js', | ||
type: 'module' | ||
}, | ||
], | ||
// see the karma-esm docs for all options | ||
esm: { | ||
// if you are using 'bare module imports' you will need this option | ||
nodeResolve: true, | ||
compatibility: 'max', | ||
moduleDirs: ['node_modules', 'dist'], | ||
}, | ||
sauceLabs: { | ||
testName: 'HelixUI Component Unit Tests', | ||
public: "public restricted", | ||
recordVideo: false, | ||
// recordLogs: false, | ||
}, | ||
customLaunchers: customLaunchers, | ||
browsers: Object.keys(customLaunchers), | ||
reporters: ['dots', 'saucelabs'], | ||
singleRun: true, | ||
browserDisconnectTimeout : 120000, // default 2000 | ||
browserDisconnectTolerance : 10, // default 0 | ||
browserNoActivityTimeout: 120000, // default 10000 | ||
captureTimeout: 120000, // default 60000 | ||
concurrency: 5, | ||
client: { | ||
mocha: { | ||
timeout : 10000 | ||
} | ||
}, | ||
polyfillsLoader: { | ||
polyfills: { | ||
webcomponents: true, | ||
shadyCssCustomStyle: true, | ||
}, | ||
}, | ||
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
}), | ||
); | ||
return config; | ||
}; |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was updated because IE11 and Legacy Edge (plus older modern browsers) do not have a "real" Shadow DOM. That's one of the main reasons why we need and use pollyfills.