cypress 10.11.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/angular/CHANGELOG.md +20 -0
  2. package/angular/README.md +2 -77
  3. package/angular/dist/index.d.ts +124 -1
  4. package/angular/dist/index.js +59 -59
  5. package/lib/cli.js +15 -1
  6. package/lib/tasks/download.js +3 -7
  7. package/lib/util.js +2 -2
  8. package/mount-utils/CHANGELOG.md +14 -0
  9. package/mount-utils/README.md +7 -24
  10. package/mount-utils/dist/index.d.ts +25 -39
  11. package/mount-utils/dist/index.js +33 -112
  12. package/mount-utils/package.json +1 -0
  13. package/package.json +3 -3
  14. package/react/CHANGELOG.md +27 -0
  15. package/react/README.md +2 -107
  16. package/react/dist/cypress-react.cjs.js +92 -219
  17. package/react/dist/cypress-react.esm-bundler.js +92 -220
  18. package/react/dist/index.d.ts +111 -4
  19. package/react18/CHANGELOG.md +13 -0
  20. package/react18/README.md +7 -0
  21. package/react18/dist/cypress-react.cjs.js +117 -180
  22. package/react18/dist/cypress-react.esm-bundler.js +103 -167
  23. package/react18/dist/index.d.ts +78 -6
  24. package/react18/package.json +1 -0
  25. package/svelte/CHANGELOG.md +20 -0
  26. package/svelte/README.md +1 -69
  27. package/svelte/dist/cypress-svelte.cjs.js +19 -114
  28. package/svelte/dist/cypress-svelte.esm-bundler.js +19 -114
  29. package/svelte/dist/index.d.ts +201 -1
  30. package/types/cypress.d.ts +18 -10
  31. package/vue/CHANGELOG.md +34 -0
  32. package/vue/README.md +2 -76
  33. package/vue/dist/cypress-vue.cjs.js +68 -151
  34. package/vue/dist/cypress-vue.esm-bundler.js +68 -151
  35. package/vue/dist/index.d.ts +1352 -104
  36. package/vue/package.json +1 -1
  37. package/vue2/CHANGELOG.md +27 -0
  38. package/vue2/README.md +2 -72
  39. package/vue2/dist/cypress-vue2.cjs.js +87 -211
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
  41. package/vue2/dist/index.d.ts +341 -172
  42. package/vue2/package.json +1 -3
  43. package/angular/dist/mount.d.ts +0 -112
  44. package/react/dist/createMount.d.ts +0 -31
  45. package/react/dist/getDisplayName.d.ts +0 -8
  46. package/react/dist/mount.d.ts +0 -8
  47. package/react/dist/mountHook.d.ts +0 -12
  48. package/react/dist/types.d.ts +0 -45
  49. package/svelte/dist/mount.d.ts +0 -30
  50. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
  51. package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
  52. package/vue/dist/@vue/test-utils/config.d.ts +0 -30
  53. package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
  54. package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
  55. package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
  56. package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
  57. package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
  58. package/vue/dist/@vue/test-utils/index.d.ts +0 -11
  59. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
  60. package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
  61. package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
  62. package/vue/dist/@vue/test-utils/types.d.ts +0 -125
  63. package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
  64. package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
  65. package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
  66. package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
  67. package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
  68. package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
  69. package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
  70. package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
  71. package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
  72. package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
  73. package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
  74. package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
  75. package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
  76. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
  77. package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
