Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 4a55ffc

Browse files
committed
chore: add cypress and fix tests
1 parent 2835bc3 commit 4a55ffc

File tree

10 files changed

+42
-13
lines changed

10 files changed

+42
-13
lines changed
28.5 KB
Loading
Loading

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
"build": "lerna run build --no-private --stream",
2222
"dev": "NODE_ENV=development vite serve playground --config ./vite.config.ts",
2323
"playground:build": "yarn install && yarn build && yarn bootstrap && NODE_ENV=production vite build playground --config ./vite.config.ts",
24-
"test": "cross-env NODE_ENV=test jest --config jest.config.js",
24+
"cy:open": "cypress open-ct",
25+
"cy:run": "cypress run-ct --quiet",
26+
"test:component": "cy:run",
27+
"test": "jest && yarn cy:run",
28+
"test:unit": "cross-env NODE_ENV=test jest --config jest.config.js",
2529
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
2630
"docs:dev:legacy": "vitepress dev docs",
2731
"docs:build:legacy": "vitepress build docs",
@@ -119,6 +123,8 @@
119123
},
120124
"devDependencies": {
121125
"@cypress/snapshot": "^2.1.7",
126+
"@cypress/vite-dev-server": "^1.2.6",
127+
"@cypress/vue": "^3.0.1",
122128
"@vue/test-utils": "^2.0.0-rc.6",
123129
"cypress": "^7.2.0"
124130
}

packages/c-button/tests/c-button-group.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Object.entries(ButtonGroup).map(([name, example]) => {
1313
})
1414

1515
it('with a color scheme', () => {
16-
cy.mount(
16+
cy.mount(h(() =>
1717
<CButtonGroup>
1818
<CButton colorScheme="blue">Save</CButton>
1919
<CButton>Cancel</CButton>
2020
</CButtonGroup>
21-
)
21+
))
2222
})

packages/c-code/examples/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export * as BaseBadge from './base-badge.vue'
2-
export * as OutlineBadges from './outline-badges.vue'
3-
export * as SolidBadge from './solid-badge.vue'
4-
export * as SubtleBadges from './subtle-badges.vue'
1+
// export * as BaseBadge from './base-badge.vue'
2+
// export * as OutlineBadges from './outline-badges.vue'
3+
// export * as SolidBadge from './solid-badge.vue'
4+
// export * as SubtleBadges from './subtle-badges.vue'
5+
6+
export * as BaseCode from './base-code.vue'
7+
export * as WithColor from './with-color.vue'

packages/tests/a11y.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const isAccessible = (_chai, utils) => {
2020
_chai.Assertion.addProperty('accessible', function () {
2121
let _this = this
2222

23-
return cy.get('#cypress-root', { log: false }).then(async ($root) => {
23+
return cy.get('#__cy_root', { log: false }).then(async ($root) => {
2424
const result = await axeCore.run($root[0])
2525
console.log(`A11y results: `, result)
2626
const { passes, violations } = result

packages/tests/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import { mount } from '@cypress/vue'
44

55
declare namespace Cypress {
6-
interface Chainable<Subject> {
6+
export interface Chainable {
77
mount(): ReturnType<typeof mount>
88
/**
99
* Run a11y tests or only a subset of all tests
1010
* @see https://github.com/avanslaars/cypress-axe
1111
* @example
1212
* cy.checkA11y()
1313
*/
14-
checkA11y(any, object): Chainable<any>
14+
checkA11y(any, object): Chainable
1515
}
1616
}

snapshots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
__version: '6.9.0',
2+
__version: '7.2.0',
33
'<Portal />': {
44
'Portal Examples': {
55
'renders SimplePortal successfully': {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
55
"resolveJsonModule": true,
66
"lib": [ "esnext", "dom" ],
7-
"types": ["node", "jest", "vite/client", "vite-plugin-pages/client", "cypress"],
7+
"types": ["node", "jest", "vite/client", "vite-plugin-pages/client", "cypress", "./packages/tests"],
88
"declaration": true,
99
"allowJs": true,
1010
"sourceMap": true,

yarn.lock

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,21 @@
14691469
snap-shot-compare "2.8.3"
14701470
snap-shot-store "1.2.3"
14711471

1472+
"@cypress/vite-dev-server@^1.2.6":
1473+
version "1.2.6"
1474+
resolved "https://registry.yarnpkg.com/@cypress/vite-dev-server/-/vite-dev-server-1.2.6.tgz#237604d8ab8a50a62ced6b12a1454db44c98614b"
1475+
integrity sha512-M1Uv3cVH8aQPLARY7ezTYevInryVw3NT1bhJDBqtnO2b6KPBXXUbIS8AmYptZxBUBM4z+eBcD8W2SQRVLYCw6g==
1476+
dependencies:
1477+
debug "^4.3.2"
1478+
get-port "^5.1.1"
1479+
1480+
"@cypress/vue@^3.0.1":
1481+
version "3.0.1"
1482+
resolved "https://registry.yarnpkg.com/@cypress/vue/-/vue-3.0.1.tgz#9899718dfb8608f98c343fe35a7cfc0a50376011"
1483+
integrity sha512-7aSdwbtvCJnKR7MDZdJs3TB718LNo44JXvIidrtcZacOSPXjahvkZ8nQCyLIt/owKBFFaV4dvSn267Lq4ZIbzQ==
1484+
dependencies:
1485+
"@vue/test-utils" "^2.0.0-rc.4"
1486+
14721487
"@cypress/xvfb@^1.2.4":
14731488
version "1.2.4"
14741489
resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a"
@@ -3430,7 +3445,7 @@
34303445
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.0-rc.4.tgz#536175be968e7c5741e9c95f117024d5053ea54c"
34313446
integrity sha512-DocrrFP28M7NO7y7iGiX9sf9n1AKEqkxXO5wedtp5FkHiAkc0xfmD4lvxgi4re5+xw7Zzb9U/vrhXKQZ0I4Q9g==
34323447

3433-
"@vue/test-utils@^2.0.0-rc.6":
3448+
"@vue/test-utils@^2.0.0-rc.4", "@vue/test-utils@^2.0.0-rc.6":
34343449
version "2.0.0-rc.6"
34353450
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.0-rc.6.tgz#d0aac24d20450d379e183f70542c0822670b8783"
34363451
integrity sha512-0cnQBVH589PwgqWpyv1fgCAz+9Ram/MsvN3ZEAEVXi1aPuhUa22EudGc0WezQ9PKwR+L40NrBmt3JBXE2tSRRQ==
@@ -7099,6 +7114,11 @@ get-port@^4.2.0:
70997114
resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119"
71007115
integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==
71017116

7117+
get-port@^5.1.1:
7118+
version "5.1.1"
7119+
resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193"
7120+
integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==
7121+
71027122
71037123
version "8.0.0"
71047124
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"

0 commit comments

Comments
 (0)