Skip to content
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

tests(ui): add unit testing boilerplate and first tests #12047

Merged
merged 58 commits into from
Jan 31, 2022
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3826777
feat(unit): first attempt at setting up cct unit testing
Evertvdw Oct 21, 2021
ba2970b
Add image snapshot plugin
Evertvdw Oct 24, 2021
ba337c4
Move test/cypress folder to root of `ui`
Evertvdw Oct 24, 2021
19c0534
Update test syntax and eslint fix
Evertvdw Oct 24, 2021
7fd483b
chore(testing): Add tests for QAvatar
Evertvdw Oct 31, 2021
0eb31ea
fix(linting): make eslint validate and autofix js in .vue files
Evertvdw Oct 31, 2021
829d646
feat(testing): autocomplete custom commands in spec files
Evertvdw Oct 31, 2021
4620420
chore(testing): add first test of QMenu
Evertvdw Oct 31, 2021
511eae4
(chore): remove this eslint file as it is not used
Evertvdw Nov 6, 2021
a226097
(chore): add expect to globals so eslint does not complain
Evertvdw Nov 6, 2021
172fb7e
(testing): add tests for behavior of QMenu
Evertvdw Nov 6, 2021
320ea30
(chore): Add readme
Evertvdw Nov 6, 2021
2b7e7ad
(chore): undo changes to babel.config.js
Evertvdw Nov 6, 2021
d385090
(chore): extends cypress eslint plugin
Evertvdw Nov 6, 2021
4694ecc
(chore): refactor to move tests into __tests__ folder
Evertvdw Nov 6, 2021
3f72cbf
(testing): add more tests for Menu positioning
Evertvdw Nov 7, 2021
07af846
(chore): add list of components prioritized
Evertvdw Nov 8, 2021
15c65b9
Update README.md
Evertvdw Nov 8, 2021
994000f
(testing): add tests for transition and style of QMenu
Evertvdw Nov 10, 2021
bc1de40
(testing): Add Event tests
mett-development Nov 12, 2021
1690082
(testing): Update command types
Evertvdw Nov 15, 2021
72cb89d
(testing): Add method testss for QMenu
Evertvdw Nov 15, 2021
89e13ff
(testing): QMenu tests finished
Evertvdw Nov 18, 2021
6bc91c4
(chore): update readme
Evertvdw Nov 18, 2021
8f15636
(testing): First tests for QSelect
Evertvdw Nov 18, 2021
66a7ea4
fix(testing): add commands file to include AE commands typings
Evertvdw Nov 29, 2021
f33d9af
chore(testing): use AE for unit tests, clean up obsolete code
Evertvdw Nov 29, 2021
12b9201
chore(testing): Images were oddly sized, regenerate them
Evertvdw Nov 29, 2021
63d949e
chore(testing): use Cypress.vueWrapper instead of .vue() command
Evertvdw Nov 29, 2021
c39ce9b
testing(feat): test first content properties of select API
Evertvdw Dec 8, 2021
8b64971
testing(fix): fix autocompletion within spec files
Evertvdw Dec 8, 2021
d135ced
feat(testing): create a helper function to setup test boilerplate
Evertvdw Dec 15, 2021
6778ea7
chore: create separate tests for composables
Evertvdw Dec 15, 2021
b4826ab
fix: remove console.log used for testing
Evertvdw Dec 22, 2021
db3f321
feat: add additional tests for QSelect
Evertvdw Dec 22, 2021
ca3d3cf
feat(testing): Add isNotActionable command
Evertvdw Dec 22, 2021
59d6835
feat(testing): finish tests for props section `Options` of API
Evertvdw Dec 22, 2021
e5afe35
feat(testing): add boilerplate for slots
Evertvdw Dec 22, 2021
ad09c81
chore(testing): update AE to use cypress 9.2, update image snapshots
Evertvdw Dec 23, 2021
c6e93f4
chore(testing): refactor QMenu, split composable props
Evertvdw Dec 27, 2021
284f21a
feat(testing): WIP QSelect selection props, add slots to wrapper
Evertvdw Dec 27, 2021
f01d50b
chore(testing): Remove unused imports
Evertvdw Dec 27, 2021
391aa1d
chore(testing): do not check for null #11754
Evertvdw Dec 27, 2021
b4da5e2
feat(testing): add eslint plugin to show .only as error
Evertvdw Dec 27, 2021
f1abd81
feat(testing): finish Selection and Style sections of QSelect
Evertvdw Dec 27, 2021
577f75b
feat(testing): slot tests for QSelect
Evertvdw Jan 2, 2022
9582720
feat(testing): add tests for the events of QSelect
Evertvdw Jan 2, 2022
68a4792
chore(testing): refactor QAvatar tests
Evertvdw Jan 10, 2022
ac5b0c2
chore(testing): refactor QBadge to use API scaffolded tests
Evertvdw Jan 10, 2022
c53d701
feat(testing): add tests for Methods QSelect
Evertvdw Jan 14, 2022
57de1b7
feat(testing): cover edge cases for create-spec
Evertvdw Jan 14, 2022
2a2a9fd
chore(testing): create boilerplate for all components on shortlist
Evertvdw Jan 14, 2022
e0702ed
review: import plugin using ES syntax
Evertvdw Jan 17, 2022
c8ce424
review: add documentation for create-spec helper
Evertvdw Jan 17, 2022
c262865
chore(ui/test): adapt to latest release
IlCallo Jan 26, 2022
a678b01
chore: use eslint VSCode extension as formatter
IlCallo Jan 26, 2022
3ac10a1
fix: revert VSCode settings to prevent format fighting
Evertvdw Jan 27, 2022
47d51eb
chore(testing): remove image-snapshots, not working with `run-ct`.
Evertvdw Jan 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(testing): cover edge cases for create-spec
  • Loading branch information