@@ -10,6 +10,11 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  const ROOT_SELECTOR = '[data-cy-root]';
13
+ /**
14
+ * Gets the root element used to mount the component.
15
+ * @returns {HTMLElement} The root element
16
+ * @throws {Error} If the root element is not found
17
+ */
13
18
  const getContainerEl = () => {
14
19
  const el = document.querySelector(ROOT_SELECTOR);
15
20
  if (el) {
@@ -17,122 +22,19 @@ const getContainerEl = () => {
17
22
  }
18
23
  throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please add a root element with data-cy-root attribute to your "component-index.html" file so that Cypress can attach your component to the DOM.`);
19
24
  };
20
- /**
21
- * Remove any style or extra link elements from the iframe placeholder
22
- * left from any previous test
23
- *
24
- */
25
- function cleanupStyles() {
26
- const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
27
- styles.forEach((styleElement) => {
28
- if (styleElement.parentElement) {
29
- styleElement.parentElement.removeChild(styleElement);
30
- }
31
- });
32
- const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
33
- links.forEach((link) => {
34
- if (link.parentElement) {
35
- link.parentElement.removeChild(link);
25
+ function checkForRemovedStyleOptions(mountingOptions) {
26
+ for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
27
+ if (mountingOptions[key]) {
28
+ Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
36
29
  }
37
- });
38
- }
39
- /**
40
- * Insert links to external style resources.
41
- */
42
- function insertStylesheets(stylesheets, document, el) {
43
- stylesheets.forEach((href) => {
44
- const link = document.createElement('link');
45
- link.type = 'text/css';
46
- link.rel = 'stylesheet';
47
- link.href = href;
48
- link.dataset.cy = 'injected-stylesheet';
49
- document.body.insertBefore(link, el);
50
- });
51
- }
52
- /**
53
- * Inserts a single stylesheet element
54
- */
55
- function insertStyles(styles, document, el) {
56
- styles.forEach((style) => {
57
- const styleElement = document.createElement('style');
58
- styleElement.dataset.cy = 'injected-style-tag';
59
- styleElement.appendChild(document.createTextNode(style));
60
- document.body.insertBefore(styleElement, el);
61
- });
62
- }
63
- function insertSingleCssFile(cssFilename, document, el, log) {
64
- return cy.readFile(cssFilename, { log }).then((css) => {
65
- const style = document.createElement('style');
66
- style.appendChild(document.createTextNode(css));
67
- document.body.insertBefore(style, el);
68
- });
69
- }
70
- /**
71
- * Reads the given CSS file from local file system
72
- * and adds the loaded style text as an element.
73
- */
74
- function insertLocalCssFiles(cssFilenames, document, el, log) {
75
- return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
76
- return insertSingleCssFile(cssFilename, document, el, log);
77
- });
30
+ }
78
31
  }
79
32
  /**
80
- * Injects custom style text or CSS file or 3rd party style resources
81
- * into the given document.
33
+ * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
34
+ * @param optionalCallback Callback to be called before the next test runs
82
35
  */
83
- const injectStylesBeforeElement = (options, document, el) => {
84
- if (!el)
85
- return;
86
- // first insert all stylesheets as Link elements
87
- let stylesheets = [];
88
- if (typeof options.stylesheet === 'string') {
89
- stylesheets.push(options.stylesheet);
90
- }
91
- else if (Array.isArray(options.stylesheet)) {
92
- stylesheets = stylesheets.concat(options.stylesheet);
93
- }
94
- if (typeof options.stylesheets === 'string') {
95
- options.stylesheets = [options.stylesheets];
96
- }
97
- if (options.stylesheets) {
98
- stylesheets = stylesheets.concat(options.stylesheets);
99
- }
100
- insertStylesheets(stylesheets, document, el);
101
- // insert any styles as <style>...</style> elements
102
- let styles = [];
103
- if (typeof options.style === 'string') {
104
- styles.push(options.style);
105
- }
106
- else if (Array.isArray(options.style)) {
107
- styles = styles.concat(options.style);
108
- }
109
- if (typeof options.styles === 'string') {
110
- styles.push(options.styles);
111
- }
112
- else if (Array.isArray(options.styles)) {
113
- styles = styles.concat(options.styles);
114
- }
115
- insertStyles(styles, document, el);
116
- // now load any css files by path and add their content
117
- // as <style>...</style> elements
118
- let cssFiles = [];
119
- if (typeof options.cssFile === 'string') {
120
- cssFiles.push(options.cssFile);
121
- }
122
- else if (Array.isArray(options.cssFile)) {
123
- cssFiles = cssFiles.concat(options.cssFile);
124
- }
125
- if (typeof options.cssFiles === 'string') {
126
- cssFiles.push(options.cssFiles);
127
- }
128
- else if (Array.isArray(options.cssFiles)) {
129
- cssFiles = cssFiles.concat(options.cssFiles);
130
- }
131
- return insertLocalCssFiles(cssFiles, document, el, options.log);
132
- };
133
36
  function setupHooks(optionalCallback) {
134
- // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
135
- // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
37
+ // We don't want CT side effects to run when e2e
136
38
  // testing so we early return.
137
39
  // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
138
40
  if (Cypress.testingType !== 'component') {
@@ -147,7 +49,6 @@ function setupHooks(optionalCallback) {
147
49
  // @ts-ignore
148
50
  Cypress.on('test:before:run', () => {
149
51
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
150
- cleanupStyles();
151
52
  });
152
53
  }
153
54
 
@@ -179,11 +80,15 @@ const getComponentDisplayName = (Component) => {
179
80
  * mount(Counter, { props: { count: 42 } })
180
81
  * cy.get('button').contains(42)
181
82
  * })
83
+ *
84
+ * @see {@link https://on.cypress.io/mounting-svelte} for more details.
182
85
  */
183
86
  function mount(Component, options = {}) {
87
+ checkForRemovedStyleOptions(options);
184
88
  return cy.then(() => {
89
+ // Remove last mounted component if cy.mount is called more than once in a test
90
+ cleanup();
185
91
  const target = getContainerEl();
186
- injectStylesBeforeElement(options, document, target);
187
92
  const ComponentConstructor = (Component.default || Component);
188
93
  componentInstance = new ComponentConstructor(Object.assign({ target }, options));
189
94
  // by waiting, we are delaying test execution for the next tick of event loop
@@ -194,7 +99,7 @@ function mount(Component, options = {}) {
194
99
  Cypress.log({
195
100
  name: 'mount',
196
101
  message: [mountMessage],
197
- }).snapshot('mounted').end();
102
+ });
198
103
  }
199
104
  })
200
105
  .wrap({ component: componentInstance }, { log: false });
@@ -6,6 +6,11 @@
6
6
  */
7
7
 
8
8
  const ROOT_SELECTOR = '[data-cy-root]';
9
+ /**
10
+ * Gets the root element used to mount the component.
11
+ * @returns {HTMLElement} The root element
12
+ * @throws {Error} If the root element is not found
13
+ */
9
14
  const getContainerEl = () => {
10
15
  const el = document.querySelector(ROOT_SELECTOR);
11
16
  if (el) {
@@ -13,122 +18,19 @@ const getContainerEl = () => {
13
18
  }
14
19
  throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please add a root element with data-cy-root attribute to your "component-index.html" file so that Cypress can attach your component to the DOM.`);
15
20
  };
