cypress 10.4.0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular/CHANGELOG.md +86 -0
- package/angular/README.md +85 -0
- package/angular/dist/index.d.ts +1 -0
- package/angular/dist/index.js +265 -0
- package/angular/dist/mount.d.ts +112 -0
- package/angular/package.json +68 -0
- package/lib/tasks/download.js +4 -3
- package/mount-utils/CHANGELOG.md +7 -0
- package/mount-utils/package.json +5 -1
- package/package.json +16 -4
- package/react/CHANGELOG.md +20 -0
- package/react/dist/createMount.d.ts +7 -6
- package/react/dist/cypress-react.cjs.js +653 -140
- package/react/dist/cypress-react.esm-bundler.js +640 -127
- package/react/dist/mount.d.ts +2 -1
- package/react/dist/mountHook.d.ts +1 -0
- package/react/dist/types.d.ts +2 -7
- package/react/package.json +4 -6
- package/react18/CHANGELOG.md +13 -0
- package/react18/dist/cypress-react.cjs.js +300 -118
- package/react18/dist/cypress-react.esm-bundler.js +286 -104
- package/react18/dist/index.d.ts +2 -1
- package/react18/package.json +2 -2
- package/svelte/CHANGELOG.md +0 -0
- package/svelte/README.md +83 -0
- package/svelte/dist/cypress-svelte.cjs.js +213 -0
- package/svelte/dist/cypress-svelte.esm-bundler.js +209 -0
- package/svelte/dist/index.d.ts +1 -0
- package/svelte/dist/mount.d.ts +30 -0
- package/svelte/package.json +43 -0
- package/types/cypress-type-helpers.d.ts +3 -1
- package/types/cypress.d.ts +61 -5
- package/vue/CHANGELOG.md +14 -0
- package/vue/dist/cypress-vue.cjs.js +30 -38
- package/vue/dist/cypress-vue.esm-bundler.js +30 -38
- package/vue/dist/index.d.ts +1 -0
- package/vue/package.json +2 -8
- package/vue2/CHANGELOG.md +7 -0
- package/vue2/dist/cypress-vue2.cjs.js +53 -84
- package/vue2/dist/cypress-vue2.esm-bundler.js +53 -84
- package/vue2/dist/index.d.ts +1 -0
- package/vue2/package.json +2 -5
- package/vue2/dist/cypress-vue2.browser.js +0 -20197
@@ -46,17 +46,6 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
46
46
|
PERFORMANCE OF THIS SOFTWARE.
|
47
47
|
***************************************************************************** */
|
48
48
|
|
49
|
-
var __assign$1 = function() {
|
50
|
-
__assign$1 = Object.assign || function __assign(t) {
|
51
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
52
|
-
s = arguments[i];
|
53
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
54
|
-
}
|
55
|
-
return t;
|
56
|
-
};
|
57
|
-
return __assign$1.apply(this, arguments);
|
58
|
-
};
|
59
|
-
|
60
49
|
function __rest(s, e) {
|
61
50
|
var t = {};
|
62
51
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -13721,7 +13710,7 @@ function mount$1(inputComponent, options) {
|
|
13721
13710
|
trackInstance(wrapper);
|
13722
13711
|
return wrapper;
|
13723
13712
|
}
|
13724
|
-
var shallowMount = function (component, options) {
|
13713
|
+
var shallowMount$1 = function (component, options) {
|
13725
13714
|
return mount$1(component, __assign(__assign({}, options), { shallow: true }));
|
13726
13715
|
};
|
13727
13716
|
|
@@ -13790,15 +13779,20 @@ var _VueTestUtils = /*#__PURE__*/Object.freeze({
|
|
13790
13779
|
enableAutoUnmount: enableAutoUnmount,
|
13791
13780
|
flushPromises: flushPromises,
|
13792
13781
|
mount: mount$1,
|
13793
|
-
shallowMount: shallowMount
|
13782
|
+
shallowMount: shallowMount$1
|
13794
13783
|
});
|
13795
13784
|
|
13796
|
-
|
13785
|
+
const {
|
13786
|
+
// We do not expose the `mount` from VueTestUtils, instead, we wrap it and expose a
|
13797
13787
|
// Cypress-compatible `mount` API.
|
13798
|
-
VTUmount
|
13799
|
-
|
13800
|
-
|
13801
|
-
|
13788
|
+
mount: VTUmount,
|
13789
|
+
// We do not expose shallowMount. It doesn't make much sense in the context of Cypress.
|
13790
|
+
// It might be useful for people who like to migrate some Test Utils tests to Cypress,
|
13791
|
+
// so if we decide it is useful to expose, just remove the next line, and it will be
|
13792
|
+
// available on the `VueTestUtils` import.
|
13793
|
+
shallowMount } = _VueTestUtils, VueTestUtils = __rest(_VueTestUtils, ["mount", "shallowMount"]);
|
13794
|
+
const DEFAULT_COMP_NAME = 'unknown';
|
13795
|
+
Cypress.on('run:start', () => {
|
13802
13796
|
// `mount` is designed to work with component testing only.
|
13803
13797
|
// it assumes ROOT_SELECTOR exists, which is not the case in e2e.
|
13804
13798
|
// if the user registers a custom command that imports `cypress/vue`,
|
@@ -13808,22 +13802,21 @@ Cypress.on('run:start', function () {
|
|
13808
13802
|
if (Cypress.testingType !== 'component') {
|
13809
13803
|
return;
|
13810
13804
|
}
|
13811
|
-
Cypress.on('test:before:run',
|
13805
|
+
Cypress.on('test:before:run', () => {
|
13812
13806
|
var _a;
|
13813
13807
|
(_a = Cypress.vueWrapper) === null || _a === void 0 ? void 0 : _a.unmount();
|
13814
|
-
|
13808
|
+
const el = getContainerEl();
|
13815
13809
|
el.innerHTML = '';
|
13816
13810
|
});
|
13817
13811
|
});
|
13818
13812
|
// implementation
|
13819
|
-
function mount(componentOptions, options) {
|
13820
|
-
if (options === void 0) { options = {}; }
|
13813
|
+
function mount(componentOptions, options = {}) {
|
13821
13814
|
// TODO: get the real displayName and props from VTU shallowMount
|
13822
|
-
|
13823
|
-
|
13824
|
-
|
13815
|
+
const componentName = getComponentDisplayName(componentOptions);
|
13816
|
+
const message = `<${componentName} ... />`;
|
13817
|
+
let logInstance;
|
13825
13818
|
// then wait for cypress to load
|
13826
|
-
return cy.then(
|
13819
|
+
return cy.then(() => {
|
13827
13820
|
var _a, _b;
|
13828
13821
|
if (options.log !== false) {
|
13829
13822
|
logInstance = Cypress.log({
|
@@ -13832,26 +13825,26 @@ function mount(componentOptions, options) {
|
|
13832
13825
|
});
|
13833
13826
|
}
|
13834
13827
|
// @ts-ignore
|
13835
|
-
|
13836
|
-
|
13828
|
+
const document = cy.state('document');
|
13829
|
+
const el = getContainerEl();
|
13837
13830
|
injectStylesBeforeElement(options, document, el);
|
13838
13831
|
// merge the extensions with global
|
13839
13832
|
if (options.extensions) {
|
13840
13833
|
options.extensions.plugins = (_a = []) === null || _a === void 0 ? void 0 : _a.concat(options.extensions.plugins || [], options.extensions.use || []);
|
13841
13834
|
options.extensions.mixins = (_b = []) === null || _b === void 0 ? void 0 : _b.concat(options.extensions.mixins || [], options.extensions.mixin || []);
|
13842
|
-
options.global =
|
13835
|
+
options.global = Object.assign(Object.assign({}, options.extensions), options.global);
|
13843
13836
|
}
|
13844
|
-
|
13837
|
+
const componentNode = document.createElement('div');
|
13845
13838
|
componentNode.id = '__cy_vue_root';
|
13846
13839
|
el.append(componentNode);
|
13847
13840
|
// mount the component using VTU and return the wrapper in Cypress.VueWrapper
|
13848
|
-
|
13841
|
+
const wrapper = VTUmount(componentOptions, Object.assign({ attachTo: componentNode }, options));
|
13849
13842
|
Cypress.vueWrapper = wrapper;
|
13850
13843
|
Cypress.vue = wrapper.vm;
|
13851
13844
|
return cy
|
13852
13845
|
.wrap(wrapper, { log: false })
|
13853
13846
|
.wait(1, { log: false })
|
13854
|
-
.then(
|
13847
|
+
.then(() => {
|
13855
13848
|
if (logInstance) {
|
13856
13849
|
logInstance.snapshot('mounted');
|
13857
13850
|
logInstance.end();
|
@@ -13873,10 +13866,10 @@ function getComponentDisplayName(componentOptions) {
|
|
13873
13866
|
return componentOptions.name;
|
13874
13867
|
}
|
13875
13868
|
if (componentOptions.__file) {
|
13876
|
-
|
13877
|
-
|
13869
|
+
const filepathSplit = componentOptions.__file.split('/');
|
13870
|
+
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
13878
13871
|
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
13879
|
-
|
13872
|
+
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
13880
13873
|
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
13881
13874
|
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
13882
13875
|
}
|
@@ -13888,9 +13881,8 @@ function getComponentDisplayName(componentOptions) {
|
|
13888
13881
|
* import {mountCallback} from '@cypress/vue'
|
13889
13882
|
* beforeEach(mountVue(component, options))
|
13890
13883
|
*/
|
13891
|
-
function mountCallback(component, options) {
|
13892
|
-
|
13893
|
-
return function () {
|
13884
|
+
function mountCallback(component, options = {}) {
|
13885
|
+
return () => {
|
13894
13886
|
return mount(component, options);
|
13895
13887
|
};
|
13896
13888
|
}
|
@@ -23,17 +23,6 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
23
|
PERFORMANCE OF THIS SOFTWARE.
|
24
24
|
***************************************************************************** */
|
25
25
|
|
26
|
-
var __assign$1 = function() {
|
27
|
-
__assign$1 = Object.assign || function __assign(t) {
|
28
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
29
|
-
s = arguments[i];
|
30
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
31
|
-
}
|
32
|
-
return t;
|
33
|
-
};
|
34
|
-
return __assign$1.apply(this, arguments);
|
35
|
-
};
|
36
|
-
|
37
26
|
function __rest(s, e) {
|
38
27
|
var t = {};
|
39
28
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -13698,7 +13687,7 @@ function mount$1(inputComponent, options) {
|
|
13698
13687
|
trackInstance(wrapper);
|
13699
13688
|
return wrapper;
|
13700
13689
|
}
|
13701
|
-
var shallowMount = function (component, options) {
|
13690
|
+
var shallowMount$1 = function (component, options) {
|
13702
13691
|
return mount$1(component, __assign(__assign({}, options), { shallow: true }));
|
13703
13692
|
};
|
13704
13693
|
|
@@ -13767,15 +13756,20 @@ var _VueTestUtils = /*#__PURE__*/Object.freeze({
|
|
13767
13756
|
enableAutoUnmount: enableAutoUnmount,
|
13768
13757
|
flushPromises: flushPromises,
|
13769
13758
|
mount: mount$1,
|
13770
|
-
shallowMount: shallowMount
|
13759
|
+
shallowMount: shallowMount$1
|
13771
13760
|
});
|
13772
13761
|
|
13773
|
-
|
13762
|
+
const {
|
13763
|
+
// We do not expose the `mount` from VueTestUtils, instead, we wrap it and expose a
|
13774
13764
|
// Cypress-compatible `mount` API.
|
13775
|
-
VTUmount
|
13776
|
-
|
13777
|
-
|
13778
|
-
|
13765
|
+
mount: VTUmount,
|
13766
|
+
// We do not expose shallowMount. It doesn't make much sense in the context of Cypress.
|
13767
|
+
// It might be useful for people who like to migrate some Test Utils tests to Cypress,
|
13768
|
+
// so if we decide it is useful to expose, just remove the next line, and it will be
|
13769
|
+
// available on the `VueTestUtils` import.
|
13770
|
+
shallowMount } = _VueTestUtils, VueTestUtils = __rest(_VueTestUtils, ["mount", "shallowMount"]);
|
13771
|
+
const DEFAULT_COMP_NAME = 'unknown';
|
13772
|
+
Cypress.on('run:start', () => {
|
13779
13773
|
// `mount` is designed to work with component testing only.
|
13780
13774
|
// it assumes ROOT_SELECTOR exists, which is not the case in e2e.
|
13781
13775
|
// if the user registers a custom command that imports `cypress/vue`,
|
@@ -13785,22 +13779,21 @@ Cypress.on('run:start', function () {
|
|
13785
13779
|
if (Cypress.testingType !== 'component') {
|
13786
13780
|
return;
|
13787
13781
|
}
|
13788
|
-
Cypress.on('test:before:run',
|
13782
|
+
Cypress.on('test:before:run', () => {
|
13789
13783
|
var _a;
|
13790
13784
|
(_a = Cypress.vueWrapper) === null || _a === void 0 ? void 0 : _a.unmount();
|
13791
|
-
|
13785
|
+
const el = getContainerEl();
|
13792
13786
|
el.innerHTML = '';
|
13793
13787
|
});
|
13794
13788
|
});
|
13795
13789
|
// implementation
|
13796
|
-
function mount(componentOptions, options) {
|
13797
|
-
if (options === void 0) { options = {}; }
|
13790
|
+
function mount(componentOptions, options = {}) {
|
13798
13791
|
// TODO: get the real displayName and props from VTU shallowMount
|
13799
|
-
|
13800
|
-
|
13801
|
-
|
13792
|
+
const componentName = getComponentDisplayName(componentOptions);
|
13793
|
+
const message = `<${componentName} ... />`;
|
13794
|
+
let logInstance;
|
13802
13795
|
// then wait for cypress to load
|
13803
|
-
return cy.then(
|
13796
|
+
return cy.then(() => {
|
13804
13797
|
var _a, _b;
|
13805
13798
|
if (options.log !== false) {
|
13806
13799
|
logInstance = Cypress.log({
|
@@ -13809,26 +13802,26 @@ function mount(componentOptions, options) {
|
|
13809
13802
|
});
|
13810
13803
|
}
|
13811
13804
|
// @ts-ignore
|
13812
|
-
|
13813
|
-
|
13805
|
+
const document = cy.state('document');
|
13806
|
+
const el = getContainerEl();
|
13814
13807
|
injectStylesBeforeElement(options, document, el);
|
13815
13808
|
// merge the extensions with global
|
13816
13809
|
if (options.extensions) {
|
13817
13810
|
options.extensions.plugins = (_a = []) === null || _a === void 0 ? void 0 : _a.concat(options.extensions.plugins || [], options.extensions.use || []);
|
13818
13811
|
options.extensions.mixins = (_b = []) === null || _b === void 0 ? void 0 : _b.concat(options.extensions.mixins || [], options.extensions.mixin || []);
|
13819
|
-
options.global =
|
13812
|
+
options.global = Object.assign(Object.assign({}, options.extensions), options.global);
|
13820
13813
|
}
|
13821
|
-
|
13814
|
+
const componentNode = document.createElement('div');
|
13822
13815
|
componentNode.id = '__cy_vue_root';
|
13823
13816
|
el.append(componentNode);
|
13824
13817
|
// mount the component using VTU and return the wrapper in Cypress.VueWrapper
|
13825
|
-
|
13818
|
+
const wrapper = VTUmount(componentOptions, Object.assign({ attachTo: componentNode }, options));
|
13826
13819
|
Cypress.vueWrapper = wrapper;
|
13827
13820
|
Cypress.vue = wrapper.vm;
|
13828
13821
|
return cy
|
13829
13822
|
.wrap(wrapper, { log: false })
|
13830
13823
|
.wait(1, { log: false })
|
13831
|
-
.then(
|
13824
|
+
.then(() => {
|
13832
13825
|
if (logInstance) {
|
13833
13826
|
logInstance.snapshot('mounted');
|
13834
13827
|
logInstance.end();
|
@@ -13850,10 +13843,10 @@ function getComponentDisplayName(componentOptions) {
|
|
13850
13843
|
return componentOptions.name;
|
13851
13844
|
}
|
13852
13845
|
if (componentOptions.__file) {
|
13853
|
-
|
13854
|
-
|
13846
|
+
const filepathSplit = componentOptions.__file.split('/');
|
13847
|
+
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
13855
13848
|
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
13856
|
-
|
13849
|
+
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
13857
13850
|
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
13858
13851
|
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
13859
13852
|
}
|
@@ -13865,9 +13858,8 @@ function getComponentDisplayName(componentOptions) {
|
|
13865
13858
|
* import {mountCallback} from '@cypress/vue'
|
13866
13859
|
* beforeEach(mountVue(component, options))
|
13867
13860
|
*/
|
13868
|
-
function mountCallback(component, options) {
|
13869
|
-
|
13870
|
-
return function () {
|
13861
|
+
function mountCallback(component, options = {}) {
|
13862
|
+
return () => {
|
13871
13863
|
return mount(component, options);
|
13872
13864
|
};
|
13873
13865
|
}
|
package/vue/dist/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="cypress" />
|
2
|
+
/// <reference types="cypress" />
|
2
3
|
import type { ComponentPublicInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, ExtractDefaultPropTypes, DefineComponent, FunctionalComponent, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentOptionsWithObjectProps, ComponentPropsOptions, ComponentOptionsWithArrayProps, ComponentOptionsWithoutProps } from 'vue';
|
3
4
|
import type { MountingOptions, VueWrapper } from './@vue/test-utils';
|
4
5
|
import { StyleOptions } from '@cypress/mount-utils';
|
package/vue/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"build-prod": "yarn build",
|
8
8
|
"cy:open": "node ../../scripts/cypress.js open --component --project ${PWD}",
|
9
9
|
"cy:run": "node ../../scripts/cypress.js run --component --project ${PWD}",
|
10
|
-
"build": "rimraf dist && rollup -c rollup.config.
|
10
|
+
"build": "rimraf dist && rollup -c rollup.config.mjs",
|
11
11
|
"postbuild": "node --require @packages/ts/register ./inline-types.ts && node ../../scripts/sync-exported-npm-with-cli.js",
|
12
12
|
"typecheck": "yarn tsd && vue-tsc --noEmit",
|
13
13
|
"test": "yarn cy:run",
|
@@ -15,10 +15,7 @@
|
|
15
15
|
"watch": "yarn build --watch --watch.exclude ./dist/**/*"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
18
|
-
"@cypress/code-coverage": "3.8.1",
|
19
18
|
"@cypress/mount-utils": "0.0.0-development",
|
20
|
-
"@rollup/plugin-commonjs": "^17.1.0",
|
21
|
-
"@rollup/plugin-node-resolve": "^11.1.1",
|
22
19
|
"@vitejs/plugin-vue": "2.3.1",
|
23
20
|
"@vue/compiler-sfc": "3.2.31",
|
24
21
|
"@vue/test-utils": "2.0.2",
|
@@ -26,11 +23,8 @@
|
|
26
23
|
"cypress": "0.0.0-development",
|
27
24
|
"debug": "^4.3.2",
|
28
25
|
"globby": "^11.0.1",
|
29
|
-
"rollup": "^2.38.5",
|
30
|
-
"rollup-plugin-istanbul": "2.0.1",
|
31
|
-
"rollup-plugin-typescript2": "^0.29.0",
|
32
26
|
"tailwindcss": "1.1.4",
|
33
|
-
"typescript": "^4.
|
27
|
+
"typescript": "^4.7.4",
|
34
28
|
"vite": "3.0.3",
|
35
29
|
"vue": "3.2.31",
|
36
30
|
"vue-i18n": "9.0.0-rc.6",
|
package/vue2/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [@cypress/vue2-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.1...@cypress/vue2-v1.0.2) (2022-08-11)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* remove CT side effects from mount when e2e testing ([#22633](https://github.com/cypress-io/cypress/issues/22633)) ([a9476ec](https://github.com/cypress-io/cypress/commit/a9476ecb3d43f628b689e060294a1952937cb1a7))
|
7
|
+
|
1
8
|
# [@cypress/vue2-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.0...@cypress/vue2-v1.0.1) (2022-06-13)
|
2
9
|
|
3
10
|
|
@@ -15,32 +15,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
15
15
|
|
16
16
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
17
17
|
|
18
|
-
/******************************************************************************
|
19
|
-
Copyright (c) Microsoft Corporation.
|
20
|
-
|
21
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
22
|
-
purpose with or without fee is hereby granted.
|
23
|
-
|
24
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
25
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
26
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
27
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
28
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
29
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
30
|
-
PERFORMANCE OF THIS SOFTWARE.
|
31
|
-
***************************************************************************** */
|
32
|
-
|
33
|
-
var __assign = function() {
|
34
|
-
__assign = Object.assign || function __assign(t) {
|
35
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
36
|
-
s = arguments[i];
|
37
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
38
|
-
}
|
39
|
-
return t;
|
40
|
-
};
|
41
|
-
return __assign.apply(this, arguments);
|
42
|
-
};
|
43
|
-
|
44
18
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
45
19
|
|
46
20
|
function createCommonjsModule$1(fn) {
|
@@ -19987,64 +19961,60 @@ function setupHooks(optionalCallback) {
|
|
19987
19961
|
});
|
19988
19962
|
}
|
19989
19963
|
|
19990
|
-
|
19964
|
+
const defaultOptions = [
|
19991
19965
|
'vue',
|
19992
19966
|
'extensions',
|
19993
19967
|
];
|
19994
|
-
|
19995
|
-
|
19996
|
-
|
19968
|
+
const DEFAULT_COMP_NAME = 'unknown';
|
19969
|
+
const registerGlobalComponents = (Vue, options) => {
|
19970
|
+
const globalComponents = Cypress._.get(options, 'extensions.components');
|
19997
19971
|
if (Cypress._.isPlainObject(globalComponents)) {
|
19998
|
-
Cypress._.forEach(globalComponents,
|
19972
|
+
Cypress._.forEach(globalComponents, (component, id) => {
|
19999
19973
|
Vue.component(id, component);
|
20000
19974
|
});
|
20001
19975
|
}
|
20002
19976
|
};
|
20003
|
-
|
20004
|
-
|
19977
|
+
const installFilters = (Vue, options) => {
|
19978
|
+
const filters = Cypress._.get(options, 'extensions.filters');
|
20005
19979
|
if (Cypress._.isPlainObject(filters)) {
|
20006
|
-
Object.keys(filters).forEach(
|
19980
|
+
Object.keys(filters).forEach((name) => {
|
20007
19981
|
Vue.filter(name, filters[name]);
|
20008
19982
|
});
|
20009
19983
|
}
|
20010
19984
|
};
|
20011
|
-
|
20012
|
-
|
19985
|
+
const installPlugins = (Vue, options, props) => {
|
19986
|
+
const plugins = Cypress._.get(props, 'plugins') ||
|
20013
19987
|
Cypress._.get(options, 'extensions.use') ||
|
20014
19988
|
Cypress._.get(options, 'extensions.plugins') ||
|
20015
19989
|
[];
|
20016
19990
|
// @ts-ignore
|
20017
|
-
plugins.forEach(
|
20018
|
-
Array.isArray(p) ? Vue.use
|
19991
|
+
plugins.forEach((p) => {
|
19992
|
+
Array.isArray(p) ? Vue.use(...p) : Vue.use(p);
|
20019
19993
|
});
|
20020
19994
|
};
|
20021
|
-
|
20022
|
-
|
19995
|
+
const installMixins = (Vue, options) => {
|
19996
|
+
const mixins = Cypress._.get(options, 'extensions.mixin') ||
|
20023
19997
|
Cypress._.get(options, 'extensions.mixins');
|
20024
19998
|
if (Cypress._.isArray(mixins)) {
|
20025
|
-
mixins.forEach(
|
19999
|
+
mixins.forEach((mixin) => {
|
20026
20000
|
Vue.mixin(mixin);
|
20027
20001
|
});
|
20028
20002
|
}
|
20029
20003
|
};
|
20030
|
-
|
20031
|
-
|
20032
|
-
return
|
20033
|
-
};
|
20034
|
-
var forEachValue = function (obj, fn) {
|
20035
|
-
return Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
|
20004
|
+
const hasStore = ({ store }) => Boolean(store && store._vm);
|
20005
|
+
const forEachValue = (obj, fn) => {
|
20006
|
+
return Object.keys(obj).forEach((key) => fn(obj[key], key));
|
20036
20007
|
};
|
20037
|
-
|
20038
|
-
var store = _a.store;
|
20008
|
+
const resetStoreVM = (Vue, { store }) => {
|
20039
20009
|
// bind store public getters
|
20040
20010
|
store.getters = {};
|
20041
|
-
|
20042
|
-
|
20043
|
-
forEachValue(wrappedGetters,
|
20011
|
+
const wrappedGetters = store._wrappedGetters;
|
20012
|
+
const computed = {};
|
20013
|
+
forEachValue(wrappedGetters, (fn, key) => {
|
20044
20014
|
// use computed to leverage its lazy-caching mechanism
|
20045
|
-
computed[key] =
|
20015
|
+
computed[key] = () => fn(store);
|
20046
20016
|
Object.defineProperty(store.getters, key, {
|
20047
|
-
get:
|
20017
|
+
get: () => store._vm[key],
|
20048
20018
|
enumerable: true, // for local getters
|
20049
20019
|
});
|
20050
20020
|
});
|
@@ -20053,7 +20023,7 @@ var resetStoreVM = function (Vue, _a) {
|
|
20053
20023
|
data: {
|
20054
20024
|
$$state: store._vm._data.$$state,
|
20055
20025
|
},
|
20056
|
-
computed
|
20026
|
+
computed,
|
20057
20027
|
});
|
20058
20028
|
return store;
|
20059
20029
|
};
|
@@ -20064,19 +20034,19 @@ var resetStoreVM = function (Vue, _a) {
|
|
20064
20034
|
* @see https://github.com/cypress-io/cypress/issues/7910
|
20065
20035
|
*/
|
20066
20036
|
function failTestOnVueError(err, vm, info) {
|
20067
|
-
console.error(
|
20037
|
+
console.error(`Vue error`);
|
20068
20038
|
console.error(err);
|
20069
20039
|
console.error('component:', vm);
|
20070
20040
|
console.error('info:', info);
|
20071
20041
|
window.top.onerror(err);
|
20072
20042
|
}
|
20073
20043
|
function registerAutoDestroy($destroy) {
|
20074
|
-
Cypress.on('test:before:run',
|
20044
|
+
Cypress.on('test:before:run', () => {
|
20075
20045
|
$destroy();
|
20076
20046
|
});
|
20077
20047
|
}
|
20078
20048
|
enableAutoDestroy_1(registerAutoDestroy);
|
20079
|
-
|
20049
|
+
const injectStyles = (options) => {
|
20080
20050
|
return injectStylesBeforeElement(options, document, getContainerEl());
|
20081
20051
|
};
|
20082
20052
|
/**
|
@@ -20090,10 +20060,10 @@ function getComponentDisplayName(componentOptions) {
|
|
20090
20060
|
return componentOptions.name;
|
20091
20061
|
}
|
20092
20062
|
if (componentOptions.__file) {
|
20093
|
-
|
20094
|
-
|
20063
|
+
const filepathSplit = componentOptions.__file.split('/');
|
20064
|
+
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
20095
20065
|
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
20096
|
-
|
20066
|
+
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
20097
20067
|
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
20098
20068
|
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
20099
20069
|
}
|
@@ -20112,35 +20082,34 @@ function getComponentDisplayName(componentOptions) {
|
|
20112
20082
|
* cy.get('#greeting').should('be.visible')
|
20113
20083
|
* })
|
20114
20084
|
*/
|
20115
|
-
|
20116
|
-
|
20117
|
-
|
20118
|
-
|
20119
|
-
|
20120
|
-
var message = "<" + componentName + " ... />";
|
20085
|
+
const mount = (component, optionsOrProps = {}) => {
|
20086
|
+
const options = Cypress._.pick(optionsOrProps, defaultOptions);
|
20087
|
+
const props = Cypress._.omit(optionsOrProps, defaultOptions);
|
20088
|
+
const componentName = getComponentDisplayName(component);
|
20089
|
+
const message = `<${componentName} ... />`;
|
20121
20090
|
return cy
|
20122
20091
|
.window({
|
20123
20092
|
log: false,
|
20124
20093
|
})
|
20125
|
-
.then(
|
20126
|
-
|
20094
|
+
.then(() => {
|
20095
|
+
const { style, stylesheets, stylesheet, styles, cssFiles, cssFile } = optionsOrProps;
|
20127
20096
|
injectStyles({
|
20128
|
-
style
|
20129
|
-
stylesheets
|
20130
|
-
stylesheet
|
20131
|
-
styles
|
20132
|
-
cssFiles
|
20133
|
-
cssFile
|
20097
|
+
style,
|
20098
|
+
stylesheets,
|
20099
|
+
stylesheet,
|
20100
|
+
styles,
|
20101
|
+
cssFiles,
|
20102
|
+
cssFile,
|
20134
20103
|
});
|
20135
20104
|
})
|
20136
|
-
.then(
|
20105
|
+
.then((win) => {
|
20137
20106
|
if (optionsOrProps.log !== false) {
|
20138
20107
|
Cypress.log({
|
20139
20108
|
name: 'mount',
|
20140
20109
|
message: [message],
|
20141
20110
|
}).snapshot('mounted').end();
|
20142
20111
|
}
|
20143
|
-
|
20112
|
+
const localVue = createLocalVue_1();
|
20144
20113
|
// @ts-ignore
|
20145
20114
|
win.Vue = localVue;
|
20146
20115
|
localVue.config.errorHandler = failTestOnVueError;
|
@@ -20155,9 +20124,9 @@ var mount = function (component, optionsOrProps) {
|
|
20155
20124
|
component.store = resetStoreVM(localVue, component);
|
20156
20125
|
}
|
20157
20126
|
// @ts-ignore
|
20158
|
-
|
20159
|
-
|
20160
|
-
|
20127
|
+
const document = cy.state('document');
|
20128
|
+
let el = getContainerEl();
|
20129
|
+
const componentNode = document.createElement('div');
|
20161
20130
|
el.append(componentNode);
|
20162
20131
|
// setup Vue instance
|
20163
20132
|
installFilters(localVue, options);
|
@@ -20165,8 +20134,8 @@ var mount = function (component, optionsOrProps) {
|
|
20165
20134
|
installPlugins(localVue, options, props);
|
20166
20135
|
registerGlobalComponents(localVue, options);
|
20167
20136
|
props.attachTo = componentNode;
|
20168
|
-
|
20169
|
-
|
20137
|
+
const wrapper = localVue.extend(component);
|
20138
|
+
const VTUWrapper = mount_1(wrapper, Object.assign({ localVue }, props));
|
20170
20139
|
Cypress.vue = VTUWrapper.vm;
|
20171
20140
|
Cypress.vueWrapper = VTUWrapper;
|
20172
20141
|
});
|
@@ -20177,8 +20146,8 @@ var mount = function (component, optionsOrProps) {
|
|
20177
20146
|
* import {mountCallback} from '@cypress/vue2'
|
20178
20147
|
* beforeEach(mountVue(component, options))
|
20179
20148
|
*/
|
20180
|
-
|
20181
|
-
return
|
20149
|
+
const mountCallback = (component, options) => {
|
20150
|
+
return () => mount(component, options);
|
20182
20151
|
};
|
20183
20152
|
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20184
20153
|
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|