Skip to content

Commit 59eb082

Browse files
committed
Merge branch 'feat/swap-cy-root-id-for-data-attribute' of github.com:cypress-io/cypress into feat/swap-cy-root-id-for-data-attribute
* 'feat/swap-cy-root-id-for-data-attribute' of github.com:cypress-io/cypress: fixing nuxt issue w sys tests fix: Doc changes around vue2 (#21066)
2 parents 9afb13f + 753dc65 commit 59eb082

File tree

8 files changed

+696
-138
lines changed

8 files changed

+696
-138
lines changed

npm/vue/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
**Jump to:** [Comparison](#comparison), [Blog posts](#blog-posts), Examples: [basic](#basic-examples), [advanced](#advanced-examples), [full](#full-examples), [external](#external-examples), [Code coverage](#code-coverage), [Development](#development)
1212

1313
### What is @cypress/vue?
14-
This package allows you to use the [Cypress](https://www.cypress.io/) test runner to mount and test your components within Cypress. It is built on top of the [Vue Test Utils](https://github.com/vuejs/vue-test-utils) package.
14+
This package allows you to use the [Cypress](https://www.cypress.io/) test runner to mount and test your Vue 3.x components within Cypress. It is built on top of the [Vue Test Utils](https://github.com/vuejs/vue-test-utils) package.
1515

1616
![Example component test](images/dynamic.gif)
1717

@@ -20,10 +20,14 @@ It uses [Vue Test Utils](https://github.com/vuejs/vue-test-utils) under the hood
2020

2121
- If you like using `@testing-library/vue`, you can use `@testing-library/cypress` for the same `findBy`, `queryBy` commands, see one of the examples in the list below
2222

23+
### How is this different from @cypress/vue2?
24+
Cypress packages the current version of Vue under @cypress/vue, and older versions under separate package names. Use [@cypress/vue2](cypress-vue2-npm-url) if you're still using vue@2, and this package if you're on vue@3.
25+
2326
## Installation
2427

2528
- Requires Cypress v7.0.0 or later
2629
- Requires [Node](https://nodejs.org/en/) version 12 or above
30+
- Requires Vue 3.x. If you are using Vue 2.x, you want [@cypress/vue2](cypress-vue2-npm-url) instead.
2731
- Supports projects built with Vue CLI, Vite, and Webpack. If you would like us to support another build configuration, please [create an issue](https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm:%20@cypress/vue&template=3-feature.md).
2832

2933
Now you are ready to install.
@@ -666,6 +670,7 @@ Let the world know your project is using Cypress.io to test with this cool badge
666670

667671
[npm-icon]: https://nodei.co/npm/@cypress/vue.svg?downloads=true
668672
[npm-url]: https://npmjs.org/package/@cypress/vue
673+
[cypress-vue2-npm-url]: https://www.npmjs.com/package/@cypress/vue2
669674
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
670675
[semantic-url]: https://github.com/semantic-release/semantic-release
671676
[cypress-badge]: https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square

npm/vue2/README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# @cypress/vue
1+
# @cypress/vue2
22

33
[![NPM][npm-icon] ][npm-url]
44

55
[![semantic-release][semantic-image] ][semantic-url]
66

7-
> Browser-based Component Testing for Vue.js with the Open-Source [Cypress.io](https://www.cypress.io/) Test Runner ✌️🌲
7+
> Browser-based Component Testing for Vue.js 2.x with the Open-Source [Cypress.io](https://www.cypress.io/) Test Runner ✌️🌲
88
>
99
**✨ New** We're growing the Cypress Community Discord. We have dedicated sections on Component Testing. 👉 [Join now](https://discord.com/invite/TmzTGUW) and let's chat!
1010

1111
**Jump to:** [Comparison](#comparison), [Blog posts](#blog-posts), Examples: [basic](#basic-examples), [advanced](#advanced-examples), [full](#full-examples), [external](#external-examples), [Code coverage](#code-coverage), [Development](#development)
1212

13-
### What is @cypress/vue?
14-
This package allows you to use the [Cypress](https://www.cypress.io/) test runner to mount and test your components within Cypress. It is built on top of the [Vue Test Utils](https://github.com/vuejs/vue-test-utils) package.
13+
### What is @cypress/vue2?
14+
This package allows you to use the [Cypress](https://www.cypress.io/) test runner to mount and test your Vue 2 components within Cypress. It is built on top of the [Vue Test Utils](https://github.com/vuejs/vue-test-utils) package.
1515

1616
![Example component test](images/dynamic.gif)
1717

@@ -20,11 +20,15 @@ It uses [Vue Test Utils](https://github.com/vuejs/vue-test-utils) under the hood
2020

2121
- If you like using `@testing-library/vue`, you can use `@testing-library/cypress` for the same `findBy`, `queryBy` commands, see one of the examples in the list below
2222

23+
### How is this different from @cypress/vue?
24+
Cypress packages the current version of Vue under @cypress/vue, and older versions under separate package names. Use [@cypress/vue](cypress-vue-npm-url) if you're up to date, and this package if you're still using vue@2.
25+
2326
## Installation
2427

2528
- Requires Cypress v7.0.0 or later
2629
- Requires [Node](https://nodejs.org/en/) version 12 or above
27-
- Supports webpack-based projects, vite in alpha, if you would like us to support another, please [create an issue](https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm:%20@cypress/vue&template=3-feature.md) or, if an issue already exists subscribe to it.
30+
- Requires Vue 2.x. If you are using Vue 3.0.0 or later, you want [@cypress/vue](cypress-vue-npm-url) instead.
31+
- Supports webpack-based projects, vite in alpha, if you would like us to support another, please [create an issue](https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm:%20@cypress/vue2&template=3-feature.md) or, if an issue already exists subscribe to it.
2832

2933
Now you are ready to install.
3034

@@ -497,7 +501,7 @@ Calls to `window.alert` are automatically recorded, but do not show up. Instead
497501
## Comparison
498502

499503
<!-- prettier-ignore-start -->
500-
Feature | Vue Test Utils or @testing-library/vue | Cypress + `@cypress/vue`
504+
Feature | Vue Test Utils or @testing-library/vue | Cypress + `@cypress/vue2`
501505
--- | --- | ---
502506
Test runs in real browser | ❌ | ✅
503507
Uses full mount | ❌ | ✅
@@ -622,13 +626,13 @@ Larger tests that use full application and run on CI (see [circle.yml](circle.ym
622626
Run Cypress with environment variable
623627

624628
```
625-
DEBUG=@cypress/vue
629+
DEBUG=@cypress/vue2
626630
```
627631

628632
If some deeply nested objects are abbreviated and do not print fully, set the maximum logging depth
629633

630634
```
631-
DEBUG=@cypress/vue DEBUG_DEPTH=10
635+
DEBUG=@cypress/vue2 DEBUG_DEPTH=10
632636
```
633637

634638
## Related info
@@ -680,7 +684,8 @@ Let the world know your project is using Cypress.io to test with this cool badge
680684
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
681685

682686
[npm-icon]: https://nodei.co/npm/@cypress/vue.svg?downloads=true
683-
[npm-url]: https://npmjs.org/package/@cypress/vue
687+
[npm-url]: https://npmjs.org/package/@cypress/vue2
688+
[cypress-vue-npm-url]: https://www.npmjs.com/package/@cypress/vue
684689
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
685690
[semantic-url]: https://github.com/semantic-release/semantic-release
686691
[cypress-badge]: https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square

npm/vue2/docs/manual-install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
> _Not Recommended_: All of this is done automatically with Vue CLI
44
5-
1. Install `cypress` and `@cypress/vue`
5+
1. Install `cypress` and `@cypress/vue2`
66

77
```sh
8-
npm install -D cypress @cypress/vue
8+
npm install -D cypress @cypress/vue2
99
```
1010

1111
2. Include this plugin from your project's `cypress/plugin/index.js` file
@@ -22,7 +22,7 @@ module.exports = (on, config) => {
2222
3. Include the support file from your project's `cypress/support/index.js` file
2323

2424
```js
25-
import '@cypress/vue/dist/support'
25+
import '@cypress/vue2/dist/support'
2626
```
2727

2828
4. ⚠️ Turn the experimental component support on in your `cypress.json`. You can also specify where component spec files are located. For exampled to have them located in `src` folder use:

system-tests/projects/nuxtjs-vue2-configured/components/Tutorial.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { mount } from 'cypress/vue'
1+
import { mount } from 'cypress/vue2'
22
import Tutorial from './Tutorial.vue'
33

44
it('works', () => {

system-tests/projects/nuxtjs-vue2-configured/cypress.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ module.exports = defineConfig({
77
async devServer(cypressDevServerConfig, devServerConfig) {
88
const webpackConfig = await getWebpackConfig()
99

10+
// Whenever we need to test Vue 2, make sure to add this to the
11+
// Webpack configuration options
12+
// Because of #UNIFY-1565 we clash with Cypress's own
13+
// Vue 3 installation.
14+
webpackConfig.resolve = {
15+
...webpackConfig.resolve,
16+
alias: {
17+
...(webpackConfig.resolve?.alias ?? {}),
18+
'vue': require.resolve('vue')
19+
}
20+
}
21+
1022
return devServer(cypressDevServerConfig, { webpackConfig, ...devServerConfig })
1123
},
1224
},
13-
})
25+
})

system-tests/projects/nuxtjs-vue2-configured/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ export default {
3737

3838
// Build Configuration: https://go.nuxtjs.dev/config-build
3939
build: {
40-
}
40+
},
4141
}

system-tests/projects/nuxtjs-vue2-configured/package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
"generate": "nuxt generate"
1010
},
1111
"dependencies": {
12-
"core-js": "^3.19.3",
13-
"nuxt": "^2.15.8",
14-
"vue": "^2.6.14",
12+
"vue": "^2.6.14"
13+
},
14+
"devDependencies": {
15+
"@cypress/webpack-dev-server": "file:../../../npm/webpack-dev-server",
1516
"vue-server-renderer": "^2.6.14",
1617
"vue-template-compiler": "^2.6.14",
1718
"webpack": "^4.46.0",
18-
"webpack-dev-server": "4.7.4"
19-
},
20-
"devDependencies": {
21-
"@cypress/vue2": "file:../../../npm/vue2",
22-
"@cypress/mount-utils": "file:../../../npm/mount-utils",
23-
"@cypress/webpack-dev-server": "file:../../../npm/webpack-dev-server"
19+
"webpack-dev-server": "4.7.4",
20+
"core-js": "^3.19.3",
21+
"nuxt": "^2.15.8",
22+
"cypress": "file:../../../cli"
2423
}
2524
}

0 commit comments

Comments
 (0)