cypress 9.5.4 → 9.7.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/lib/errors.js +7 -0
- package/lib/tasks/unzip.js +16 -7
- package/package.json +3 -3
- package/types/cypress-eventemitter.d.ts +1 -1
- package/types/cypress-global-vars.d.ts +2 -2
- package/types/cypress.d.ts +75 -25
package/lib/errors.js
CHANGED
|
@@ -58,6 +58,12 @@ const failedUnzip = {
|
|
|
58
58
|
description: 'The Cypress App could not be unzipped.',
|
|
59
59
|
solution: genericErrorSolution
|
|
60
60
|
};
|
|
61
|
+
const failedUnzipWindowsMaxPathLength = {
|
|
62
|
+
description: 'The Cypress App could not be unzipped.',
|
|
63
|
+
solution: `This is most likely because the maximum path length is being exceeded on your system.
|
|
64
|
+
|
|
65
|
+
Read here for solutions to this problem: https://on.cypress.io/win-max-path-length-error`
|
|
66
|
+
};
|
|
61
67
|
|
|
62
68
|
const missingApp = binaryDir => {
|
|
63
69
|
return {
|
|
@@ -383,6 +389,7 @@ module.exports = {
|
|
|
383
389
|
unexpected,
|
|
384
390
|
failedDownload,
|
|
385
391
|
failedUnzip,
|
|
392
|
+
failedUnzipWindowsMaxPathLength,
|
|
386
393
|
invalidCypressEnv,
|
|
387
394
|
invalidCacheDirectory,
|
|
388
395
|
CYPRESS_RUN_BINARY,
|
package/lib/tasks/unzip.js
CHANGED
|
@@ -188,7 +188,11 @@ const unzip = ({
|
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
function isMaybeWindowsMaxPathLengthError(err) {
|
|
192
|
+
return os.platform() === 'win32' && err.code === 'ENOENT' && err.syscall === 'realpath';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const start = async ({
|
|
192
196
|
zipFilePath,
|
|
193
197
|
installDir,
|
|
194
198
|
progress
|
|
@@ -203,18 +207,23 @@ const start = ({
|
|
|
203
207
|
};
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
try {
|
|
211
|
+
const installDirExists = await fs.pathExists(installDir);
|
|
212
|
+
|
|
213
|
+
if (installDirExists) {
|
|
208
214
|
debug('removing existing unzipped binary', installDir);
|
|
209
|
-
|
|
215
|
+
await fs.removeAsync(installDir);
|
|
210
216
|
}
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
|
|
218
|
+
await unzip({
|
|
213
219
|
zipFilePath,
|
|
214
220
|
installDir,
|
|
215
221
|
progress
|
|
216
222
|
});
|
|
217
|
-
}
|
|
223
|
+
} catch (err) {
|
|
224
|
+
const errorTemplate = isMaybeWindowsMaxPathLengthError(err) ? errors.failedUnzipWindowsMaxPathLength : errors.failedUnzip;
|
|
225
|
+
await throwFormErrorText(errorTemplate)(err);
|
|
226
|
+
}
|
|
218
227
|
};
|
|
219
228
|
|
|
220
229
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node index.js --exec install",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"types": "types",
|
|
67
67
|
"buildInfo": {
|
|
68
68
|
"commitBranch": "develop",
|
|
69
|
-
"commitSha": "
|
|
70
|
-
"commitDate": "2022-
|
|
69
|
+
"commitSha": "884e8e963b917eb96922517bbb314446b5495658",
|
|
70
|
+
"commitDate": "2022-05-23T15:08:23.000Z",
|
|
71
71
|
"stable": true
|
|
72
72
|
},
|
|
73
73
|
"description": "Cypress.io end to end testing tool",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Cypress, cy, Log inherits EventEmitter.
|
|
2
2
|
type EventEmitter2 = import("eventemitter2").EventEmitter2
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface CyEventEmitter extends Omit<EventEmitter2, 'waitFor'> {
|
|
5
5
|
proxyTo: (cy: Cypress.cy) => null
|
|
6
6
|
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
|
|
7
7
|
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
|
|
@@ -7,7 +7,7 @@ cy.get('button').click()
|
|
|
7
7
|
cy.get('.result').contains('Expected text')
|
|
8
8
|
```
|
|
9
9
|
*/
|
|
10
|
-
declare const cy: Cypress.cy &
|
|
10
|
+
declare const cy: Cypress.cy & CyEventEmitter
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Global variable `Cypress` holds common utilities and constants.
|
|
@@ -19,4 +19,4 @@ Cypress.version // => "1.4.0"
|
|
|
19
19
|
Cypress._ // => Lodash _
|
|
20
20
|
```
|
|
21
21
|
*/
|
|
22
|
-
declare const Cypress: Cypress.Cypress &
|
|
22
|
+
declare const Cypress: Cypress.Cypress & CyEventEmitter
|
package/types/cypress.d.ts
CHANGED
|
@@ -10,10 +10,13 @@ declare namespace Cypress {
|
|
|
10
10
|
type PrevSubject = keyof PrevSubjectMap
|
|
11
11
|
type TestingType = 'e2e' | 'component'
|
|
12
12
|
type PluginConfig = (on: PluginEvents, config: PluginConfigOptions) => void | ConfigOptions | Promise<ConfigOptions>
|
|
13
|
+
interface JQueryWithSelector<TElement = HTMLElement> extends JQuery<TElement> {
|
|
14
|
+
selector?: string | null
|
|
15
|
+
}
|
|
13
16
|
|
|
14
17
|
interface PrevSubjectMap<O = unknown> {
|
|
15
18
|
optional: O
|
|
16
|
-
element:
|
|
19
|
+
element: JQueryWithSelector
|
|
17
20
|
document: Document
|
|
18
21
|
window: Window
|
|
19
22
|
}
|
|
@@ -53,19 +56,6 @@ declare namespace Cypress {
|
|
|
53
56
|
password: string
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
interface RemoteState {
|
|
57
|
-
auth?: {
|
|
58
|
-
username: string
|
|
59
|
-
password: string
|
|
60
|
-
}
|
|
61
|
-
domainName: string
|
|
62
|
-
strategy: 'file' | 'http'
|
|
63
|
-
origin: string
|
|
64
|
-
fileServer: string
|
|
65
|
-
props: Record<string, any>
|
|
66
|
-
visiting: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
59
|
interface Backend {
|
|
70
60
|
/**
|
|
71
61
|
* Firefox only: Force Cypress to run garbage collection routines.
|
|
@@ -467,16 +457,18 @@ declare namespace Cypress {
|
|
|
467
457
|
Commands: {
|
|
468
458
|
add<T extends keyof Chainable>(name: T, fn: CommandFn<T>): void
|
|
469
459
|
add<T extends keyof Chainable>(name: T, options: CommandOptions & {prevSubject: false}, fn: CommandFn<T>): void
|
|
460
|
+
add<T extends keyof Chainable, S = any>(name: T, options: CommandOptions & {prevSubject: true}, fn: CommandFnWithSubject<T, S>): void
|
|
470
461
|
add<T extends keyof Chainable, S extends PrevSubject>(
|
|
471
|
-
name: T, options: CommandOptions & { prevSubject:
|
|
462
|
+
name: T, options: CommandOptions & { prevSubject: S | ['optional'] }, fn: CommandFnWithSubject<T, PrevSubjectMap[S]>,
|
|
472
463
|
): void
|
|
473
464
|
add<T extends keyof Chainable, S extends PrevSubject>(
|
|
474
465
|
name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>,
|
|
475
466
|
): void
|
|
476
467
|
addAll<T extends keyof Chainable>(fns: CommandFns): void
|
|
477
468
|
addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void
|
|
469
|
+
addAll<T extends keyof Chainable, S = any>(options: CommandOptions & { prevSubject: true }, fns: CommandFnsWithSubject<S>): void
|
|
478
470
|
addAll<T extends keyof Chainable, S extends PrevSubject>(
|
|
479
|
-
options: CommandOptions & { prevSubject:
|
|
471
|
+
options: CommandOptions & { prevSubject: S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>,
|
|
480
472
|
): void
|
|
481
473
|
addAll<T extends keyof Chainable, S extends PrevSubject>(
|
|
482
474
|
options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>,
|
|
@@ -490,7 +482,15 @@ declare namespace Cypress {
|
|
|
490
482
|
*/
|
|
491
483
|
Cookies: {
|
|
492
484
|
debug(enabled: boolean, options?: Partial<DebugOptions>): void
|
|
485
|
+
/**
|
|
486
|
+
* @deprecated Use `cy.session()` instead.
|
|
487
|
+
* @see https://on.cypress.io/session
|
|
488
|
+
*/
|
|
493
489
|
preserveOnce(...names: string[]): void
|
|
490
|
+
/**
|
|
491
|
+
* @deprecated Use `cy.session()` instead.
|
|
492
|
+
* @see https://on.cypress.io/session
|
|
493
|
+
*/
|
|
494
494
|
defaults(options: Partial<CookieDefaults>): CookieDefaults
|
|
495
495
|
}
|
|
496
496
|
|
|
@@ -634,7 +634,7 @@ declare namespace Cypress {
|
|
|
634
634
|
* Trigger action
|
|
635
635
|
* @private
|
|
636
636
|
*/
|
|
637
|
-
action: (action: string, ...args: any[]) => void
|
|
637
|
+
action: (action: string, ...args: any[]) => any[] | void
|
|
638
638
|
|
|
639
639
|
/**
|
|
640
640
|
* Load files
|
|
@@ -1059,7 +1059,7 @@ declare namespace Cypress {
|
|
|
1059
1059
|
/**
|
|
1060
1060
|
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
|
|
1061
1061
|
*
|
|
1062
|
-
* Only available if the `
|
|
1062
|
+
* Only available if the `experimentalSessionAndOrigin` config option is enabled.
|
|
1063
1063
|
*
|
|
1064
1064
|
* @see https://on.cypress.io/session
|
|
1065
1065
|
*/
|
|
@@ -1421,6 +1421,29 @@ declare namespace Cypress {
|
|
|
1421
1421
|
*/
|
|
1422
1422
|
off: Actions
|
|
1423
1423
|
|
|
1424
|
+
/**
|
|
1425
|
+
* Enables running Cypress commands in a secondary origin.
|
|
1426
|
+
* @see https://on.cypress.io/origin
|
|
1427
|
+
* @example
|
|
1428
|
+
* cy.origin('example.com', () => {
|
|
1429
|
+
* cy.get('h1').should('equal', 'Example Domain')
|
|
1430
|
+
* })
|
|
1431
|
+
*/
|
|
1432
|
+
origin<T extends any>(urlOrDomain: string, fn: () => void): Chainable<T>
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Enables running Cypress commands in a secondary origin.
|
|
1436
|
+
* @see https://on.cypress.io/origin
|
|
1437
|
+
* @example
|
|
1438
|
+
* cy.origin('example.com', { args: { key: 'value', foo: 'foo' } }, ({ key, foo }) => {
|
|
1439
|
+
* expect(key).to.equal('value')
|
|
1440
|
+
* expect(foo).to.equal('foo')
|
|
1441
|
+
* })
|
|
1442
|
+
*/
|
|
1443
|
+
origin<T, S extends any>(urlOrDomain: string, options: {
|
|
1444
|
+
args: T
|
|
1445
|
+
}, fn: (args: T) => void): Chainable<S>
|
|
1446
|
+
|
|
1424
1447
|
/**
|
|
1425
1448
|
* Get the parent DOM element of a set of DOM elements.
|
|
1426
1449
|
*
|
|
@@ -2514,7 +2537,7 @@ declare namespace Cypress {
|
|
|
2514
2537
|
action: 'select' | 'drag-drop'
|
|
2515
2538
|
}
|
|
2516
2539
|
|
|
2517
|
-
interface BlurOptions extends Loggable, Forceable { }
|
|
2540
|
+
interface BlurOptions extends Loggable, Timeoutable, Forceable { }
|
|
2518
2541
|
|
|
2519
2542
|
interface CheckOptions extends Loggable, Timeoutable, ActionableOptions {
|
|
2520
2543
|
interval: number
|
|
@@ -2817,15 +2840,15 @@ declare namespace Cypress {
|
|
|
2817
2840
|
*/
|
|
2818
2841
|
scrollBehavior: scrollBehaviorOptions
|
|
2819
2842
|
/**
|
|
2820
|
-
*
|
|
2843
|
+
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
|
|
2821
2844
|
* @default false
|
|
2822
2845
|
*/
|
|
2823
|
-
|
|
2846
|
+
experimentalInteractiveRunEvents: boolean
|
|
2824
2847
|
/**
|
|
2825
|
-
*
|
|
2848
|
+
* Enables cross-origin and improved session support, including the `cy.origin` and `cy.session` commands. See https://on.cypress.io/origin and https://on.cypress.io/session.
|
|
2826
2849
|
* @default false
|
|
2827
2850
|
*/
|
|
2828
|
-
|
|
2851
|
+
experimentalSessionAndOrigin: boolean
|
|
2829
2852
|
/**
|
|
2830
2853
|
* Generate and save commands directly to your test suite by interacting with your app as an end user would.
|
|
2831
2854
|
* @default false
|
|
@@ -2957,7 +2980,6 @@ declare namespace Cypress {
|
|
|
2957
2980
|
projectName: string
|
|
2958
2981
|
projectRoot: string
|
|
2959
2982
|
proxyUrl: string
|
|
2960
|
-
remote: RemoteState
|
|
2961
2983
|
report: boolean
|
|
2962
2984
|
reporterRoute: string
|
|
2963
2985
|
reporterUrl: string
|
|
@@ -5447,6 +5469,21 @@ declare namespace Cypress {
|
|
|
5447
5469
|
(action: 'task', tasks: Tasks): void
|
|
5448
5470
|
}
|
|
5449
5471
|
|
|
5472
|
+
interface CodeFrame {
|
|
5473
|
+
frame: string
|
|
5474
|
+
language: string
|
|
5475
|
+
line: number
|
|
5476
|
+
column: number
|
|
5477
|
+
absoluteFile: string
|
|
5478
|
+
originalFile: string
|
|
5479
|
+
relativeFile: string
|
|
5480
|
+
}
|
|
5481
|
+
|
|
5482
|
+
interface CypressError extends Error {
|
|
5483
|
+
docsUrl?: string
|
|
5484
|
+
codeFrame?: CodeFrame
|
|
5485
|
+
}
|
|
5486
|
+
|
|
5450
5487
|
// for just a few events like "window:alert" it makes sense to allow passing cy.stub() or
|
|
5451
5488
|
// a user callback function. Others probably only need a callback function.
|
|
5452
5489
|
|
|
@@ -5552,7 +5589,7 @@ declare namespace Cypress {
|
|
|
5552
5589
|
* This event exists because it's extremely useful for debugging purposes.
|
|
5553
5590
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5554
5591
|
*/
|
|
5555
|
-
(action: 'fail', fn: (error:
|
|
5592
|
+
(action: 'fail', fn: (error: CypressError, mocha: Mocha.Runnable) => void): Cypress
|
|
5556
5593
|
/**
|
|
5557
5594
|
* Fires whenever the viewport changes via a `cy.viewport()` or naturally when
|
|
5558
5595
|
* Cypress resets the viewport to the default between tests. Useful for debugging purposes.
|
|
@@ -5586,6 +5623,12 @@ declare namespace Cypress {
|
|
|
5586
5623
|
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5587
5624
|
*/
|
|
5588
5625
|
(action: 'command:end', fn: (command: CommandQueue) => void): Cypress
|
|
5626
|
+
/**
|
|
5627
|
+
* Fires when a command is skipped, namely the `should` command.
|
|
5628
|
+
* Useful for debugging and understanding how commands are handled.
|
|
5629
|
+
* @see https://on.cypress.io/catalog-of-events#App-Events
|
|
5630
|
+
*/
|
|
5631
|
+
(action: 'skipped:command:end', fn: (command: CommandQueue) => void): Cypress
|
|
5589
5632
|
/**
|
|
5590
5633
|
* Fires whenever a command begins its retrying routines.
|
|
5591
5634
|
* This is called on the trailing edge after Cypress has internally
|
|
@@ -5676,10 +5719,13 @@ declare namespace Cypress {
|
|
|
5676
5719
|
}
|
|
5677
5720
|
|
|
5678
5721
|
interface EnqueuedCommand {
|
|
5722
|
+
id: string
|
|
5679
5723
|
name: string
|
|
5680
5724
|
args: any[]
|
|
5681
5725
|
type: string
|
|
5682
5726
|
chainerId: string
|
|
5727
|
+
injected: boolean
|
|
5728
|
+
userInvocationStack?: string
|
|
5683
5729
|
fn(...args: any[]): any
|
|
5684
5730
|
}
|
|
5685
5731
|
|
|
@@ -5718,6 +5764,8 @@ declare namespace Cypress {
|
|
|
5718
5764
|
}
|
|
5719
5765
|
|
|
5720
5766
|
interface LogConfig extends Timeoutable {
|
|
5767
|
+
/** Unique id for the log, in the form of '<origin>-<number>' */
|
|
5768
|
+
id: string
|
|
5721
5769
|
/** The JQuery element for the command. This will highlight the command in the main window when debugging */
|
|
5722
5770
|
$el: JQuery
|
|
5723
5771
|
/** The scope of the log entry. If child, will appear nested below parents, prefixed with '-' */
|
|
@@ -5730,6 +5778,8 @@ declare namespace Cypress {
|
|
|
5730
5778
|
message: any
|
|
5731
5779
|
/** Set to false if you want to control the finishing of the command in the log yourself */
|
|
5732
5780
|
autoEnd: boolean
|
|
5781
|
+
/** Set to true to immediately finish the log */
|
|
5782
|
+
end: boolean
|
|
5733
5783
|
/** Return an object that will be printed in the dev tools console */
|
|
5734
5784
|
consoleProps(): ObjectLike
|
|
5735
5785
|
}
|