forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: setup visual tests, add bootstrap test suite
- Loading branch information
1 parent
679f8e8
commit 74e4bff
Showing
18 changed files
with
1,001 additions
and
58 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
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ lerna-debug.log | |
packages/**/src/**/styles/*-css.js | ||
packages/**/pkg | ||
coverage | ||
tmp | ||
test/visual/screenshots | ||
|
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,8 @@ | ||
hub: | ||
image: selenium/hub:3.11.0 | ||
ports: | ||
- 4444:4444 | ||
chrome: | ||
image: selenium/node-chrome:3.11.0 | ||
links: | ||
- hub |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
"author": "Serhii Kulykov <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
"argos": "argos upload test/visual/screenshots/chrome --token $ARGOS_TOKEN || true", | ||
"build": "yarn build-styling", | ||
"build-styling": "./scripts/build-styling.sh", | ||
"deploy-storybook": "storybook-to-ghpages", | ||
|
@@ -14,6 +15,7 @@ | |
"lint:scss": "stylelint packages/**/*.scss", | ||
"storybook": "start-storybook -p 6006", | ||
"test": "karma start", | ||
"test:visual": "rimraf tmp && BABEL_ENV=visual webpack --config test/visual/webpack.config.js && rimraf test/visual/screenshots/chrome/* && vrtest run --config test/visual/vrtest.config.js --record", | ||
"watch": "node scripts/watcher.js" | ||
}, | ||
"workspaces": [ | ||
|
@@ -24,12 +26,14 @@ | |
"@babel/plugin-transform-runtime": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"@babel/runtime": "^7.3.4", | ||
"@open-wc/testing-helpers": "^0.7.24", | ||
"@storybook/addon-knobs": "^5.0.3", | ||
"@storybook/addons": "^5.0.3", | ||
"@storybook/core": "^5.0.3", | ||
"@storybook/polymer": "^5.0.3", | ||
"@storybook/storybook-deployer": "^2.8.1", | ||
"@webcomponents/webcomponentsjs": "^2.2.4", | ||
"argos-cli": "^0.1.1", | ||
"babel-loader": "^8.0.5", | ||
"chai": "^4.2.0", | ||
"command-line-args": "^5.0.2", | ||
|
@@ -62,13 +66,16 @@ | |
"prettier": "^1.16.4", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4", | ||
"rimraf": "^2.6.3", | ||
"sass": "^1.17.2", | ||
"sinon": "^7.2.7", | ||
"sinon-chai": "^3.3.0", | ||
"stylelint": "^9.10.1", | ||
"stylelint-config-prettier": "^5.0.0", | ||
"stylelint-config-twbs-bootstrap": "^0.3.0", | ||
"webpack": "^4.29.6" | ||
"vrtest": "^0.2.0", | ||
"webpack": "^4.29.6", | ||
"webpack-cli": "^3.3.0" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
|
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,60 @@ | ||
import { css } from 'lit-element'; | ||
import { html, defineCE, unsafeStatic } from '@open-wc/testing-helpers'; | ||
import { AbsButton } from '../src/components/abs-button.js'; | ||
import { colors, variants } from '../theme/theme.js'; | ||
|
||
const Button = defineCE( | ||
class extends AbsButton { | ||
static get styles() { | ||
return [ | ||
super.styles, | ||
css` | ||
:host { | ||
margin: 5px; | ||
} | ||
` | ||
]; | ||
} | ||
} | ||
); | ||
|
||
const buttonTag = unsafeStatic(Button); | ||
|
||
const fixture = ({ | ||
theme = '', | ||
size = '', | ||
disabled = false, | ||
link = null, | ||
outline = false, | ||
label = 'button' | ||
}) => { | ||
/* eslint-disable lit/binding-positions, lit/no-invalid-html */ | ||
return html` | ||
<${buttonTag} | ||
.disabled="${disabled}" | ||
.link="${link}" | ||
theme="${theme}" | ||
size="${size}" | ||
?outline="${outline}" | ||
> | ||
${label} | ||
</${buttonTag}> | ||
`; | ||
}; | ||
|
||
const tpl = Object.values(colors).map(theme => { | ||
return html` | ||
<div> | ||
${fixture({ theme, label: theme || 'button' })} | ||
${fixture({ theme, disabled: true, label: 'disabled' })} | ||
${fixture({ theme, outline: true, label: 'outline' })} | ||
${fixture({ theme, disabled: true, outline: true, label: 'outline disabled' })} | ||
${fixture({ theme, link: 'https://example.com', label: 'Link' })} | ||
${variants.map(size => fixture({ theme, size, label: size }))} | ||
</div> | ||
`; | ||
}); | ||
|
||
export default html` | ||
${tpl} | ||
`; |
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,57 @@ | ||
import { css } from 'lit-element'; | ||
import { html, defineCE, unsafeStatic } from '@open-wc/testing-helpers'; | ||
import { AbsCheckbox } from '../src/components/abs-checkbox.js'; | ||
import { themes } from '../theme/theme.js'; | ||
|
||
const Checkbox = defineCE( | ||
class extends AbsCheckbox { | ||
static get styles() { | ||
return [ | ||
super.styles, | ||
css` | ||
:host { | ||
margin: 5px; | ||
} | ||
` | ||
]; | ||
} | ||
} | ||
); | ||
|
||
const checkboxTag = unsafeStatic(Checkbox); | ||
|
||
const fixture = ({ | ||
theme = '', | ||
disabled = false, | ||
checked = false, | ||
indeterminate = false, | ||
label = 'checkbox' | ||
}) => { | ||
/* eslint-disable lit/binding-positions, lit/no-invalid-html */ | ||
return html` | ||
<${checkboxTag} | ||
.disabled="${disabled}" | ||
.checked="${checked}" | ||
.indeterminate="${indeterminate}" | ||
theme="${theme}" | ||
> | ||
${label} | ||
</${checkboxTag}> | ||
`; | ||
}; | ||
|
||
const tpl = themes.map(theme => { | ||
return html` | ||
<div> | ||
${fixture({ theme, label: theme })} ${fixture({ theme, disabled: true, label: 'disabled' })} | ||
${fixture({ theme, checked: true, label: 'checked' })} | ||
${fixture({ theme, checked: true, disabled: true, label: 'checked disabled' })} | ||
${fixture({ theme, indeterminate: true, label: 'indeterminate' })} | ||
${fixture({ theme, indeterminate: true, disabled: true, label: 'indeterminate disabled' })} | ||
</div> | ||
`; | ||
}); | ||
|
||
export default html` | ||
${tpl} | ||
`; |
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,58 @@ | ||
import { css } from 'lit-element'; | ||
import { html, defineCE, unsafeStatic } from '@open-wc/testing-helpers'; | ||
import { AbsProgress } from '../src/components/abs-progress.js'; | ||
import { themes, variants } from '../theme/theme.js'; | ||
|
||
const Progress = defineCE( | ||
class extends AbsProgress { | ||
static get styles() { | ||
return [ | ||
super.styles, | ||
/* add margin and disable transitions for visual tests */ | ||
css` | ||
:host { | ||
margin: 5px; | ||
} | ||
progress::-webkit-progress-value { | ||
transition: none; | ||
} | ||
progress::-moz-progress-bar { | ||
transition: none; | ||
} | ||
progress::-ms-fill { | ||
transition: none; | ||
} | ||
` | ||
]; | ||
} | ||
} | ||
); | ||
|
||
const progressTag = unsafeStatic(Progress); | ||
|
||
const fixture = ({ theme = '', size = '', value = 50, max = 100, striped = false }) => { | ||
/* eslint-disable lit/binding-positions, lit/no-invalid-html */ | ||
return html` | ||
<${progressTag} | ||
.value="${value}" | ||
.max="${max}" | ||
theme="${theme}" | ||
size="${size}" | ||
?striped="${striped}" | ||
></${progressTag}> | ||
`; | ||
}; | ||
|
||
const tpl = themes.map(theme => { | ||
return html` | ||
${fixture({ theme })} ${fixture({ theme, striped: true })} | ||
${variants.map(size => fixture({ theme, size }))} | ||
`; | ||
}); | ||
|
||
export default html` | ||
${tpl} | ||
`; |
Oops, something went wrong.