cypress 13.11.0 → 13.13.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/angular/dist/index.d.ts +1 -2
- package/angular/angular/dist/index.js +239 -239
- package/angular/angular/package.json +1 -1
- package/angular/dist/index.d.ts +1 -2
- package/angular/dist/index.js +239 -239
- package/angular/package.json +1 -1
- package/angular-signals/README.md +11 -0
- package/angular-signals/angular-signals/README.md +11 -0
- package/angular-signals/angular-signals/dist/index.d.ts +136 -0
- package/angular-signals/angular-signals/dist/index.js +1861 -0
- package/angular-signals/angular-signals/package.json +74 -0
- package/angular-signals/dist/index.d.ts +136 -0
- package/angular-signals/dist/index.js +1861 -0
- package/angular-signals/package.json +74 -0
- package/lib/cli.js +0 -1
- package/lib/exec/xvfb.js +0 -1
- package/lib/logger.js +0 -3
- package/mount-utils/dist/index.d.ts +1 -1
- package/mount-utils/mount-utils/dist/index.d.ts +1 -1
- package/mount-utils/mount-utils/package.json +1 -1
- package/mount-utils/package.json +1 -1
- package/package.json +11 -5
- package/react/dist/cypress-react.cjs.js +237 -237
- package/react/dist/cypress-react.esm-bundler.js +237 -237
- package/react/dist/index.d.ts +1 -1
- package/react/package.json +3 -3
- package/react/react/dist/cypress-react.cjs.js +237 -237
- package/react/react/dist/cypress-react.esm-bundler.js +237 -237
- package/react/react/dist/index.d.ts +1 -1
- package/react/react/package.json +3 -3
- package/react18/dist/cypress-react.cjs.js +222 -222
- package/react18/dist/cypress-react.esm-bundler.js +222 -222
- package/react18/dist/index.d.ts +1 -1
- package/react18/package.json +1 -1
- package/react18/react18/dist/cypress-react.cjs.js +222 -222
- package/react18/react18/dist/cypress-react.esm-bundler.js +222 -222
- package/react18/react18/dist/index.d.ts +1 -1
- package/react18/react18/package.json +1 -1
- package/svelte/dist/cypress-svelte.cjs.js +61 -61
- package/svelte/dist/cypress-svelte.esm-bundler.js +61 -61
- package/svelte/dist/index.d.ts +2 -2
- package/svelte/package.json +1 -1
- package/svelte/svelte/dist/cypress-svelte.cjs.js +61 -61
- package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +61 -61
- package/svelte/svelte/dist/index.d.ts +2 -2
- package/svelte/svelte/package.json +1 -1
- package/vue/dist/cypress-vue.cjs.js +128 -128
- package/vue/dist/cypress-vue.esm-bundler.js +128 -128
- package/vue/dist/index.d.ts +5 -5
- package/vue/package.json +5 -5
- package/vue/vue/dist/cypress-vue.cjs.js +128 -128
- package/vue/vue/dist/cypress-vue.esm-bundler.js +128 -128
- package/vue/vue/dist/index.d.ts +5 -5
- package/vue/vue/package.json +5 -5
- package/vue2/dist/cypress-vue2.cjs.js +211 -211
- package/vue2/dist/cypress-vue2.esm-bundler.js +211 -211
- package/vue2/dist/index.d.ts +11 -11
- package/vue2/package.json +1 -1
- package/vue2/vue2/dist/cypress-vue2.cjs.js +211 -211
- package/vue2/vue2/dist/cypress-vue2.esm-bundler.js +211 -211
- package/vue2/vue2/dist/index.d.ts +11 -11
- package/vue2/vue2/package.json +1 -1
@@ -19826,217 +19826,217 @@ function setupHooks(optionalCallback) {
|
|
19826
19826
|
});
|
19827
19827
|
}
|
19828
19828
|
|
19829
|
-
/// <reference types="cypress" />
|
19830
|
-
const defaultOptions = [
|
19831
|
-
'vue',
|
19832
|
-
'extensions',
|
19833
|
-
];
|
19834
|
-
const DEFAULT_COMP_NAME = 'unknown';
|
19835
|
-
const registerGlobalComponents = (Vue, options) => {
|
19836
|
-
const globalComponents = Cypress._.get(options, 'extensions.components');
|
19837
|
-
if (Cypress._.isPlainObject(globalComponents)) {
|
19838
|
-
Cypress._.forEach(globalComponents, (component, id) => {
|
19839
|
-
Vue.component(id, component);
|
19840
|
-
});
|
19841
|
-
}
|
19842
|
-
};
|
19843
|
-
const installFilters = (Vue, options) => {
|
19844
|
-
const filters = Cypress._.get(options, 'extensions.filters');
|
19845
|
-
if (Cypress._.isPlainObject(filters)) {
|
19846
|
-
Object.keys(filters).forEach((name) => {
|
19847
|
-
Vue.filter(name, filters[name]);
|
19848
|
-
});
|
19849
|
-
}
|
19850
|
-
};
|
19851
|
-
const installPlugins = (Vue, options, props) => {
|
19852
|
-
const plugins = Cypress._.get(props, 'plugins') ||
|
19853
|
-
Cypress._.get(options, 'extensions.use') ||
|
19854
|
-
Cypress._.get(options, 'extensions.plugins') ||
|
19855
|
-
[];
|
19856
|
-
// @ts-ignore
|
19857
|
-
plugins.forEach((p) => {
|
19858
|
-
Array.isArray(p) ? Vue.use(...p) : Vue.use(p);
|
19859
|
-
});
|
19860
|
-
};
|
19861
|
-
const installMixins = (Vue, options) => {
|
19862
|
-
const mixins = Cypress._.get(options, 'extensions.mixin') ||
|
19863
|
-
Cypress._.get(options, 'extensions.mixins');
|
19864
|
-
if (Cypress._.isArray(mixins)) {
|
19865
|
-
mixins.forEach((mixin) => {
|
19866
|
-
Vue.mixin(mixin);
|
19867
|
-
});
|
19868
|
-
}
|
19869
|
-
};
|
19870
|
-
const registerGlobalDirectives = (Vue, options) => {
|
19871
|
-
const directives = Cypress._.get(options, 'extensions.directives');
|
19872
|
-
if (Cypress._.isPlainObject(directives)) {
|
19873
|
-
Object.keys(directives).forEach((name) => {
|
19874
|
-
Vue.directive(name, directives[name]);
|
19875
|
-
});
|
19876
|
-
}
|
19877
|
-
};
|
19878
|
-
const hasStore = ({ store }) => Boolean(store && store._vm);
|
19879
|
-
const forEachValue = (obj, fn) => {
|
19880
|
-
return Object.keys(obj).forEach((key) => fn(obj[key], key));
|
19881
|
-
};
|
19882
|
-
const resetStoreVM = (Vue, { store }) => {
|
19883
|
-
// bind store public getters
|
19884
|
-
store.getters = {};
|
19885
|
-
const wrappedGetters = store._wrappedGetters;
|
19886
|
-
const computed = {};
|
19887
|
-
forEachValue(wrappedGetters, (fn, key) => {
|
19888
|
-
// use computed to leverage its lazy-caching mechanism
|
19889
|
-
computed[key] = () => fn(store);
|
19890
|
-
Object.defineProperty(store.getters, key, {
|
19891
|
-
get: () => store._vm[key],
|
19892
|
-
enumerable: true, // for local getters
|
19893
|
-
});
|
19894
|
-
});
|
19895
|
-
store._watcherVM = new Vue();
|
19896
|
-
store._vm = new Vue({
|
19897
|
-
data: {
|
19898
|
-
$$state: store._vm._data.$$state,
|
19899
|
-
},
|
19900
|
-
computed,
|
19901
|
-
});
|
19902
|
-
return store;
|
19903
|
-
};
|
19904
|
-
const cleanup = () => {
|
19905
|
-
var _a;
|
19906
|
-
(_a = Cypress.vueWrapper) === null || _a === void 0 ? void 0 : _a.destroy();
|
19907
|
-
};
|
19908
|
-
/**
|
19909
|
-
* Direct Vue errors to the top error handler
|
19910
|
-
* where they will fail Cypress test
|
19911
|
-
* @see https://vuejs.org/v2/api/#errorHandler
|
19912
|
-
* @see https://github.com/cypress-io/cypress/issues/7910
|
19913
|
-
*/
|
19914
|
-
function failTestOnVueError(err, vm, info) {
|
19915
|
-
// Vue 2 try catches the error-handler so push the error to be caught outside
|
19916
|
-
// of the handler.
|
19917
|
-
setTimeout(() => {
|
19918
|
-
throw err;
|
19919
|
-
});
|
19920
|
-
}
|
19921
|
-
/**
|
19922
|
-
* Extract the component name from the object passed to mount
|
19923
|
-
* @param componentOptions the component passed to mount
|
19924
|
-
* @returns name of the component
|
19925
|
-
*/
|
19926
|
-
function getComponentDisplayName(componentOptions) {
|
19927
|
-
var _a;
|
19928
|
-
if (componentOptions.name) {
|
19929
|
-
return componentOptions.name;
|
19930
|
-
}
|
19931
|
-
if (componentOptions.__file) {
|
19932
|
-
const filepathSplit = componentOptions.__file.split('/');
|
19933
|
-
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
19934
|
-
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
19935
|
-
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
19936
|
-
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
19937
|
-
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
19938
|
-
}
|
19939
|
-
return DEFAULT_COMP_NAME;
|
19940
|
-
}
|
19941
|
-
/**
|
19942
|
-
* Mounts a Vue component inside Cypress browser.
|
19943
|
-
* @param {VueComponent} component imported from Vue file
|
19944
|
-
* @param {MountOptionsArgument} optionsOrProps used to pass options to component being mounted
|
19945
|
-
* @returns {Cypress.Chainable<{wrapper: Wrapper<T>, component: T}
|
19946
|
-
* @example
|
19947
|
-
* import { mount } from '@cypress/vue'
|
19948
|
-
* import { Stepper } from './Stepper.vue'
|
19949
|
-
*
|
19950
|
-
* it('mounts', () => {
|
19951
|
-
* cy.mount(Stepper)
|
19952
|
-
* cy.get('[data-cy=increment]').click()
|
19953
|
-
* cy.get('[data-cy=counter]').should('have.text', '1')
|
19954
|
-
* })
|
19955
|
-
* @see {@link https://on.cypress.io/mounting-vue} for more details.
|
19956
|
-
*
|
19957
|
-
*/
|
19958
|
-
const mount = (component, optionsOrProps = {}) => {
|
19959
|
-
checkForRemovedStyleOptions(optionsOrProps);
|
19960
|
-
// Remove last mounted component if cy.mount is called more than once in a test
|
19961
|
-
cleanup();
|
19962
|
-
const options = Cypress._.pick(optionsOrProps, defaultOptions);
|
19963
|
-
const props = Cypress._.omit(optionsOrProps, defaultOptions);
|
19964
|
-
const componentName = getComponentDisplayName(component);
|
19965
|
-
const message = `<${componentName} ... />`;
|
19966
|
-
return cy
|
19967
|
-
.window({
|
19968
|
-
log: false,
|
19969
|
-
})
|
19970
|
-
.then((win) => {
|
19971
|
-
const localVue = createLocalVue();
|
19972
|
-
// @ts-ignore
|
19973
|
-
win.Vue = localVue;
|
19974
|
-
localVue.config.errorHandler = failTestOnVueError;
|
19975
|
-
// set global Vue instance:
|
19976
|
-
// 1. convenience for debugging in DevTools
|
19977
|
-
// 2. some libraries might check for this global
|
19978
|
-
// appIframe.contentWindow.Vue = localVue
|
19979
|
-
// refresh inner Vue instance of Vuex store
|
19980
|
-
// @ts-ignore
|
19981
|
-
if (hasStore(component)) {
|
19982
|
-
// @ts-ignore
|
19983
|
-
component.store = resetStoreVM(localVue, component);
|
19984
|
-
}
|
19985
|
-
// @ts-ignore
|
19986
|
-
const document = cy.state('document');
|
19987
|
-
let el = getContainerEl();
|
19988
|
-
const componentNode = document.createElement('div');
|
19989
|
-
el.append(componentNode);
|
19990
|
-
// setup Vue instance
|
19991
|
-
installFilters(localVue, options);
|
19992
|
-
installMixins(localVue, options);
|
19993
|
-
installPlugins(localVue, options, props);
|
19994
|
-
registerGlobalDirectives(localVue, options);
|
19995
|
-
registerGlobalComponents(localVue, options);
|
19996
|
-
props.attachTo = componentNode;
|
19997
|
-
const wrapper = localVue.extend(component);
|
19998
|
-
const VTUWrapper = mount$1(wrapper, Object.assign({ localVue }, props));
|
19999
|
-
Cypress.vue = VTUWrapper.vm;
|
20000
|
-
Cypress.vueWrapper = VTUWrapper;
|
20001
|
-
return {
|
20002
|
-
wrapper: VTUWrapper,
|
20003
|
-
component: VTUWrapper.vm,
|
20004
|
-
};
|
20005
|
-
})
|
20006
|
-
.then(() => {
|
20007
|
-
if (optionsOrProps.log !== false) {
|
20008
|
-
return Vue.nextTick(() => {
|
20009
|
-
Cypress.log({
|
20010
|
-
name: 'mount',
|
20011
|
-
message: [message],
|
20012
|
-
});
|
20013
|
-
});
|
20014
|
-
}
|
20015
|
-
});
|
20016
|
-
};
|
20017
|
-
/**
|
20018
|
-
* Helper function for mounting a component quickly in test hooks.
|
20019
|
-
* @example
|
20020
|
-
* import {mountCallback} from '@cypress/vue2'
|
20021
|
-
* beforeEach(mountVue(component, options))
|
20022
|
-
*
|
20023
|
-
* Removed as of Cypress 11.0.0.
|
20024
|
-
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
20025
|
-
*/
|
20026
|
-
const mountCallback = (component, options) => {
|
20027
|
-
return () => {
|
20028
|
-
// @ts-expect-error - undocumented API
|
20029
|
-
Cypress.utils.throwErrByPath('mount.mount_callback');
|
20030
|
-
};
|
20031
|
-
};
|
20032
|
-
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20033
|
-
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
20034
|
-
// such as:
|
20035
|
-
// import 'cypress/<my-framework>/support'
|
20036
|
-
// or
|
20037
|
-
// import { registerCT } from 'cypress/<my-framework>'
|
20038
|
-
// registerCT()
|
20039
|
-
// Note: This would be a breaking change
|
19829
|
+
/// <reference types="cypress" />
|
19830
|
+
const defaultOptions = [
|
19831
|
+
'vue',
|
19832
|
+
'extensions',
|
19833
|
+
];
|
19834
|
+
const DEFAULT_COMP_NAME = 'unknown';
|
19835
|
+
const registerGlobalComponents = (Vue, options) => {
|
19836
|
+
const globalComponents = Cypress._.get(options, 'extensions.components');
|
19837
|
+
if (Cypress._.isPlainObject(globalComponents)) {
|
19838
|
+
Cypress._.forEach(globalComponents, (component, id) => {
|
19839
|
+
Vue.component(id, component);
|
19840
|
+
});
|
19841
|
+
}
|
19842
|
+
};
|
19843
|
+
const installFilters = (Vue, options) => {
|
19844
|
+
const filters = Cypress._.get(options, 'extensions.filters');
|
19845
|
+
if (Cypress._.isPlainObject(filters)) {
|
19846
|
+
Object.keys(filters).forEach((name) => {
|
19847
|
+
Vue.filter(name, filters[name]);
|
19848
|
+
});
|
19849
|
+
}
|
19850
|
+
};
|
19851
|
+
const installPlugins = (Vue, options, props) => {
|
19852
|
+
const plugins = Cypress._.get(props, 'plugins') ||
|
19853
|
+
Cypress._.get(options, 'extensions.use') ||
|
19854
|
+
Cypress._.get(options, 'extensions.plugins') ||
|
19855
|
+
[];
|
19856
|
+
// @ts-ignore
|
19857
|
+
plugins.forEach((p) => {
|
19858
|
+
Array.isArray(p) ? Vue.use(...p) : Vue.use(p);
|
19859
|
+
});
|
19860
|
+
};
|
19861
|
+
const installMixins = (Vue, options) => {
|
19862
|
+
const mixins = Cypress._.get(options, 'extensions.mixin') ||
|
19863
|
+
Cypress._.get(options, 'extensions.mixins');
|
19864
|
+
if (Cypress._.isArray(mixins)) {
|
19865
|
+
mixins.forEach((mixin) => {
|
19866
|
+
Vue.mixin(mixin);
|
19867
|
+
});
|
19868
|
+
}
|
19869
|
+
};
|
19870
|
+
const registerGlobalDirectives = (Vue, options) => {
|
19871
|
+
const directives = Cypress._.get(options, 'extensions.directives');
|
19872
|
+
if (Cypress._.isPlainObject(directives)) {
|
19873
|
+
Object.keys(directives).forEach((name) => {
|
19874
|
+
Vue.directive(name, directives[name]);
|
19875
|
+
});
|
19876
|
+
}
|
19877
|
+
};
|
19878
|
+
const hasStore = ({ store }) => Boolean(store && store._vm);
|
19879
|
+
const forEachValue = (obj, fn) => {
|
19880
|
+
return Object.keys(obj).forEach((key) => fn(obj[key], key));
|
19881
|
+
};
|
19882
|
+
const resetStoreVM = (Vue, { store }) => {
|
19883
|
+
// bind store public getters
|
19884
|
+
store.getters = {};
|
19885
|
+
const wrappedGetters = store._wrappedGetters;
|
19886
|
+
const computed = {};
|
19887
|
+
forEachValue(wrappedGetters, (fn, key) => {
|
19888
|
+
// use computed to leverage its lazy-caching mechanism
|
19889
|
+
computed[key] = () => fn(store);
|
19890
|
+
Object.defineProperty(store.getters, key, {
|
19891
|
+
get: () => store._vm[key],
|
19892
|
+
enumerable: true, // for local getters
|
19893
|
+
});
|
19894
|
+
});
|
19895
|
+
store._watcherVM = new Vue();
|
19896
|
+
store._vm = new Vue({
|
19897
|
+
data: {
|
19898
|
+
$$state: store._vm._data.$$state,
|
19899
|
+
},
|
19900
|
+
computed,
|
19901
|
+
});
|
19902
|
+
return store;
|
19903
|
+
};
|
19904
|
+
const cleanup = () => {
|
19905
|
+
var _a;
|
19906
|
+
(_a = Cypress.vueWrapper) === null || _a === void 0 ? void 0 : _a.destroy();
|
19907
|
+
};
|
19908
|
+
/**
|
19909
|
+
* Direct Vue errors to the top error handler
|
19910
|
+
* where they will fail Cypress test
|
19911
|
+
* @see https://vuejs.org/v2/api/#errorHandler
|
19912
|
+
* @see https://github.com/cypress-io/cypress/issues/7910
|
19913
|
+
*/
|
19914
|
+
function failTestOnVueError(err, vm, info) {
|
19915
|
+
// Vue 2 try catches the error-handler so push the error to be caught outside
|
19916
|
+
// of the handler.
|
19917
|
+
setTimeout(() => {
|
19918
|
+
throw err;
|
19919
|
+
});
|
19920
|
+
}
|
19921
|
+
/**
|
19922
|
+
* Extract the component name from the object passed to mount
|
19923
|
+
* @param componentOptions the component passed to mount
|
19924
|
+
* @returns name of the component
|
19925
|
+
*/
|
19926
|
+
function getComponentDisplayName(componentOptions) {
|
19927
|
+
var _a;
|
19928
|
+
if (componentOptions.name) {
|
19929
|
+
return componentOptions.name;
|
19930
|
+
}
|
19931
|
+
if (componentOptions.__file) {
|
19932
|
+
const filepathSplit = componentOptions.__file.split('/');
|
19933
|
+
const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
|
19934
|
+
// remove the extension .js, .ts or .vue from the filename to get the name of the component
|
19935
|
+
const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
|
19936
|
+
// if the filename is index, then we can use the direct parent foldername, else use the name itself
|
19937
|
+
return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
|
19938
|
+
}
|
19939
|
+
return DEFAULT_COMP_NAME;
|
19940
|
+
}
|
19941
|
+
/**
|
19942
|
+
* Mounts a Vue component inside Cypress browser.
|
19943
|
+
* @param {VueComponent} component imported from Vue file
|
19944
|
+
* @param {MountOptionsArgument} optionsOrProps used to pass options to component being mounted
|
19945
|
+
* @returns {Cypress.Chainable<{wrapper: Wrapper<T>, component: T}
|
19946
|
+
* @example
|
19947
|
+
* import { mount } from '@cypress/vue'
|
19948
|
+
* import { Stepper } from './Stepper.vue'
|
19949
|
+
*
|
19950
|
+
* it('mounts', () => {
|
19951
|
+
* cy.mount(Stepper)
|
19952
|
+
* cy.get('[data-cy=increment]').click()
|
19953
|
+
* cy.get('[data-cy=counter]').should('have.text', '1')
|
19954
|
+
* })
|
19955
|
+
* @see {@link https://on.cypress.io/mounting-vue} for more details.
|
19956
|
+
*
|
19957
|
+
*/
|
19958
|
+
const mount = (component, optionsOrProps = {}) => {
|
19959
|
+
checkForRemovedStyleOptions(optionsOrProps);
|
19960
|
+
// Remove last mounted component if cy.mount is called more than once in a test
|
19961
|
+
cleanup();
|
19962
|
+
const options = Cypress._.pick(optionsOrProps, defaultOptions);
|
19963
|
+
const props = Cypress._.omit(optionsOrProps, defaultOptions);
|
19964
|
+
const componentName = getComponentDisplayName(component);
|
19965
|
+
const message = `<${componentName} ... />`;
|
19966
|
+
return cy
|
19967
|
+
.window({
|
19968
|
+
log: false,
|
19969
|
+
})
|
19970
|
+
.then((win) => {
|
19971
|
+
const localVue = createLocalVue();
|
19972
|
+
// @ts-ignore
|
19973
|
+
win.Vue = localVue;
|
19974
|
+
localVue.config.errorHandler = failTestOnVueError;
|
19975
|
+
// set global Vue instance:
|
19976
|
+
// 1. convenience for debugging in DevTools
|
19977
|
+
// 2. some libraries might check for this global
|
19978
|
+
// appIframe.contentWindow.Vue = localVue
|
19979
|
+
// refresh inner Vue instance of Vuex store
|
19980
|
+
// @ts-ignore
|
19981
|
+
if (hasStore(component)) {
|
19982
|
+
// @ts-ignore
|
19983
|
+
component.store = resetStoreVM(localVue, component);
|
19984
|
+
}
|
19985
|
+
// @ts-ignore
|
19986
|
+
const document = cy.state('document');
|
19987
|
+
let el = getContainerEl();
|
19988
|
+
const componentNode = document.createElement('div');
|
19989
|
+
el.append(componentNode);
|
19990
|
+
// setup Vue instance
|
19991
|
+
installFilters(localVue, options);
|
19992
|
+
installMixins(localVue, options);
|
19993
|
+
installPlugins(localVue, options, props);
|
19994
|
+
registerGlobalDirectives(localVue, options);
|
19995
|
+
registerGlobalComponents(localVue, options);
|
19996
|
+
props.attachTo = componentNode;
|
19997
|
+
const wrapper = localVue.extend(component);
|
19998
|
+
const VTUWrapper = mount$1(wrapper, Object.assign({ localVue }, props));
|
19999
|
+
Cypress.vue = VTUWrapper.vm;
|
20000
|
+
Cypress.vueWrapper = VTUWrapper;
|
20001
|
+
return {
|
20002
|
+
wrapper: VTUWrapper,
|
20003
|
+
component: VTUWrapper.vm,
|
20004
|
+
};
|
20005
|
+
})
|
20006
|
+
.then(() => {
|
20007
|
+
if (optionsOrProps.log !== false) {
|
20008
|
+
return Vue.nextTick(() => {
|
20009
|
+
Cypress.log({
|
20010
|
+
name: 'mount',
|
20011
|
+
message: [message],
|
20012
|
+
});
|
20013
|
+
});
|
20014
|
+
}
|
20015
|
+
});
|
20016
|
+
};
|
20017
|
+
/**
|
20018
|
+
* Helper function for mounting a component quickly in test hooks.
|
20019
|
+
* @example
|
20020
|
+
* import {mountCallback} from '@cypress/vue2'
|
20021
|
+
* beforeEach(mountVue(component, options))
|
20022
|
+
*
|
20023
|
+
* Removed as of Cypress 11.0.0.
|
20024
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
20025
|
+
*/
|
20026
|
+
const mountCallback = (component, options) => {
|
20027
|
+
return () => {
|
20028
|
+
// @ts-expect-error - undocumented API
|
20029
|
+
Cypress.utils.throwErrByPath('mount.mount_callback');
|
20030
|
+
};
|
20031
|
+
};
|
20032
|
+
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20033
|
+
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
20034
|
+
// such as:
|
20035
|
+
// import 'cypress/<my-framework>/support'
|
20036
|
+
// or
|
20037
|
+
// import { registerCT } from 'cypress/<my-framework>'
|
20038
|
+
// registerCT()
|
20039
|
+
// Note: This would be a breaking change
|
20040
20040
|
setupHooks(cleanup);
|
20041
20041
|
|
20042
20042
|
export { mount, mountCallback };
|
@@ -13,29 +13,29 @@ import { ComponentPublicInstanceConstructor } from 'vue/types/v3-component-publi
|
|
13
13
|
* ^^^^^ this type
|
14
14
|
* mount(Hello)
|
15
15
|
*/
|
16
|
-
|
16
|
+
type VueComponent = Vue.ComponentOptions<any> | Vue.VueConstructor | ComponentPublicInstanceConstructor;
|
17
17
|
/**
|
18
18
|
* Options to pass to the component when creating it, like
|
19
19
|
* props.
|
20
20
|
*
|
21
21
|
* @interface ComponentOptions
|
22
22
|
*/
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
type ComponentOptions = Record<string, unknown>;
|
24
|
+
type VueLocalComponents = Record<string, VueComponent>;
|
25
|
+
type VueFilters = {
|
26
26
|
[key: string]: (value: string) => string;
|
27
27
|
};
|
28
|
-
|
28
|
+
type VueDirectives = {
|
29
29
|
[key: string]: Function | Object;
|
30
30
|
};
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
type VueMixin = unknown;
|
32
|
+
type VueMixins = VueMixin | VueMixin[];
|
33
|
+
type VuePluginOptions = unknown;
|
34
|
+
type VuePlugin = unknown | [unknown, VuePluginOptions];
|
35
35
|
/**
|
36
36
|
* A single Vue plugin or a list of plugins to register
|
37
37
|
*/
|
38
|
-
|
38
|
+
type VuePlugins = VuePlugin[];
|
39
39
|
/**
|
40
40
|
* Additional Vue services to register while mounting the component, like
|
41
41
|
* local components, plugins, etc.
|
@@ -152,7 +152,7 @@ interface MountOptions {
|
|
152
152
|
/**
|
153
153
|
* Utility type for union of options passed to "mount(..., options)"
|
154
154
|
*/
|
155
|
-
|
155
|
+
type MountOptionsArgument = Partial<ComponentOptions & MountOptions & VueTestUtilsConfigOptions>;
|
156
156
|
declare global {
|
157
157
|
namespace Cypress {
|
158
158
|
interface Cypress {
|