cypress 10.3.0 → 10.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/exec/open.js +1 -2
- package/lib/exec/spawn.js +7 -2
- package/mount-utils/dist/index.js +8 -1
- package/mount-utils/package.json +1 -0
- package/package.json +13 -8
- package/react/dist/cypress-react.browser.js +16 -1
- package/react/dist/cypress-react.cjs.js +16 -1
- package/react/dist/cypress-react.esm-bundler.js +16 -1
- package/types/cypress.d.ts +1 -1
- package/vue/README.md +1 -0
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +61 -0
- package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +21 -0
- package/vue/dist/@vue/test-utils/config.d.ts +28 -0
- package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +900 -0
- package/vue/dist/@vue/test-utils/createDomEvent.d.ts +9 -0
- package/vue/dist/@vue/test-utils/domWrapper.d.ts +18 -0
- package/vue/dist/@vue/test-utils/emit.d.ts +4 -0
- package/vue/dist/@vue/test-utils/errorWrapper.d.ts +1 -0
- package/vue/dist/@vue/test-utils/index.d.ts +10 -0
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +56 -0
- package/vue/dist/@vue/test-utils/mount.d.ts +33 -0
- package/vue/dist/@vue/test-utils/stubs.d.ts +26 -0
- package/vue/dist/@vue/test-utils/types.d.ts +125 -0
- package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +5 -0
- package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/componentName.d.ts +4 -0
- package/vue/dist/@vue/test-utils/utils/find.d.ts +10 -0
- package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/isElement.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +6 -0
- package/vue/dist/@vue/test-utils/utils/matchName.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +8 -0
- package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +3 -0
- package/vue/dist/@vue/test-utils/utils.d.ts +13 -0
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +34 -0
- package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +14 -0
- package/vue/dist/cypress-vue.cjs.js +223 -138
- package/vue/dist/cypress-vue.esm-bundler.js +223 -139
- package/vue/dist/index.d.ts +34 -3
- package/vue/package.json +10 -6
- package/vue2/dist/cypress-vue2.browser.js +16 -1
- package/vue2/dist/cypress-vue2.cjs.js +16 -1
- package/vue2/dist/cypress-vue2.esm-bundler.js +16 -1
- package/vue2/package.json +1 -1
@@ -32,7 +32,161 @@ var __assign$1 = function() {
|
|
32
32
|
return t;
|
33
33
|
};
|
34
34
|
return __assign$1.apply(this, arguments);
|
35
|
+
};
|
36
|
+
|
37
|
+
function __rest(s, e) {
|
38
|
+
var t = {};
|
39
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
40
|
+
t[p] = s[p];
|
41
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
42
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
43
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
44
|
+
t[p[i]] = s[p[i]];
|
45
|
+
}
|
46
|
+
return t;
|
47
|
+
}
|
48
|
+
|
49
|
+
const ROOT_SELECTOR = '[data-cy-root]';
|
50
|
+
const getContainerEl = () => {
|
51
|
+
const el = document.querySelector(ROOT_SELECTOR);
|
52
|
+
if (el) {
|
53
|
+
return el;
|
54
|
+
}
|
55
|
+
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.`);
|
56
|
+
};
|
57
|
+
/**
|
58
|
+
* Remove any style or extra link elements from the iframe placeholder
|
59
|
+
* left from any previous test
|
60
|
+
*
|
61
|
+
*/
|
62
|
+
function cleanupStyles() {
|
63
|
+
const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
|
64
|
+
styles.forEach((styleElement) => {
|
65
|
+
if (styleElement.parentElement) {
|
66
|
+
styleElement.parentElement.removeChild(styleElement);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
|
70
|
+
links.forEach((link) => {
|
71
|
+
if (link.parentElement) {
|
72
|
+
link.parentElement.removeChild(link);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* Insert links to external style resources.
|
78
|
+
*/
|
79
|
+
function insertStylesheets(stylesheets, document, el) {
|
80
|
+
stylesheets.forEach((href) => {
|
81
|
+
const link = document.createElement('link');
|
82
|
+
link.type = 'text/css';
|
83
|
+
link.rel = 'stylesheet';
|
84
|
+
link.href = href;
|
85
|
+
link.dataset.cy = 'injected-stylesheet';
|
86
|
+
document.body.insertBefore(link, el);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* Inserts a single stylesheet element
|
91
|
+
*/
|
92
|
+
function insertStyles(styles, document, el) {
|
93
|
+
styles.forEach((style) => {
|
94
|
+
const styleElement = document.createElement('style');
|
95
|
+
styleElement.dataset.cy = 'injected-style-tag';
|
96
|
+
styleElement.appendChild(document.createTextNode(style));
|
97
|
+
document.body.insertBefore(styleElement, el);
|
98
|
+
});
|
99
|
+
}
|
100
|
+
function insertSingleCssFile(cssFilename, document, el, log) {
|
101
|
+
return cy.readFile(cssFilename, { log }).then((css) => {
|
102
|
+
const style = document.createElement('style');
|
103
|
+
style.appendChild(document.createTextNode(css));
|
104
|
+
document.body.insertBefore(style, el);
|
105
|
+
});
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* Reads the given CSS file from local file system
|
109
|
+
* and adds the loaded style text as an element.
|
110
|
+
*/
|
111
|
+
function insertLocalCssFiles(cssFilenames, document, el, log) {
|
112
|
+
return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
|
113
|
+
return insertSingleCssFile(cssFilename, document, el, log);
|
114
|
+
});
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* Injects custom style text or CSS file or 3rd party style resources
|
118
|
+
* into the given document.
|
119
|
+
*/
|
120
|
+
const injectStylesBeforeElement = (options, document, el) => {
|
121
|
+
if (!el)
|
122
|
+
return;
|
123
|
+
// first insert all stylesheets as Link elements
|
124
|
+
let stylesheets = [];
|
125
|
+
if (typeof options.stylesheet === 'string') {
|
126
|
+
stylesheets.push(options.stylesheet);
|
127
|
+
}
|
128
|
+
else if (Array.isArray(options.stylesheet)) {
|
129
|
+
stylesheets = stylesheets.concat(options.stylesheet);
|
130
|
+
}
|
131
|
+
if (typeof options.stylesheets === 'string') {
|
132
|
+
options.stylesheets = [options.stylesheets];
|
133
|
+
}
|
134
|
+
if (options.stylesheets) {
|
135
|
+
stylesheets = stylesheets.concat(options.stylesheets);
|
136
|
+
}
|
137
|
+
insertStylesheets(stylesheets, document, el);
|
138
|
+
// insert any styles as <style>...</style> elements
|
139
|
+
let styles = [];
|
140
|
+
if (typeof options.style === 'string') {
|
141
|
+
styles.push(options.style);
|
142
|
+
}
|
143
|
+
else if (Array.isArray(options.style)) {
|
144
|
+
styles = styles.concat(options.style);
|
145
|
+
}
|
146
|
+
if (typeof options.styles === 'string') {
|
147
|
+
styles.push(options.styles);
|
148
|
+
}
|
149
|
+
else if (Array.isArray(options.styles)) {
|
150
|
+
styles = styles.concat(options.styles);
|
151
|
+
}
|
152
|
+
insertStyles(styles, document, el);
|
153
|
+
// now load any css files by path and add their content
|
154
|
+
// as <style>...</style> elements
|
155
|
+
let cssFiles = [];
|
156
|
+
if (typeof options.cssFile === 'string') {
|
157
|
+
cssFiles.push(options.cssFile);
|
158
|
+
}
|
159
|
+
else if (Array.isArray(options.cssFile)) {
|
160
|
+
cssFiles = cssFiles.concat(options.cssFile);
|
161
|
+
}
|
162
|
+
if (typeof options.cssFiles === 'string') {
|
163
|
+
cssFiles.push(options.cssFiles);
|
164
|
+
}
|
165
|
+
else if (Array.isArray(options.cssFiles)) {
|
166
|
+
cssFiles = cssFiles.concat(options.cssFiles);
|
167
|
+
}
|
168
|
+
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
35
169
|
};
|
170
|
+
function setupHooks(optionalCallback) {
|
171
|
+
// Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
|
172
|
+
// file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
|
173
|
+
// testing so we early return.
|
174
|
+
// System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
|
175
|
+
if (Cypress.testingType !== 'component') {
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
// When running component specs, we cannot allow "cy.visit"
|
179
|
+
// because it will wipe out our preparation work, and does not make much sense
|
180
|
+
// thus we overwrite "cy.visit" to throw an error
|
181
|
+
Cypress.Commands.overwrite('visit', () => {
|
182
|
+
throw new Error('cy.visit from a component spec is not allowed');
|
183
|
+
});
|
184
|
+
// @ts-ignore
|
185
|
+
Cypress.on('test:before:run', () => {
|
186
|
+
optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
|
187
|
+
cleanupStyles();
|
188
|
+
});
|
189
|
+
}
|
36
190
|
|
37
191
|
/**
|
38
192
|
* Make a map and return a function for checking if a key
|
@@ -6768,7 +6922,12 @@ function stubComponents(stubs, shallow, renderStubDefaultSlot) {
|
|
6768
6922
|
throw new Error('Attempted to stub a non-component');
|
6769
6923
|
}
|
6770
6924
|
var newStub = createStubOnce(type, function () {
|
6771
|
-
return
|
6925
|
+
return config.plugins.createStubs
|
6926
|
+
? config.plugins.createStubs({
|
6927
|
+
name: stubName_1,
|
6928
|
+
component: type
|
6929
|
+
})
|
6930
|
+
: createStub({
|
6772
6931
|
name: stubName_1,
|
6773
6932
|
type: type,
|
6774
6933
|
renderStubDefaultSlot: renderStubDefaultSlot
|
@@ -12997,6 +13156,30 @@ function processSlot(source, Vue$1) {
|
|
12997
13156
|
};
|
12998
13157
|
}
|
12999
13158
|
|
13159
|
+
var isEnabled = false;
|
13160
|
+
var wrapperInstances = [];
|
13161
|
+
function disableAutoUnmount() {
|
13162
|
+
isEnabled = false;
|
13163
|
+
wrapperInstances.length = 0;
|
13164
|
+
}
|
13165
|
+
function enableAutoUnmount(hook) {
|
13166
|
+
if (isEnabled) {
|
13167
|
+
throw new Error('enableAutoUnmount cannot be called more than once');
|
13168
|
+
}
|
13169
|
+
isEnabled = true;
|
13170
|
+
hook(function () {
|
13171
|
+
wrapperInstances.forEach(function (wrapper) {
|
13172
|
+
wrapper.unmount();
|
13173
|
+
});
|
13174
|
+
wrapperInstances.length = 0;
|
13175
|
+
});
|
13176
|
+
}
|
13177
|
+
function trackInstance(wrapper) {
|
13178
|
+
if (!isEnabled)
|
13179
|
+
return;
|
13180
|
+
wrapperInstances.push(wrapper);
|
13181
|
+
}
|
13182
|
+
|
13000
13183
|
var MOUNT_OPTIONS = [
|
13001
13184
|
'attachTo',
|
13002
13185
|
'attrs',
|
@@ -13225,8 +13408,12 @@ function mount$1(inputComponent, options) {
|
|
13225
13408
|
};
|
13226
13409
|
console.warn = warnSave;
|
13227
13410
|
var wrapper = createVueWrapper(app, appRef, setProps);
|
13411
|
+
trackInstance(wrapper);
|
13228
13412
|
return wrapper;
|
13229
13413
|
}
|
13414
|
+
var shallowMount = function (component, options) {
|
13415
|
+
return mount$1(component, __assign(__assign({}, options), { shallow: true }));
|
13416
|
+
};
|
13230
13417
|
|
13231
13418
|
// match return type of router.resolve: RouteLocation & { href: string }
|
13232
13419
|
var defaultRoute = {
|
@@ -13242,7 +13429,7 @@ var defaultRoute = {
|
|
13242
13429
|
href: '/'
|
13243
13430
|
};
|
13244
13431
|
// TODO: Borrow typings from vue-router-next
|
13245
|
-
defineComponent({
|
13432
|
+
var RouterLinkStub = defineComponent({
|
13246
13433
|
name: 'RouterLinkStub',
|
13247
13434
|
props: {
|
13248
13435
|
to: {
|
@@ -13272,143 +13459,32 @@ defineComponent({
|
|
13272
13459
|
}
|
13273
13460
|
});
|
13274
13461
|
|
13275
|
-
typeof setImmediate === 'function' ? setImmediate : setTimeout;
|
13276
|
-
|
13277
|
-
|
13278
|
-
|
13279
|
-
|
13280
|
-
|
13281
|
-
return el;
|
13282
|
-
}
|
13283
|
-
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please use the mount utils to mount it properly`);
|
13284
|
-
};
|
13285
|
-
/**
|
13286
|
-
* Remove any style or extra link elements from the iframe placeholder
|
13287
|
-
* left from any previous test
|
13288
|
-
*
|
13289
|
-
*/
|
13290
|
-
function cleanupStyles() {
|
13291
|
-
const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
|
13292
|
-
styles.forEach((styleElement) => {
|
13293
|
-
if (styleElement.parentElement) {
|
13294
|
-
styleElement.parentElement.removeChild(styleElement);
|
13295
|
-
}
|
13296
|
-
});
|
13297
|
-
const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
|
13298
|
-
links.forEach((link) => {
|
13299
|
-
if (link.parentElement) {
|
13300
|
-
link.parentElement.removeChild(link);
|
13301
|
-
}
|
13302
|
-
});
|
13303
|
-
}
|
13304
|
-
/**
|
13305
|
-
* Insert links to external style resources.
|
13306
|
-
*/
|
13307
|
-
function insertStylesheets(stylesheets, document, el) {
|
13308
|
-
stylesheets.forEach((href) => {
|
13309
|
-
const link = document.createElement('link');
|
13310
|
-
link.type = 'text/css';
|
13311
|
-
link.rel = 'stylesheet';
|
13312
|
-
link.href = href;
|
13313
|
-
link.dataset.cy = 'injected-stylesheet';
|
13314
|
-
document.body.insertBefore(link, el);
|
13315
|
-
});
|
13316
|
-
}
|
13317
|
-
/**
|
13318
|
-
* Inserts a single stylesheet element
|
13319
|
-
*/
|
13320
|
-
function insertStyles(styles, document, el) {
|
13321
|
-
styles.forEach((style) => {
|
13322
|
-
const styleElement = document.createElement('style');
|
13323
|
-
styleElement.dataset.cy = 'injected-style-tag';
|
13324
|
-
styleElement.appendChild(document.createTextNode(style));
|
13325
|
-
document.body.insertBefore(styleElement, el);
|
13326
|
-
});
|
13327
|
-
}
|
13328
|
-
function insertSingleCssFile(cssFilename, document, el, log) {
|
13329
|
-
return cy.readFile(cssFilename, { log }).then((css) => {
|
13330
|
-
const style = document.createElement('style');
|
13331
|
-
style.appendChild(document.createTextNode(css));
|
13332
|
-
document.body.insertBefore(style, el);
|
13333
|
-
});
|
13334
|
-
}
|
13335
|
-
/**
|
13336
|
-
* Reads the given CSS file from local file system
|
13337
|
-
* and adds the loaded style text as an element.
|
13338
|
-
*/
|
13339
|
-
function insertLocalCssFiles(cssFilenames, document, el, log) {
|
13340
|
-
return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
|
13341
|
-
return insertSingleCssFile(cssFilename, document, el, log);
|
13342
|
-
});
|
13343
|
-
}
|
13344
|
-
/**
|
13345
|
-
* Injects custom style text or CSS file or 3rd party style resources
|
13346
|
-
* into the given document.
|
13347
|
-
*/
|
13348
|
-
const injectStylesBeforeElement = (options, document, el) => {
|
13349
|
-
if (!el)
|
13350
|
-
return;
|
13351
|
-
// first insert all stylesheets as Link elements
|
13352
|
-
let stylesheets = [];
|
13353
|
-
if (typeof options.stylesheet === 'string') {
|
13354
|
-
stylesheets.push(options.stylesheet);
|
13355
|
-
}
|
13356
|
-
else if (Array.isArray(options.stylesheet)) {
|
13357
|
-
stylesheets = stylesheets.concat(options.stylesheet);
|
13358
|
-
}
|
13359
|
-
if (typeof options.stylesheets === 'string') {
|
13360
|
-
options.stylesheets = [options.stylesheets];
|
13361
|
-
}
|
13362
|
-
if (options.stylesheets) {
|
13363
|
-
stylesheets = stylesheets.concat(options.stylesheets);
|
13364
|
-
}
|
13365
|
-
insertStylesheets(stylesheets, document, el);
|
13366
|
-
// insert any styles as <style>...</style> elements
|
13367
|
-
let styles = [];
|
13368
|
-
if (typeof options.style === 'string') {
|
13369
|
-
styles.push(options.style);
|
13370
|
-
}
|
13371
|
-
else if (Array.isArray(options.style)) {
|
13372
|
-
styles = styles.concat(options.style);
|
13373
|
-
}
|
13374
|
-
if (typeof options.styles === 'string') {
|
13375
|
-
styles.push(options.styles);
|
13376
|
-
}
|
13377
|
-
else if (Array.isArray(options.styles)) {
|
13378
|
-
styles = styles.concat(options.styles);
|
13379
|
-
}
|
13380
|
-
insertStyles(styles, document, el);
|
13381
|
-
// now load any css files by path and add their content
|
13382
|
-
// as <style>...</style> elements
|
13383
|
-
let cssFiles = [];
|
13384
|
-
if (typeof options.cssFile === 'string') {
|
13385
|
-
cssFiles.push(options.cssFile);
|
13386
|
-
}
|
13387
|
-
else if (Array.isArray(options.cssFile)) {
|
13388
|
-
cssFiles = cssFiles.concat(options.cssFile);
|
13389
|
-
}
|
13390
|
-
if (typeof options.cssFiles === 'string') {
|
13391
|
-
cssFiles.push(options.cssFiles);
|
13392
|
-
}
|
13393
|
-
else if (Array.isArray(options.cssFiles)) {
|
13394
|
-
cssFiles = cssFiles.concat(options.cssFiles);
|
13395
|
-
}
|
13396
|
-
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
13397
|
-
};
|
13398
|
-
function setupHooks(optionalCallback) {
|
13399
|
-
// When running component specs, we cannot allow "cy.visit"
|
13400
|
-
// because it will wipe out our preparation work, and does not make much sense
|
13401
|
-
// thus we overwrite "cy.visit" to throw an error
|
13402
|
-
Cypress.Commands.overwrite('visit', () => {
|
13403
|
-
throw new Error('cy.visit from a component spec is not allowed');
|
13404
|
-
});
|
13405
|
-
// @ts-ignore
|
13406
|
-
Cypress.on('test:before:run', () => {
|
13407
|
-
optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
|
13408
|
-
cleanupStyles();
|
13409
|
-
});
|
13462
|
+
var scheduler = typeof setImmediate === 'function' ? setImmediate : setTimeout;
|
13463
|
+
// Credit to: https://github.com/kentor/flush-promises
|
13464
|
+
function flushPromises() {
|
13465
|
+
return new Promise(function (resolve) {
|
13466
|
+
scheduler(resolve, 0);
|
13467
|
+
});
|
13410
13468
|
}
|
13411
13469
|
|
13470
|
+
var _VueTestUtils = /*#__PURE__*/Object.freeze({
|
13471
|
+
__proto__: null,
|
13472
|
+
DOMWrapper: DOMWrapper,
|
13473
|
+
RouterLinkStub: RouterLinkStub,
|
13474
|
+
VueWrapper: VueWrapper,
|
13475
|
+
config: config,
|
13476
|
+
createWrapperError: createWrapperError,
|
13477
|
+
disableAutoUnmount: disableAutoUnmount,
|
13478
|
+
enableAutoUnmount: enableAutoUnmount,
|
13479
|
+
flushPromises: flushPromises,
|
13480
|
+
mount: mount$1,
|
13481
|
+
shallowMount: shallowMount
|
13482
|
+
});
|
13483
|
+
|
13484
|
+
var // We do not expose the `mount` from VueTestUtils, instead, we wrap it and expose a
|
13485
|
+
// Cypress-compatible `mount` API.
|
13486
|
+
VTUmount = mount$1,
|
13487
|
+
VueTestUtils = __rest(_VueTestUtils, ["mount", "shallowMount"]);
|
13412
13488
|
var DEFAULT_COMP_NAME = 'unknown';
|
13413
13489
|
Cypress.on('run:start', function () {
|
13414
13490
|
// `mount` is designed to work with component testing only.
|
@@ -13457,7 +13533,7 @@ function mount(componentOptions, options) {
|
|
13457
13533
|
componentNode.id = '__cy_vue_root';
|
13458
13534
|
el.append(componentNode);
|
13459
13535
|
// mount the component using VTU and return the wrapper in Cypress.VueWrapper
|
13460
|
-
var wrapper =
|
13536
|
+
var wrapper = VTUmount(componentOptions, __assign$1({ attachTo: componentNode }, options));
|
13461
13537
|
Cypress.vueWrapper = wrapper;
|
13462
13538
|
Cypress.vue = wrapper.vm;
|
13463
13539
|
return cy
|
@@ -13506,6 +13582,14 @@ function mountCallback(component, options) {
|
|
13506
13582
|
return mount(component, options);
|
13507
13583
|
};
|
13508
13584
|
}
|
13585
|
+
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
13586
|
+
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
13587
|
+
// such as:
|
13588
|
+
// import 'cypress/<my-framework>/support'
|
13589
|
+
// or
|
13590
|
+
// import { registerCT } from 'cypress/<my-framework>'
|
13591
|
+
// registerCT()
|
13592
|
+
// Note: This would be a breaking change
|
13509
13593
|
setupHooks();
|
13510
13594
|
|
13511
|
-
export { mount, mountCallback };
|
13595
|
+
export { VueTestUtils, mount, mountCallback };
|
package/vue/dist/index.d.ts
CHANGED
@@ -1,7 +1,39 @@
|
|
1
1
|
/// <reference types="cypress" />
|
2
|
-
import { ComponentPublicInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, ExtractDefaultPropTypes, DefineComponent, FunctionalComponent, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentOptionsWithObjectProps, ComponentPropsOptions, ComponentOptionsWithArrayProps, ComponentOptionsWithoutProps } from 'vue';
|
3
|
-
import { MountingOptions, VueWrapper } from '
|
2
|
+
import type { ComponentPublicInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, ExtractDefaultPropTypes, DefineComponent, FunctionalComponent, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentOptionsWithObjectProps, ComponentPropsOptions, ComponentOptionsWithArrayProps, ComponentOptionsWithoutProps } from 'vue';
|
3
|
+
import type { MountingOptions, VueWrapper } from './@vue/test-utils';
|
4
4
|
import { StyleOptions } from '@cypress/mount-utils';
|
5
|
+
import * as _VueTestUtils from './@vue/test-utils';
|
6
|
+
declare const VueTestUtils: {
|
7
|
+
enableAutoUnmount: typeof _VueTestUtils.enableAutoUnmount;
|
8
|
+
disableAutoUnmount: typeof _VueTestUtils.disableAutoUnmount;
|
9
|
+
RouterLinkStub: DefineComponent<{
|
10
|
+
to: {
|
11
|
+
type: (ObjectConstructor | StringConstructor)[];
|
12
|
+
required: true;
|
13
|
+
};
|
14
|
+
custom: {
|
15
|
+
type: BooleanConstructor;
|
16
|
+
default: boolean;
|
17
|
+
};
|
18
|
+
}, unknown, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
19
|
+
to: {
|
20
|
+
type: (ObjectConstructor | StringConstructor)[];
|
21
|
+
required: true;
|
22
|
+
};
|
23
|
+
custom: {
|
24
|
+
type: BooleanConstructor;
|
25
|
+
default: boolean;
|
26
|
+
};
|
27
|
+
}>>, {
|
28
|
+
custom: boolean;
|
29
|
+
}>;
|
30
|
+
VueWrapper: typeof VueWrapper;
|
31
|
+
DOMWrapper: typeof _VueTestUtils.DOMWrapper;
|
32
|
+
config: import("./@vue/test-utils/config").GlobalConfigOptions;
|
33
|
+
flushPromises: typeof _VueTestUtils.flushPromises;
|
34
|
+
createWrapperError: typeof _VueTestUtils.createWrapperError;
|
35
|
+
};
|
36
|
+
export { VueTestUtils };
|
5
37
|
declare type GlobalMountOptions = Required<MountingOptions<any>>['global'];
|
6
38
|
declare global {
|
7
39
|
namespace Cypress {
|
@@ -53,4 +85,3 @@ export declare function mount<PropsOptions extends Readonly<ComponentPropsOption
|
|
53
85
|
* beforeEach(mountVue(component, options))
|
54
86
|
*/
|
55
87
|
export declare function mountCallback(component: any, options?: any): () => Cypress.Chainable;
|
56
|
-
export {};
|
package/vue/package.json
CHANGED
@@ -8,14 +8,12 @@
|
|
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
10
|
"build": "rimraf dist && rollup -c rollup.config.js",
|
11
|
-
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
|
12
|
-
"typecheck": "vue-tsc --noEmit",
|
11
|
+
"postbuild": "node --require @packages/ts/register ./inline-types.ts && node ../../scripts/sync-exported-npm-with-cli.js",
|
12
|
+
"typecheck": "yarn tsd && vue-tsc --noEmit",
|
13
13
|
"test": "yarn cy:run",
|
14
|
+
"tsd": "yarn build && yarn tsc -p test-tsd/tsconfig.tsd.json",
|
14
15
|
"watch": "yarn build --watch --watch.exclude ./dist/**/*"
|
15
16
|
},
|
16
|
-
"dependencies": {
|
17
|
-
"@vue/test-utils": "2.0.0-rc.19"
|
18
|
-
},
|
19
17
|
"devDependencies": {
|
20
18
|
"@cypress/code-coverage": "3.8.1",
|
21
19
|
"@cypress/mount-utils": "0.0.0-development",
|
@@ -23,9 +21,11 @@
|
|
23
21
|
"@rollup/plugin-node-resolve": "^11.1.1",
|
24
22
|
"@vitejs/plugin-vue": "2.3.1",
|
25
23
|
"@vue/compiler-sfc": "3.2.31",
|
24
|
+
"@vue/test-utils": "2.0.0-rc.19",
|
26
25
|
"axios": "0.21.2",
|
27
26
|
"cypress": "0.0.0-development",
|
28
27
|
"debug": "^4.3.2",
|
28
|
+
"globby": "^11.0.1",
|
29
29
|
"rollup": "^2.38.5",
|
30
30
|
"rollup-plugin-istanbul": "2.0.1",
|
31
31
|
"rollup-plugin-typescript2": "^0.29.0",
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"engines": {
|
51
51
|
"node": ">=8"
|
52
52
|
},
|
53
|
-
"types": "dist",
|
53
|
+
"types": "dist/index.d.ts",
|
54
54
|
"license": "MIT",
|
55
55
|
"repository": {
|
56
56
|
"type": "git",
|
@@ -71,6 +71,10 @@
|
|
71
71
|
{
|
72
72
|
"name": "Amir Rustamzadeh",
|
73
73
|
"social": "@amirrustam"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"name": "Lachlan Miller",
|
77
|
+
"social": "@Lachlan19900"
|
74
78
|
}
|
75
79
|
],
|
76
80
|
"module": "dist/cypress-vue.esm-bundler.js",
|
@@ -19857,7 +19857,7 @@ var CypressVue2 = (function (exports, require$$0$1) {
|
|
19857
19857
|
if (el) {
|
19858
19858
|
return el;
|
19859
19859
|
}
|
19860
|
-
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please
|
19860
|
+
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.`);
|
19861
19861
|
};
|
19862
19862
|
/**
|
19863
19863
|
* Remove any style or extra link elements from the iframe placeholder
|
@@ -19973,6 +19973,13 @@ var CypressVue2 = (function (exports, require$$0$1) {
|
|
19973
19973
|
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
19974
19974
|
};
|
19975
19975
|
function setupHooks(optionalCallback) {
|
19976
|
+
// Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
|
19977
|
+
// file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
|
19978
|
+
// testing so we early return.
|
19979
|
+
// System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
|
19980
|
+
if (Cypress.testingType !== 'component') {
|
19981
|
+
return;
|
19982
|
+
}
|
19976
19983
|
// When running component specs, we cannot allow "cy.visit"
|
19977
19984
|
// because it will wipe out our preparation work, and does not make much sense
|
19978
19985
|
// thus we overwrite "cy.visit" to throw an error
|
@@ -20179,6 +20186,14 @@ var CypressVue2 = (function (exports, require$$0$1) {
|
|
20179
20186
|
var mountCallback = function (component, options) {
|
20180
20187
|
return function () { return mount$1(component, options); };
|
20181
20188
|
};
|
20189
|
+
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20190
|
+
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
20191
|
+
// such as:
|
20192
|
+
// import 'cypress/<my-framework>/support'
|
20193
|
+
// or
|
20194
|
+
// import { registerCT } from 'cypress/<my-framework>'
|
20195
|
+
// registerCT()
|
20196
|
+
// Note: This would be a breaking change
|
20182
20197
|
setupHooks();
|
20183
20198
|
|
20184
20199
|
exports.mount = mount$1;
|
@@ -19860,7 +19860,7 @@ const getContainerEl = () => {
|
|
19860
19860
|
if (el) {
|
19861
19861
|
return el;
|
19862
19862
|
}
|
19863
|
-
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please
|
19863
|
+
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.`);
|
19864
19864
|
};
|
19865
19865
|
/**
|
19866
19866
|
* Remove any style or extra link elements from the iframe placeholder
|
@@ -19976,6 +19976,13 @@ const injectStylesBeforeElement = (options, document, el) => {
|
|
19976
19976
|
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
19977
19977
|
};
|
19978
19978
|
function setupHooks(optionalCallback) {
|
19979
|
+
// Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
|
19980
|
+
// file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
|
19981
|
+
// testing so we early return.
|
19982
|
+
// System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
|
19983
|
+
if (Cypress.testingType !== 'component') {
|
19984
|
+
return;
|
19985
|
+
}
|
19979
19986
|
// When running component specs, we cannot allow "cy.visit"
|
19980
19987
|
// because it will wipe out our preparation work, and does not make much sense
|
19981
19988
|
// thus we overwrite "cy.visit" to throw an error
|
@@ -20182,6 +20189,14 @@ var mount$1 = function (component, optionsOrProps) {
|
|
20182
20189
|
var mountCallback = function (component, options) {
|
20183
20190
|
return function () { return mount$1(component, options); };
|
20184
20191
|
};
|
20192
|
+
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20193
|
+
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
20194
|
+
// such as:
|
20195
|
+
// import 'cypress/<my-framework>/support'
|
20196
|
+
// or
|
20197
|
+
// import { registerCT } from 'cypress/<my-framework>'
|
20198
|
+
// registerCT()
|
20199
|
+
// Note: This would be a breaking change
|
20185
20200
|
setupHooks();
|
20186
20201
|
|
20187
20202
|
exports.mount = mount$1;
|
@@ -19852,7 +19852,7 @@ const getContainerEl = () => {
|
|
19852
19852
|
if (el) {
|
19853
19853
|
return el;
|
19854
19854
|
}
|
19855
|
-
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please
|
19855
|
+
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.`);
|
19856
19856
|
};
|
19857
19857
|
/**
|
19858
19858
|
* Remove any style or extra link elements from the iframe placeholder
|
@@ -19968,6 +19968,13 @@ const injectStylesBeforeElement = (options, document, el) => {
|
|
19968
19968
|
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
19969
19969
|
};
|
19970
19970
|
function setupHooks(optionalCallback) {
|
19971
|
+
// Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
|
19972
|
+
// file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
|
19973
|
+
// testing so we early return.
|
19974
|
+
// System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
|
19975
|
+
if (Cypress.testingType !== 'component') {
|
19976
|
+
return;
|
19977
|
+
}
|
19971
19978
|
// When running component specs, we cannot allow "cy.visit"
|
19972
19979
|
// because it will wipe out our preparation work, and does not make much sense
|
19973
19980
|
// thus we overwrite "cy.visit" to throw an error
|
@@ -20174,6 +20181,14 @@ var mount$1 = function (component, optionsOrProps) {
|
|
20174
20181
|
var mountCallback = function (component, options) {
|
20175
20182
|
return function () { return mount$1(component, options); };
|
20176
20183
|
};
|
20184
|
+
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
20185
|
+
// by creating an explicit function/import that the user can register in their 'component.js' support file,
|
20186
|
+
// such as:
|
20187
|
+
// import 'cypress/<my-framework>/support'
|
20188
|
+
// or
|
20189
|
+
// import { registerCT } from 'cypress/<my-framework>'
|
20190
|
+
// registerCT()
|
20191
|
+
// Note: This would be a breaking change
|
20177
20192
|
setupHooks();
|
20178
20193
|
|
20179
20194
|
export { mount$1 as mount, mountCallback };
|