Evertvdw authored and IlCallo committed Jan 26, 2022
commit 57de1b73990da4c5e09dc2458beb7481f8341e12
36 changes: 31 additions & 5 deletions ui/test/cypress/helpers/create-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,31 @@ function indent (num) {
return ' '.repeat(num * 2)
}

const isComposable = argv.component.startsWith('use-')
const split = argv.component.split('/')
let json = {}
let component = ''

if (split.length > 1) {
if (split[ 1 ].startsWith('use-')) {
component = split[ 1 ]
json = require(`../../../src/components/${ split[ 0 ] }/${ component }.json`)
}
else {
component = toPascalCase(split[ 1 ])
json = require(`../../../src/components/${ split[ 0 ] }/Q${ component }.json`)
}
}
else {
if (argv.component.startsWith('use-')) {
component = argv.component
json = require(`../../../src/composables/private/${ component }.json`)
}
else {
component = toPascalCase(argv.component)
json = require(`../../../src/components/${ argv.component }/Q${ component }.json`)
}
}

const component = isComposable ? argv.component : toPascalCase(argv.component)
const json = isComposable ? require(`../../../src/composables/private/${ component }.json`) : require(`../../../src/components/${ argv.component }/Q${ component }.json`)
const extendJson = require('../../../src/api.extends.json')
// console.log(json)
const extendProps = extendJson.props
Expand All @@ -41,8 +62,13 @@ if (json.props) {
else categories[ json.props[ prop ].category ].push(prop)
}
else {
if (!categories[ extendProps[ json.props[ prop ].extends ].category ]) categories[ extendProps[ json.props[ prop ].extends ].category ] = [ prop ]
else categories[ extendProps[ json.props[ prop ].extends ].category ].push(prop)
if (extendProps[ json.props[ prop ].extends ]) {
if (!categories[ extendProps[ json.props[ prop ].extends ].category ]) categories[ extendProps[ json.props[ prop ].extends ].category ] = [ prop ]
else categories[ extendProps[ json.props[ prop ].extends ].category ].push(prop)
}
else {
console.log(`property ${ prop } does not have a category and also does not extend something`)
}
}
}
const keys = Object.keys(categories).sort()
Expand Down