16
- /**
17
- * Remove any style or extra link elements from the iframe placeholder
18
- * left from any previous test
19
- *
20
- */
21
- function cleanupStyles() {
22
- const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
23
- styles.forEach((styleElement) => {
24
- if (styleElement.parentElement) {
25
- styleElement.parentElement.removeChild(styleElement);
26
- }
27
- });
28
- const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
29
- links.forEach((link) => {
30
- if (link.parentElement) {
31
- link.parentElement.removeChild(link);
21
+ function checkForRemovedStyleOptions(mountingOptions) {
22
+ for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
23
+ if (mountingOptions[key]) {
24
+ Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
32
25
  }
33
- });
34
- }
35
- /**
36
- * Insert links to external style resources.
37
- */
38
- function insertStylesheets(stylesheets, document, el) {
39
- stylesheets.forEach((href) => {
40
- const link = document.createElement('link');
41
- link.type = 'text/css';
42
- link.rel = 'stylesheet';
43
- link.href = href;
44
- link.dataset.cy = 'injected-stylesheet';
45
- document.body.insertBefore(link, el);
46
- });
47
- }
48
- /**
49
- * Inserts a single stylesheet element
50
- */
51
- function insertStyles(styles, document, el) {
52
- styles.forEach((style) => {
53
- const styleElement = document.createElement('style');
54
- styleElement.dataset.cy = 'injected-style-tag';
55
- styleElement.appendChild(document.createTextNode(style));
56
- document.body.insertBefore(styleElement, el);
57
- });
58
- }
59
- function insertSingleCssFile(cssFilename, document, el, log) {
60
- return cy.readFile(cssFilename, { log }).then((css) => {
61
- const style = document.createElement('style');
62
- style.appendChild(document.createTextNode(css));
63
- document.body.insertBefore(style, el);
64
- });
65
- }
66
- /**
67
- * Reads the given CSS file from local file system
68
- * and adds the loaded style text as an element.
69
- */
70
- function insertLocalCssFiles(cssFilenames, document, el, log) {
71
- return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
72
- return insertSingleCssFile(cssFilename, document, el, log);
73
- });
26
+ }
74
27
  }
75
28
  /**
76
- * Injects custom style text or CSS file or 3rd party style resources
77
- * into the given document.
29
+ * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
30
+ * @param optionalCallback Callback to be called before the next test runs
78
31
  */
