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