cypress 10.5.0 → 10.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/CHANGELOG.md +43 -0
- package/angular/README.md +43 -112
- package/angular/dist/index.js +8 -6
- package/angular/dist/mount.d.ts +1 -0
- package/angular/package.json +6 -8
- package/lib/tasks/download.js +4 -3
- package/mount-utils/CHANGELOG.md +7 -0
- package/mount-utils/package.json +5 -1
- package/package.json +11 -5
- package/react/CHANGELOG.md +14 -0
- package/react/dist/createMount.d.ts +5 -2
- package/react/dist/cypress-react.cjs.js +80 -115
- package/react/dist/cypress-react.esm-bundler.js +66 -101
- package/react/dist/mount.d.ts +1 -0
- package/react/dist/mountHook.d.ts +1 -0
- package/react/dist/types.d.ts +1 -0
- package/react/package.json +3 -7
- package/react18/CHANGELOG.md +14 -0
- package/react18/dist/cypress-react.cjs.js +63 -89
- package/react18/dist/cypress-react.esm-bundler.js +49 -75
- package/react18/dist/index.d.ts +1 -0
- package/react18/package.json +2 -2
- package/svelte/CHANGELOG.md +6 -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 -12
- package/vue/CHANGELOG.md +7 -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 +3 -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
@@ -7,32 +7,6 @@
|
|
7
7
|
|
8
8
|
import require$$0$1 from 'vue';
|
9
9
|
|
10
|
-
/******************************************************************************
|
11
|
-
Copyright (c) Microsoft Corporation.
|
12
|
-
|
13
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
14
|
-
purpose with or without fee is hereby granted.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
17
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
18
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
19
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
20
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
21
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
22
|
-
PERFORMANCE OF THIS SOFTWARE.
|
23
|
-
***************************************************************************** */
|
24
|
-
|
25
|
-
var __assign = function() {
|
26
|
-
__assign = Object.assign || function __assign(t) {
|
27
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
28
|
-
s = arguments[i];
|
29
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
30
|
-
}
|
31
|
-
return t;
|
32
|
-
};
|
33
|
-
return __assign.apply(this, arguments);
|
34
|
-
};
|
35
|
-
|
36
10
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
37
11
|
|
38
12
|
function createCommonjsModule$1(fn) {
|
@@ -19979,64 +19953,60 @@ function setupHooks(optionalCallback) {
|
|
19979
19953
|
});
|
19980
19954
|
}
|
19981
19955
|
|
19982
|
-
|
19956
|
+
const defaultOptions = [
|
19983
19957
|
'vue',
|
19984
19958
|
'extensions',
|
19985
19959
|
];
|
19986
|
-
|
19987
|
-
|
19988
|
-
|
19960
|
+
const DEFAULT_COMP_NAME = 'unknown';
|
19961
|
+
const registerGlobalComponents = (Vue, options) => {
|
19962
|
+
const globalComponents = Cypress._.get(options, 'extensions.components');
|
19989
19963
|
if (Cypress._.isPlainObject(globalComponents)) {
|
19990
|
-
Cypress._.forEach(globalComponents,
|
19964
|
+
Cypress._.forEach(globalComponents, (component, id) => {
|
19991
19965
|
Vue.component(id, component);
|
19992
19966
|
});
|
19993
19967
|
}
|
19994
19968
|
};
|
19995
|
-
|
19996
|
-
|
19969
|
+
const installFilters = (Vue, options) => {
|
19970
|
+
const filters = Cypress._.get(options, 'extensions.filters');
|
19997
19971
|
if (Cypress._.isPlainObject(filters)) {
|
19998
|
-
Object.keys(filters).forEach(
|
19972
|
+
Object.keys(filters).forEach((name) => {
|
19999
19973
|
Vue.filter(name, filters[name]);
|
20000
19974
|
});
|
20001
19975
|
}
|
20002
19976
|
};
|
20003
|
-
|
20004
|
-
|
19977
|
+
const installPlugins = (Vue, options, props) => {
|
19978
|
+
const plugins = Cypress._.get(props, 'plugins') ||
|
20005
19979
|
Cypress._.get(options, 'extensions.use') ||
|
20006
19980
|
Cypress._.get(options, 'extensions.plugins') ||
|
20007
19981
|
[];
|
20008
19982
|
// @ts-ignore
|
20009
|
-
plugins.forEach(
|
20010
|
-
Array.isArray(p) ? Vue.use
|
19983
|
+
plugins.forEach((p) => {
|
19984
|
+
Array.isArray(p) ? Vue.use(...p) : Vue.use(p);
|
20011
19985
|
});
|
20012
19986
|
};
|
20013
|
-
|
20014
|
-
|
19987
|
+
const installMixins = (Vue, options) => {
|
19988
|
+
const mixins = Cypress._.get(options, 'extensions.mixin') ||
|
20015
19989
|
Cypress._.get(options, 'extensions.mixins');
|
20016
19990
|
if (Cypress._.isArray(mixins)) {
|
20017
|
-
mixins.forEach(
|
19991
|
+
mixins.forEach((mixin) => {
|
20018
19992
|
Vue.mixin(mixin);
|
20019
19993
|
});
|
20020
19994
|
}
|
20021
19995
|
};
|
20022
|
-
|
20023
|
-
|
20024
|
-
return
|
20025
|
-
};
|
20026
|
-
var forEachValue = function (obj, fn) {
|
20027
|
-
return Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
|
19996
|
+
const hasStore = ({ store }) => Boolean(store && store._vm);
|
19997
|
+
const forEachValue = (obj, fn) => {
|
19998
|
+
return Object.keys(obj).forEach((key) => fn(obj[key], key));
|
20028
19999
|
};
|
20029
|
-
|
20030
|
-
var store = _a.store;
|
20000
|
+
const resetStoreVM = (Vue, { store }) => {
|
20031
20001
|
// bind store public getters
|
20032
20002
|
store.getters = {};
|
20033
|
-
|
20034
|
-
|
20035
|
-
forEachValue(wrappedGetters,
|
20003
|
+
const wrappedGetters = store._wrappedGetters;
|
20004
|
+
const computed = {};
|
20005
|
+
forEachValue(wrappedGetters, (fn, key) => {
|
20036
20006
|
// use computed to leverage its lazy-caching mechanism
|
20037
|
-
computed[key] =
|
20007
|
+
computed[key] = () => fn(store);
|
20038
20008
|
Object.defineProperty(store.getters, key, {
|
20039
|
-
get:
|
20009
|
+
get: () => store._vm[key],
|
20040
20010
|
enumerable: true, // for local getters
|
20041
20011
|
});
|
20042
20012
|
});
|
@@ -20045,7 +20015,7 @@ var resetStoreVM = function (Vue, _a) {
|
|
20045
20015
|
data: {
|
20046
20016
|
$$state: store._vm._data.$$state,
|
20047
20017
|
},
|
20048
|
-
computed
|
20018
|
+
computed,
|
20049
20019
|
});
|
20050
20020
|
return store;
|
20051
20021
|
};
|
@@ -20056,19 +20026,19 @@ var resetStoreVM = function (Vue, _a) {
|
|
20056
20026
|
* @see https://github.com/cypress-io/cypress/issues/7910
|
20057
20027
|
*/
|
20058
20028
|
function failTestOnVueError(err, vm, info) {
|
20059
|
-
console.error(
|
20029
|
+
console.error(`Vue error`);
|
20060
20030
|
console.error(err);
|
20061
20031
|
console.error('component:', vm);
|
20062
20032
|
console.error('info:', info);
|
20063
20033
|
window.top.onerror(err);
|
20064
20034
|
}
|
20065
20035
|
function registerAutoDestroy($destroy) {
|
20066
|
-
Cypress.on('test:before:run',
|
20036
|
+
Cypress.on('test:before:run', () => {
|
20067
20037
|
$destroy();
|
20068
20038
|
});
|
20069
20039
|
}
|
20070
20040
|
enableAutoDestroy_1(registerAutoDestroy);
|
20071
|
-
|
20041
|
+
const injectStyles = (options) => {
|
20072
20042
|
return injectStylesBeforeElement(options, document, getContainerEl());
|
20073
20043
|
};
|
20074
20044
|
/**
|
@@ -20082,10 +20052,10 @@ function getComponentDisplayName(componentOptions) {
|
|
20082
20052
|
return componentOptions.name;
|
20083
20053
|
}
|
20084
20054
|
if (componentOptions.__file) {
|
20085
|
-
|
20086
|
-
|
20055
|
+
const filepathSplit = componentOptions.__file.split('/');
|
20056
|
+
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
20087
20057
|
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
20088
|
-
|
20058
|
+
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
20089
20059
|
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
20090
20060
|
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
20091
20061
|
}
|
@@ -20104,35 +20074,34 @@ function getComponentDisplayName(componentOptions) {
|
|
20104
20074
|
* cy.get('#greeting').should('be.visible')
|
20105
20075
|
* })
|
20106
20076
|
*/
|
20107
|
-
|
20108
|
-
|
20109
|
-
|
20110
|
-
|
20111
|
-
|
20112
|
-
var message = "<" + componentName + " ... />";
|
20077
|
+
const mount = (component, optionsOrProps = {}) => {
|
20078
|
+
const options = Cypress._.pick(optionsOrProps, defaultOptions);
|
20079
|
+
const props = Cypress._.omit(optionsOrProps, defaultOptions);
|
20080
|
+
const componentName = getComponentDisplayName(component);
|
20081
|
+
const message = `<${componentName} ... />`;
|
20113
20082
|
return cy
|
20114
20083
|
.window({
|
20115
20084
|
log: false,
|
20116
20085
|
})
|
20117
|
-
.then(
|
20118
|
-
|
20086
|
+
.then(() => {
|
20087
|
+
const { style, stylesheets, stylesheet, styles, cssFiles, cssFile } = optionsOrProps;
|
20119
20088
|
injectStyles({
|
20120
|
-
style
|
20121
|
-
stylesheets
|
20122
|
-
stylesheet
|
20123
|
-
styles
|
20124
|
-
cssFiles
|
20125
|
-
cssFile
|
20089
|
+
style,
|
20090
|
+
stylesheets,
|
20091
|
+
stylesheet,
|
20092
|
+
styles,
|
20093
|
+
cssFiles,
|
20094
|
+
cssFile,
|
20126
20095
|
});
|
20127
20096
|
})
|
20128
|
-
.then(
|
20097
|
+
.then((win) => {
|
20129
20098
|
if (optionsOrProps.log !== false) {
|
20130
20099
|
Cypress.log({
|
20131
20100
|
name: 'mount',
|
20132
20101
|
message: [message],
|
20133
20102
|
}).snapshot('mounted').end();
|
20134
20103
|
}
|
20135
|
-
|
20104
|
+
const localVue = createLocalVue_1();
|
20136
20105
|
// @ts-ignore
|
20137
20106
|
win.Vue = localVue;
|
20138
20107
|
localVue.config.errorHandler = failTestOnVueError;
|
@@ -20147,9 +20116,9 @@ var mount = function (component, optionsOrProps) {
|
|
20147
20116
|
component.store = resetStoreVM(localVue, component);
|
20148
20117
|
}
|
20149
20118
|
// @ts-ignore
|
20150
|
-
|
20151
|
-
|
20152
|
-
|
20119
|
+
const document = cy.state('document');
|
20120
|
+
let el = getContainerEl();
|
20121
|
+
const componentNode = document.createElement('div');
|
20153
20122
|
el.append(componentNode);
|
20154
20123
|
// setup Vue instance
|
20155
20124
|
installFilters(localVue, options);
|
@@ -20157,8 +20126,8 @@ var mount = function (component, optionsOrProps) {
|
|
20157
20126
|
installPlugins(localVue, options, props);
|
20158
20127
|
registerGlobalComponents(localVue, options);
|
20159
20128
|
props.attachTo = componentNode;
|
20160
|
-
|
20161
|
-
|
20129
|
+
const wrapper = localVue.extend(component);
|
20130
|
+
const VTUWrapper = mount_1(wrapper, Object.assign({ localVue }, props));
|
20162
20131
|
Cypress.vue = VTUWrapper.vm;
|
20163
20132
|
Cypress.vueWrapper = VTUWrapper;
|
20164
20133
|
});
|
@@ -20169,8 +20138,8 @@ var mount = function (component, optionsOrProps) {
|
|
20169
20138
|
* import {mountCallback} from '@cypress/vue2'
|
20170
20139
|
* beforeEach(mountVue(component, options))
|
20171
20140
|
*/
|
20172
|
-
|
20173
|
-
return
|
20141
|
+
const mountCallback = (component, options) => {
|
20142
|
+
return () => mount(component, options);
|
20174
20143
|
};
|
20175
20144
|
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20176
20145
|
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
package/vue2/dist/index.d.ts
CHANGED
package/vue2/package.json
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
"main": "dist/cypress-vue2.cjs.js",
|
6
6
|
"scripts": {
|
7
7
|
"typecheck": "tsc --noEmit",
|
8
|
-
"build": "rimraf dist && yarn rollup -c rollup.config.
|
8
|
+
"build": "rimraf dist && yarn rollup -c rollup.config.mjs",
|
9
9
|
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
|
10
10
|
"build-prod": "yarn build",
|
11
11
|
"test": "echo \"Tests for @cypress/vue2 are run from system-tests\"",
|
@@ -17,13 +17,10 @@
|
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"@cypress/mount-utils": "0.0.0-development",
|
20
|
-
"@rollup/plugin-commonjs": "^17.1.0",
|
21
20
|
"@rollup/plugin-json": "^4.1.0",
|
22
|
-
"@rollup/plugin-node-resolve": "^11.1.1",
|
23
21
|
"@rollup/plugin-replace": "^2.3.1",
|
24
|
-
"rollup-plugin-typescript2": "^0.29.0",
|
25
22
|
"tslib": "^2.1.0",
|
26
|
-
"typescript": "^4.
|
23
|
+
"typescript": "^4.7.4",
|
27
24
|
"vue": "2.6.12"
|
28
25
|
},
|
29
26
|
"peerDependencies": {
|