79
- const injectStylesBeforeElement = (options, document, el) => {
80
- if (!el)
81
- return;
82
- // first insert all stylesheets as Link elements
83
- let stylesheets = [];
84
- if (typeof options.stylesheet === 'string') {
85
- stylesheets.push(options.stylesheet);
86
- }
87
- else if (Array.isArray(options.stylesheet)) {
88
- stylesheets = stylesheets.concat(options.stylesheet);
89
- }
90
- if (typeof options.stylesheets === 'string') {
91
- options.stylesheets = [options.stylesheets];
92
- }
93
- if (options.stylesheets) {
94
- stylesheets = stylesheets.concat(options.stylesheets);
95
- }
96
- insertStylesheets(stylesheets, document, el);
97
- // insert any styles as <style>...</style> elements
98
- let styles = [];
99
- if (typeof options.style === 'string') {
100
- styles.push(options.style);
101
- }
102
- else if (Array.isArray(options.style)) {
103
- styles = styles.concat(options.style);
104
- }
105
- if (typeof options.styles === 'string') {
106
- styles.push(options.styles);
107
- }
108
- else if (Array.isArray(options.styles)) {
109
- styles = styles.concat(options.styles);
110
- }
111
- insertStyles(styles, document, el);
112
- // now load any css files by path and add their content
113
- // as <style>...</style> elements
114
- let cssFiles = [];
115
- if (typeof options.cssFile === 'string') {
116
- cssFiles.push(options.cssFile);
117
- }
118
- else if (Array.isArray(options.cssFile)) {
119
- cssFiles = cssFiles.concat(options.cssFile);
120
- }
121
- if (typeof options.cssFiles === 'string') {
122
- cssFiles.push(options.cssFiles);
123
- }
124
- else if (Array.isArray(options.cssFiles)) {
125
- cssFiles = cssFiles.concat(options.cssFiles);
126
- }
127
- return insertLocalCssFiles(cssFiles, document, el, options.log);
128
- };
129
32
  function setupHooks(optionalCallback) {
130
- // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
131
- // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
33
+ // We don't want CT side effects to run when e2e
132
34
  // testing so we early return.
133
35
  // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
134
36
  if (Cypress.testingType !== 'component') {
@@ -143,7 +45,6 @@ function setupHooks(optionalCallback) {
143
45
  // @ts-ignore
144
46
  Cypress.on('test:before:run', () => {
145
47
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
146
- cleanupStyles();
147
48
  });
148
49
  }
149
50
 
@@ -175,11 +76,15 @@ const getComponentDisplayName = (Component) => {
175
76
  * mount(Counter, { props: { count: 42 } })
176
77
  * cy.get('button').contains(42)
177
78
  * })
79
+ *
80
+ * @see {@link https://on.cypress.io/mounting-svelte} for more details.
178
81
  */
179
82
  function mount(Component, options = {}) {
83
+ checkForRemovedStyleOptions(options);
180
84
  return cy.then(() => {
85
+ // Remove last mounted component if cy.mount is called more than once in a test
86
+ cleanup();
181
87
  const target = getContainerEl();
182
- injectStylesBeforeElement(options, document, target);
183
88
  const ComponentConstructor = (Component.default || Component);
184
89
  componentInstance = new ComponentConstructor(Object.assign({ target }, options));
185
90
  // by waiting, we are delaying test execution for the next tick of event loop
@@ -190,7 +95,7 @@ function mount(Component, options = {}) {
190
95
  Cypress.log({
191
96
  name: 'mount',
192
97
  message: [mountMessage],
193
- }).snapshot('mounted').end();
98
+ });
194
99
  }
195
100
  })
196
101
  .wrap({ component: componentInstance }, { log: false });
@@ -1 +1,201 @@
1
- export * from './mount';
1
+ /// <reference types="cypress" />
2
+
3
+ declare module '*.svelte' {
4
+ export { SvelteComponentDev as default } from 'svelte/internal';
5
+ }
6
+
7
+ /**
8
+ * INTERNAL, DO NOT USE. Code may change at any time.
9
+ */
10
+ interface Fragment {
11
+ key: string | null;
12
+ first: null;
13
+ c: () => void;
14
+ l: (nodes: any) => void;
15
+ h: () => void;
16
+ m: (target: HTMLElement, anchor: any) => void;
17
+ p: (ctx: any, dirty: any) => void;
18
+ r: () => void;
19
+ f: () => void;
20
+ a: () => void;
21
+ i: (local: any) => void;
22
+ o: (local: any) => void;
23
+ d: (detaching: 0 | 1) => void;
24
+ }
25
+ interface T$$ {
26
+ dirty: number[];
27
+ ctx: null | any;
28
+ bound: any;
29
+ update: () => void;
30
+ callbacks: any;
31
+ after_update: any[];
32
+ props: Record<string, 0 | string>;
33
+ fragment: null | false | Fragment;
34
+ not_equal: any;
35
+ before_update: any[];
36
+ context: Map<any, any>;
37
+ on_mount: any[];
38
+ on_destroy: any[];
39
+ skip_bound: boolean;
40
+ on_disconnect: any[];
41
+ root: Element | ShadowRoot;
42
+ }
43
+ /**
44
+ * Base class for Svelte components. Used when dev=false.
45
+ */
46
+ declare class SvelteComponent {
47
+ $$: T$$;
48
+ $$set?: ($$props: any) => void;
49
+ $destroy(): void;
50
+ $on(type: any, callback: any): () => void;
51
+ $set($$props: any): void;
52
+ }
53
+
54
+ declare type Props = Record<string, any>;
55
+ interface ComponentConstructorOptions<Props extends Record<string, any> = Record<string, any>> {
56
+ target: Element | ShadowRoot;
57
+ anchor?: Element;
58
+ props?: Props;
59
+ context?: Map<any, any>;
60
+ hydrate?: boolean;
61
+ intro?: boolean;
62
+ $$inline?: boolean;
63
+ }
64
+ interface SvelteComponentDev$1 {
65
+ $set(props?: Props): void;
66
+ $on(event: string, callback: (event: any) => void): () => void;
67
+ $destroy(): void;
68
+ [accessor: string]: any;
69
+ }
70
+ /**
71
+ * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
72
+ */
73
+ declare class SvelteComponentDev$1 extends SvelteComponent {
74
+ /**
75
+ * @private
76
+ * For type checking capabilities only.
77
+ * Does not exist at runtime.
78
+ * ### DO NOT USE!
79
+ */
80
+ $$prop_def: Props;
81
+ /**
82
+ * @private
83
+ * For type checking capabilities only.
84
+ * Does not exist at runtime.
85
+ * ### DO NOT USE!
86
+ */
87
+ $$events_def: any;
88
+ /**
89
+ * @private
90
+ * For type checking capabilities only.
91
+ * Does not exist at runtime.
92
+ * ### DO NOT USE!
93
+ */
94
+ $$slot_def: any;
95
+ constructor(options: ComponentConstructorOptions);
96
+ $capture_state(): void;
97
+ $inject_state(): void;
98
+ }
99
+ interface SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> {
100
+ $set(props?: Partial<Props>): void;
101
+ $on<K extends Extract<keyof Events, string>>(type: K, callback: (e: Events[K]) => void): () => void;
102
+ $destroy(): void;
103
+ [accessor: string]: any;
104
+ }
105
+ /**
106
+ * Base class to create strongly typed Svelte components.
107
+ * This only exists for typing purposes and should be used in `.d.ts` files.
108
+ *
109
+ * ### Example:
110
+ *
111
+ * You have component library on npm called `component-library`, from which
112
+ * you export a component called `MyComponent`. For Svelte+TypeScript users,
113
+ * you want to provide typings. Therefore you create a `index.d.ts`:
114
+ * ```ts
115
+ * import { SvelteComponentTyped } from "svelte";
116
+ * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}
117
+ * ```
118
+ * Typing this makes it possible for IDEs like VS Code with the Svelte extension
119
+ * to provide intellisense and to use the component like this in a Svelte file
120
+ * with TypeScript:
121
+ * ```svelte
122
+ * <script lang="ts">
123
+ * import { MyComponent } from "component-library";
124
+ * </script>
125
+ * <MyComponent foo={'bar'} />
126
+ * ```
127
+ *
128
+ * #### Why not make this part of `SvelteComponent(Dev)`?
129
+ * Because
130
+ * ```ts
131
+ * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}
132
+ * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;
133
+ * ```
134
+ * will throw a type error, so we need to separate the more strictly typed class.
135
+ */
136
+ declare class SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> extends SvelteComponentDev$1 {
137
+ /**
138
+ * @private
139
+ * For type checking capabilities only.
140
+ * Does not exist at runtime.
141
+ * ### DO NOT USE!
142
+ */
143
+ $$prop_def: Props;
144
+ /**
145
+ * @private
146
+ * For type checking capabilities only.
147
+ * Does not exist at runtime.
148
+ * ### DO NOT USE!
149
+ */
150
+ $$events_def: Events;
151
+ /**
152
+ * @private
153
+ * For type checking capabilities only.
154
+ * Does not exist at runtime.
155
+ * ### DO NOT USE!
156
+ */
157
+ $$slot_def: Slots;
158
+ constructor(options: ComponentConstructorOptions<Props>);
159
+ }
160
+ /**
161
+ * Convenience type to get the props the given component expects. Example:
162
+ * ```html
163
+ * <script lang="ts">
164
+ * import type { ComponentProps } from 'svelte';
165
+ * import Component from './Component.svelte';
166
+ *
167
+ * const props: ComponentProps<Component> = { foo: 'bar' }; // Errors if these aren't the correct props
168
+ * </script>
169
+ * ```
170
+ */
171
+ declare type ComponentProps<Component extends SvelteComponent> = Component extends SvelteComponentTyped<infer Props> ? Props : never;
172
+
173
+ declare type SvelteConstructor<T> = new (...args: any[]) => T;
174
+ declare type SvelteComponentOptions<T extends SvelteComponentDev$1> = Omit<ComponentConstructorOptions<ComponentProps<T>>, 'hydrate' | 'target' | '$$inline'>;
175
+ interface MountOptions<T extends SvelteComponentDev$1> extends SvelteComponentOptions<T> {
176
+ log?: boolean;
177
+ }
178
+ interface MountReturn<T extends SvelteComponentDev$1> {
179
+ component: T;
180
+ }
181
+ /**
182
+ * Mounts a Svelte component inside the Cypress browser
183
+ *
184
+ * @param {SvelteConstructor<T>} Component Svelte component being mounted
185
+ * @param {MountReturn<T extends SvelteComponent>} options options to customize the component being mounted
186
+ * @returns Cypress.Chainable<MountReturn>
187
+ *
188
+ * @example
189
+ * import Counter from './Counter.svelte'
190
+ * import { mount } from 'cypress/svelte'
191
+ *
192
+ * it('should render', () => {
193
+ * mount(Counter, { props: { count: 42 } })
194
+ * cy.get('button').contains(42)
195
+ * })
196
+ *
197
+ * @see {@link https://on.cypress.io/mounting-svelte} for more details.
198
+ */
199
+ declare function mount<T extends SvelteComponentDev$1>(Component: SvelteConstructor<T>, options?: MountOptions<T>): Cypress.Chainable<MountReturn<T>>;
200
+
201
+ export { MountOptions, MountReturn, mount };
@@ -775,20 +775,20 @@ declare namespace Cypress {
775
775
  clear(options?: Partial<ClearOptions>): Chainable<Subject>
776
776
 
777
777
  /**
778
- * Clear a specific browser cookie.
778
+ * Clear a specific browser cookie for the current superdomain or for the domain specified.
779
779
  * Cypress automatically clears all cookies before each test to prevent state from being shared across tests. You shouldn't need to use this command unless you're using it to clear a specific cookie inside a single test.
780
780
  *
781
781
  * @see https://on.cypress.io/clearcookie
782
782
  */
783
- clearCookie(name: string, options?: Partial<Loggable & Timeoutable>): Chainable<null>
783
+ clearCookie(name: string, options?: CookieOptions): Chainable<null>
784
784
 
785
785
  /**
786
- * Clear all browser cookies.
787
- * Cypress automatically clears all cookies before each test to prevent state from being shared across tests. You shouldn't need to use this command unless you're using it to clear a specific cookie inside a single test.
786
+ * Clear all browser cookies for the current superdomain or for the domain specified.
787
+ * Cypress automatically clears all cookies before each test to prevent state from being shared across tests. You shouldn't need to use this command unless you're using it to clear all cookies or specific cookies inside a single test.
788
788
  *
789
789
  * @see https://on.cypress.io/clearcookies
790
790
  */
791
- clearCookies(options?: Partial<Loggable & Timeoutable>): Chainable<null>
791
+ clearCookies(options?: CookieOptions): Chainable<null>
792
792
 
793
793
  /**
794
794
  * Clear data in local storage.
@@ -1089,7 +1089,7 @@ declare namespace Cypress {
1089
1089
  *
1090
1090
  * @see https://on.cypress.io/session
1091
1091
  */
1092
- session(id: string | object, setup?: () => void, options?: SessionOptions): Chainable<null>
1092
+ session(id: string | object, setup: () => void, options?: SessionOptions): Chainable<null>
1093
1093
 
1094
1094
  /**
1095
1095
  * Get the window.document of the page that is currently active.
@@ -1248,18 +1248,18 @@ declare namespace Cypress {
1248
1248
  get<S = any>(alias: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<S>
1249
1249
 
1250
1250
  /**
1251
- * Get a browser cookie by its name.
1251
+ * Get a browser cookie by its name for the current superdomain or for the domain specified.
1252
1252
  *
1253
1253
  * @see https://on.cypress.io/getcookie
1254
1254
  */
1255
- getCookie(name: string, options?: Partial<Loggable & Timeoutable>): Chainable<Cookie | null>
1255
+ getCookie(name: string, options?: CookieOptions): Chainable<Cookie | null>
1256
1256
 
1257
1257
  /**
1258
- * Get all of the browser cookies.
1258
+ * Get all of the browser cookies for the current superdomain or for the domain specified.
1259
1259
  *
1260
1260
  * @see https://on.cypress.io/getcookies
1261
1261
  */
1262
- getCookies(options?: Partial<Loggable & Timeoutable>): Chainable<Cookie[]>
1262
+ getCookies(options?: CookieOptions): Chainable<Cookie[]>
1263
1263
 
1264
1264
  /**
1265
1265
  * Navigate back or forward to the previous or next URL in the browser's history.
@@ -2633,6 +2633,14 @@ declare namespace Cypress {
2633
2633
  cmdKey: boolean
2634
2634
  }
2635
2635
 
2636
+ interface CookieOptions extends Partial<Loggable & Timeoutable> {
2637
+ /**
2638
+ * Domain to set cookies on or get cookies from
2639
+ * @default superdomain of the current app under test
2640
+ */
2641
+ domain?: string
2642
+ }
2643
+
2636
2644
  interface PEMCert {
2637
2645
  /**
2638
2646
  * Path to the certificate file, relative to project root.
package/vue/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # [@cypress/vue-v5.0.1](https://github.com/cypress-io/cypress/compare/@cypress/vue-v5.0.0...@cypress/vue-v5.0.1) (2022-11-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make component derived info not throw ([#24571](https://github.com/cypress-io/cypress/issues/24571)) ([838dd4f](https://github.com/cypress-io/cypress/commit/838dd4fa2e0ec56633d0af2faf10a47d190b5594))
7
+
8
+ # [@cypress/vue-v5.0.0](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.2.2...@cypress/vue-v5.0.0) (2022-11-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * remove dependence on @cypress/<dep> types ([#24415](https://github.com/cypress-io/cypress/issues/24415)) ([58e0ab9](https://github.com/cypress-io/cypress/commit/58e0ab91604618ea6f75932622f7e66e419270e6))
14
+ * remove last mounted component upon subsequent mount calls ([#24470](https://github.com/cypress-io/cypress/issues/24470)) ([f39eb1c](https://github.com/cypress-io/cypress/commit/f39eb1c19e0923bda7ae263168fc6448da942d54))
15
+ * remove some CT functions and props ([#24419](https://github.com/cypress-io/cypress/issues/24419)) ([294985f](https://github.com/cypress-io/cypress/commit/294985f8b3e0fa00ed66d25f88c8814603766074))
16
+
17
+
18
+ ### Features
19
+
20
+ * include component and wrapper in return type for vue mount adapter ([#24479](https://github.com/cypress-io/cypress/issues/24479)) ([33875d7](https://github.com/cypress-io/cypress/commit/33875d75505416b1f65ca7c6d5dedc46f3289f1b))
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * remove last mounted component upon subsequent mount calls of mount
26
+ * Vue mount returns wrapper and component rather than wrapper only
27
+
28
+ # [@cypress/vue-v4.2.2](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.2.1...@cypress/vue-v4.2.2) (2022-11-01)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * Hovering over mount in command log does not show component in AUT ([#24346](https://github.com/cypress-io/cypress/issues/24346)) ([355d210](https://github.com/cypress-io/cypress/commit/355d2101d38ea4d1e93b9c571cf77babab2bbbfc))
34
+
1
35
  # [@cypress/vue-v4.2.1](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.2.0...@cypress/vue-v4.2.1) (2022-10-13)
2
36
 
3
37