cypress 11.2.0 → 12.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,6 +63,12 @@ function setupHooks(optionalCallback) {
63
63
  Cypress.Commands.overwrite('visit', () => {
64
64
  throw new Error('cy.visit from a component spec is not allowed');
65
65
  });
66
+ Cypress.Commands.overwrite('session', () => {
67
+ throw new Error('cy.session from a component spec is not allowed');
68
+ });
69
+ Cypress.Commands.overwrite('origin', () => {
70
+ throw new Error('cy.origin from a component spec is not allowed');
71
+ });
66
72
  // @ts-ignore
67
73
  Cypress.on('test:before:run', () => {
68
74
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
package/lib/util.js CHANGED
@@ -507,6 +507,7 @@ const util = {
507
507
  getEnv(varName, trim) {
508
508
  la(is.unemptyString(varName), 'expected environment variable name, not', varName);
509
509
  const configVarName = `npm_config_${varName}`;
510
+ const configVarNameLower = configVarName.toLowerCase();
510
511
  const packageConfigVarName = `npm_package_config_${varName}`;
511
512
  let result;
512
513
 
@@ -516,6 +517,9 @@ const util = {
516
517
  } else if (process.env.hasOwnProperty(configVarName)) {
517
518
  debug(`Using ${varName} from npm config`);
518
519
  result = process.env[configVarName];
520
+ } else if (process.env.hasOwnProperty(configVarNameLower)) {
521
+ debug(`Using ${varName.toLowerCase()} from npm config`);
522
+ result = process.env[configVarNameLower];
519
523
  } else if (process.env.hasOwnProperty(packageConfigVarName)) {
520
524
  debug(`Using ${varName} from package.json config`);
521
525
  result = process.env[packageConfigVarName];
@@ -1,3 +1,15 @@
1
+ # [@cypress/mount-utils-v4.0.0](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v3.0.0...@cypress/mount-utils-v4.0.0) (2022-12-02)
2
+
3
+
4
+ ### chore
5
+
6
+ * remove experimentalSessionAndOrigin flag ([#24340](https://github.com/cypress-io/cypress/issues/24340)) ([69873ae](https://github.com/cypress-io/cypress/commit/69873ae9884228f15310fd151e42cbc0cb712817))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * removed experimentalSessionAndOrigin flag. testIsolation defaults to strict
12
+
1
13
  # [@cypress/mount-utils-v3.0.0](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v2.1.0...@cypress/mount-utils-v3.0.0) (2022-11-07)
2
14
 
3
15
 
@@ -35,6 +35,12 @@ export function setupHooks(optionalCallback) {
35
35
  Cypress.Commands.overwrite('visit', () => {
36
36
  throw new Error('cy.visit from a component spec is not allowed');
37
37
  });
38
+ Cypress.Commands.overwrite('session', () => {
39
+ throw new Error('cy.session from a component spec is not allowed');
40
+ });
41
+ Cypress.Commands.overwrite('origin', () => {
42
+ throw new Error('cy.origin from a component spec is not allowed');
43
+ });
38
44
  // @ts-ignore
39
45
  Cypress.on('test:before:run', () => {
40
46
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "11.2.0",
3
+ "version": "12.0.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
@@ -68,7 +68,7 @@
68
68
  "cypress": "bin/cypress"
69
69
  },
70
70
  "engines": {
71
- "node": ">=12.0.0"
71
+ "node": "^14.0.0 || ^16.0.0 || >=18.0.0"
72
72
  },
73
73
  "types": "types",
74
74
  "exports": {
@@ -118,8 +118,8 @@
118
118
  },
119
119
  "buildInfo": {
120
120
  "commitBranch": "develop",
121
- "commitSha": "4bbd78e22e99ae72e909a45c8ff5e8c3fd7d61ef",
122
- "commitDate": "2022-11-22T07:28:48.000Z",
121
+ "commitSha": "ca01e29ab8989af14cdddc7e3ffb30a96e73c3b8",
122
+ "commitDate": "2022-12-06T22:52:48.000Z",
123
123
  "stable": true
124
124
  },
125
125
  "description": "Cypress is a next generation front end testing tool built for the modern web",
@@ -1,3 +1,10 @@
1
+ # [@cypress/react-v7.0.2](https://github.com/cypress-io/cypress/compare/@cypress/react-v7.0.1...@cypress/react-v7.0.2) (2022-12-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove cypress.server.defaults, cy.server and cy.route ([#24411](https://github.com/cypress-io/cypress/issues/24411)) ([2f18a8c](https://github.com/cypress-io/cypress/commit/2f18a8cbd2d1a90fe1f77a29cdc89571bf54109e))
7
+
1
8
  # [@cypress/react-v7.0.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v7.0.0...@cypress/react-v7.0.1) (2022-11-08)
2
9
 
3
10
 
@@ -110,6 +110,12 @@ function setupHooks(optionalCallback) {
110
110
  Cypress.Commands.overwrite('visit', () => {
111
111
  throw new Error('cy.visit from a component spec is not allowed');
112
112
  });
113
+ Cypress.Commands.overwrite('session', () => {
114
+ throw new Error('cy.session from a component spec is not allowed');
115
+ });
116
+ Cypress.Commands.overwrite('origin', () => {
117
+ throw new Error('cy.origin from a component spec is not allowed');
118
+ });
113
119
  // @ts-ignore
114
120
  Cypress.on('test:before:run', () => {
115
121
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -83,6 +83,12 @@ function setupHooks(optionalCallback) {
83
83
  Cypress.Commands.overwrite('visit', () => {
84
84
  throw new Error('cy.visit from a component spec is not allowed');
85
85
  });
86
+ Cypress.Commands.overwrite('session', () => {
87
+ throw new Error('cy.session from a component spec is not allowed');
88
+ });
89
+ Cypress.Commands.overwrite('origin', () => {
90
+ throw new Error('cy.origin from a component spec is not allowed');
91
+ });
86
92
  // @ts-ignore
87
93
  Cypress.on('test:before:run', () => {
88
94
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -124,6 +124,12 @@ function setupHooks(optionalCallback) {
124
124
  Cypress.Commands.overwrite('visit', () => {
125
125
  throw new Error('cy.visit from a component spec is not allowed');
126
126
  });
127
+ Cypress.Commands.overwrite('session', () => {
128
+ throw new Error('cy.session from a component spec is not allowed');
129
+ });
130
+ Cypress.Commands.overwrite('origin', () => {
131
+ throw new Error('cy.origin from a component spec is not allowed');
132
+ });
127
133
  // @ts-ignore
128
134
  Cypress.on('test:before:run', () => {
129
135
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -97,6 +97,12 @@ function setupHooks(optionalCallback) {
97
97
  Cypress.Commands.overwrite('visit', () => {
98
98
  throw new Error('cy.visit from a component spec is not allowed');
99
99
  });
100
+ Cypress.Commands.overwrite('session', () => {
101
+ throw new Error('cy.session from a component spec is not allowed');
102
+ });
103
+ Cypress.Commands.overwrite('origin', () => {
104
+ throw new Error('cy.origin from a component spec is not allowed');
105
+ });
100
106
  // @ts-ignore
101
107
  Cypress.on('test:before:run', () => {
102
108
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -46,6 +46,12 @@ function setupHooks(optionalCallback) {
46
46
  Cypress.Commands.overwrite('visit', () => {
47
47
  throw new Error('cy.visit from a component spec is not allowed');
48
48
  });
49
+ Cypress.Commands.overwrite('session', () => {
50
+ throw new Error('cy.session from a component spec is not allowed');
51
+ });
52
+ Cypress.Commands.overwrite('origin', () => {
53
+ throw new Error('cy.origin from a component spec is not allowed');
54
+ });
49
55
  // @ts-ignore
50
56
  Cypress.on('test:before:run', () => {
51
57
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -42,6 +42,12 @@ function setupHooks(optionalCallback) {
42
42
  Cypress.Commands.overwrite('visit', () => {
43
43
  throw new Error('cy.visit from a component spec is not allowed');
44
44
  });
45
+ Cypress.Commands.overwrite('session', () => {
46
+ throw new Error('cy.session from a component spec is not allowed');
47
+ });
48
+ Cypress.Commands.overwrite('origin', () => {
49
+ throw new Error('cy.origin from a component spec is not allowed');
50
+ });
45
51
  // @ts-ignore
46
52
  Cypress.on('test:before:run', () => {
47
53
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -173,7 +173,7 @@ declare namespace CypressCommandLine {
173
173
  title: string[]
174
174
  state: string
175
175
  body: string
176
- /**
176
+ /**
177
177
  * Error string as it's presented in console if the test fails
178
178
  */
179
179
  displayError: string | null
@@ -50,6 +50,9 @@ declare namespace Cypress {
50
50
  interface CommandFnWithOriginalFnAndSubject<T extends keyof Chainable, S> {
51
51
  (this: Mocha.Context, originalFn: CommandOriginalFnWithSubject<T, S>, prevSubject: S, ...args: Parameters<ChainableMethods[T]>): ReturnType<ChainableMethods[T]> | void
52
52
  }
53
+ interface QueryFn<T extends keyof ChainableMethods> {
54
+ (this: Command, ...args: Parameters<ChainableMethods[T]>): (subject: any) => any
55
+ }
53
56
  interface ObjectLike {
54
57
  [key: string]: any
55
58
  }
@@ -128,6 +131,58 @@ declare namespace Cypress {
128
131
  unsupportedVersion?: boolean
129
132
  }
130
133
 
134
+ interface Ensure {
135
+ /**
136
+ * Throws an error if `subject` is not one of the passed in `type`s.
137
+ */
138
+ isType(subject: any, type: PrevSubject[], commandName: string, cy: Chainable): void
139
+
140
+ /**
141
+ * Throws an error if `subject` is not a DOM element.
142
+ */
143
+ isElement(subject: any, commandName: string, cy: Chainable): void
144
+
145
+ /**
146
+ * Throws an error if `subject` is not a `document`.
147
+ */
148
+ isDocument(subject: any, commandName: string, cy: Chainable): void
149
+
150
+ /**
151
+ * Throws an error if `subject` is not a `window`.
152
+ */
153
+ isWindow(subject: any, commandName: string, cy: Chainable): void
154
+
155
+ /**
156
+ * Throws an error if `subject` is not a DOM element attached to the application under test.
157
+ */
158
+ isAttached(subject: any, commandName: string, cy: Chainable, onFail?: Log): void
159
+
160
+ /**
161
+ * Throws an error if `subject` is a disabled DOM element.
162
+ */
163
+ isNotDisabled(subject: any, commandName: string, onFail?: Log): void
164
+
165
+ /**
166
+ * Throws an error if `subject` is a DOM element hidden by any of its parent elements.
167
+ */
168
+ isNotHiddenByAncestors(subject: any, commandName: string, onFail?: Log): void
169
+
170
+ /**
171
+ * Throws an error if `subject` is a read-only form element.
172
+ */
173
+ isNotReadonly(subject: any, commandName: string, onFail?: Log): void
174
+
175
+ /**
176
+ * Throws an error if `subject` is a read-only form element.
177
+ */
178
+ isScrollable(subject: any, commandName: string, onFail?: Log): void
179
+
180
+ /**
181
+ * Throws an error if `subject` is not a DOM element visible in the AUT.
182
+ */
183
+ isVisible(subject: any, commandName: string, onFail?: Log): void
184
+ }
185
+
131
186
  interface LocalStorage {
132
187
  /**
133
188
  * Called internally to clear `localStorage` in two situations.
@@ -142,6 +197,39 @@ declare namespace Cypress {
142
197
  clear: (keys?: string[]) => void
143
198
  }
144
199
 
200
+ // TODO: raise minimum required TypeScript version to 3.7
201
+ // and make this recursive
202
+ // https://github.com/cypress-io/cypress/issues/24875
203
+ type Storable =
204
+ | string
205
+ | number
206
+ | boolean
207
+ | null
208
+ | StorableObject
209
+ | StorableArray
210
+
211
+ interface StorableObject {
212
+ [key: string]: Storable
213
+ }
214
+
215
+ interface StorableArray extends Array<Storable> { }
216
+
217
+ type StorableRecord = Record<string, Storable>
218
+
219
+ interface OriginStorage {
220
+ origin: string
221
+ value: StorableRecord
222
+ }
223
+
224
+ interface Storages {
225
+ localStorage: OriginStorage[]
226
+ sessionStorage: OriginStorage[]
227
+ }
228
+
229
+ interface StorageByOrigin {
230
+ [key: string]: StorableRecord
231
+ }
232
+
145
233
  type IsBrowserMatcher = BrowserName | Partial<Browser> | Array<BrowserName | Partial<Browser>>
146
234
 
147
235
  interface ViewportPosition extends WindowPosition {
@@ -272,6 +360,12 @@ declare namespace Cypress {
272
360
  */
273
361
  sinon: sinon.SinonStatic
274
362
 
363
+ /**
364
+ * Utility functions for ensuring various properties about a subject.
365
+ * @see https://on.cypress.io/custom-queries
366
+ */
367
+ ensure: Ensure
368
+
275
369
  /**
276
370
  * Cypress version string. i.e. "1.1.2"
277
371
  * @see https://on.cypress.io/version
@@ -463,30 +557,92 @@ declare namespace Cypress {
463
557
  */
464
558
  log(options: Partial<LogConfig>): Log
465
559
 
466
- /**
467
- * @see https://on.cypress.io/api/commands
468
- */
469
560
  Commands: {
561
+ /**
562
+ * Add a custom command
563
+ * @see https://on.cypress.io/api/commands
564
+ */
470
565
  add<T extends keyof Chainable>(name: T, fn: CommandFn<T>): void
566
+
567
+ /**
568
+ * Add a custom parent command
569
+ * @see https://on.cypress.io/api/commands#Parent-Commands
570
+ */
471
571
  add<T extends keyof Chainable>(name: T, options: CommandOptions & {prevSubject: false}, fn: CommandFn<T>): void
572
+
573
+ /**
574
+ * Add a custom child command
575
+ * @see https://on.cypress.io/api/commands#Child-Commands
576
+ */
472
577
  add<T extends keyof Chainable, S = any>(name: T, options: CommandOptions & {prevSubject: true}, fn: CommandFnWithSubject<T, S>): void
578
+
579
+ /**
580
+ * Add a custom child or dual command
581
+ * @see https://on.cypress.io/api/commands#Validations
582
+ */
473
583
  add<T extends keyof Chainable, S extends PrevSubject>(
474
584
  name: T, options: CommandOptions & { prevSubject: S | ['optional'] }, fn: CommandFnWithSubject<T, PrevSubjectMap[S]>,
475
585
  ): void
586
+
587
+ /**
588
+ * Add a custom command that allows multiple types as the prevSubject
589
+ * @see https://on.cypress.io/api/commands#Validations#Allow-Multiple-Types
590
+ */
476
591
  add<T extends keyof Chainable, S extends PrevSubject>(
477
592
  name: T, options: CommandOptions & { prevSubject: S[] }, fn: CommandFnWithSubject<T, PrevSubjectMap<void>[S]>,
478
593
  ): void
594
+
595
+ /**
596
+ * Add one or more custom commands
597
+ * @see https://on.cypress.io/api/commands
598
+ */
479
599
  addAll<T extends keyof Chainable>(fns: CommandFns): void
600
+
601
+ /**
602
+ * Add one or more custom parent commands
603
+ * @see https://on.cypress.io/api/commands#Parent-Commands
604
+ */
480
605
  addAll<T extends keyof Chainable>(options: CommandOptions & {prevSubject: false}, fns: CommandFns): void
606
+
607
+ /**
608
+ * Add one or more custom child commands
609
+ * @see https://on.cypress.io/api/commands#Child-Commands
610
+ */
481
611
  addAll<T extends keyof Chainable, S = any>(options: CommandOptions & { prevSubject: true }, fns: CommandFnsWithSubject<S>): void
612
+
613
+ /**
614
+ * Add one or more custom commands that validate their prevSubject
615
+ * @see https://on.cypress.io/api/commands#Validations
616
+ */
482
617
  addAll<T extends keyof Chainable, S extends PrevSubject>(
483
618
  options: CommandOptions & { prevSubject: S | ['optional'] }, fns: CommandFnsWithSubject<PrevSubjectMap[S]>,
484
619
  ): void
620
+
621
+ /**
622
+ * Add one or more custom commands that allow multiple types as their prevSubject
623
+ * @see https://on.cypress.io/api/commands#Allow-Multiple-Types
624
+ */
485
625
  addAll<T extends keyof Chainable, S extends PrevSubject>(
486
626
  options: CommandOptions & { prevSubject: S[] }, fns: CommandFnsWithSubject<PrevSubjectMap<void>[S]>,
487
627
  ): void
628
+
629
+ /**
630
+ * Overwrite an existing Cypress command with a new implementation
631
+ * @see https://on.cypress.io/api/commands#Overwrite-Existing-Commands
632
+ */
488
633
  overwrite<T extends keyof Chainable>(name: T, fn: CommandFnWithOriginalFn<T>): void
634
+
635
+ /**
636
+ * Overwrite an existing Cypress command with a new implementation
637
+ * @see https://on.cypress.io/api/commands#Overwrite-Existing-Commands
638
+ */
489
639
  overwrite<T extends keyof Chainable, S extends PrevSubject>(name: T, fn: CommandFnWithOriginalFnAndSubject<T, PrevSubjectMap[S]>): void
640
+
641
+ /**
642
+ * Add a custom query
643
+ * @see https://on.cypress.io/api/custom-queries
644
+ */
645
+ addQuery<T extends keyof Chainable>(name: T, fn: QueryFn<T>): void
490
646
  }
491
647
 
492
648
  /**
@@ -494,16 +650,6 @@ declare namespace Cypress {
494
650
  */
495
651
  Cookies: {
496
652
  debug(enabled: boolean, options?: Partial<DebugOptions>): void
497
- /**
498
- * @deprecated Use `cy.session()` instead.
499
- * @see https://on.cypress.io/session
500
- */
501
- preserveOnce(...names: string[]): void
502
- /**
503
- * @deprecated Use `cy.session()` instead.
504
- * @see https://on.cypress.io/session
505
- */
506
- defaults(options: Partial<CookieDefaults>): CookieDefaults
507
653
  }
508
654
 
509
655
  /**
@@ -602,13 +748,6 @@ declare namespace Cypress {
602
748
  defaults(options: Partial<KeyboardDefaultsOptions>): void
603
749
  }
604
750
 
605
- /**
606
- * @see https://on.cypress.io/api/api-server
607
- */
608
- Server: {
609
- defaults(options: Partial<ServerOptions>): void
610
- }
611
-
612
751
  /**
613
752
  * @see https://on.cypress.io/screenshot-api
614
753
  */
@@ -655,25 +794,6 @@ declare namespace Cypress {
655
794
  onSpecWindow: (window: Window, specList: string[] | Array<() => Promise<void>>) => void
656
795
  }
657
796
 
658
- interface SessionOptions {
659
- /**
660
- * Whether or not to persist the session across all specs in the run.
661
- * @default {false}
662
- */
663
- cacheAcrossSpecs?: boolean
664
- /**
665
- * Function to run immediately after the session is created and `setup` function runs or
666
- * after a session is restored and the page is cleared. If this returns `false`, throws an
667
- * exception, returns a Promise which resolves to `false` or rejects or contains any failing
668
- * Cypress command, the session is considered invalid.
669
- *
670
- * If validation fails immediately after `setup`, the test will fail.
671
- * If validation fails after restoring a session, `setup` will re-run.
672
- * @default {false}
673
- */
674
- validate?: () => Promise<false | void> | void
675
- }
676
-
677
797
  type CanReturnChainable = void | Chainable | Promise<unknown>
678
798
  type ThenReturn<S, R> =
679
799
  R extends void ? Chainable<S> :
@@ -776,7 +896,7 @@ declare namespace Cypress {
776
896
  clear(options?: Partial<ClearOptions>): Chainable<Subject>
777
897
 
778
898
  /**
779
- * Clear a specific browser cookie for the current superdomain or for the domain specified.
899
+ * Clear a specific browser cookie for the current hostname or for the domain specified.
780
900
  * 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.
781
901
  *
782
902
  * @see https://on.cypress.io/clearcookie
@@ -784,7 +904,7 @@ declare namespace Cypress {
784
904
  clearCookie(name: string, options?: CookieOptions): Chainable<null>
785
905
 
786
906
  /**
787
- * Clear all browser cookies for the current superdomain or for the domain specified.
907
+ * Clear all browser cookies for the current hostname or for the domain specified.
788
908
  * 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.
789
909
  *
790
910
  * @see https://on.cypress.io/clearcookies
@@ -792,7 +912,35 @@ declare namespace Cypress {
792
912
  clearCookies(options?: CookieOptions): Chainable<null>
793
913
 
794
914
  /**
795
- * Clear data in local storage.
915
+ * Get local storage for all origins.
916
+ *
917
+ * @see https://on.cypress.io/getalllocalstorage
918
+ */
919
+ getAllLocalStorage(options?: Partial<Loggable>): Chainable<StorageByOrigin>
920
+
921
+ /**
922
+ * Clear local storage for all origins.
923
+ *
924
+ * @see https://on.cypress.io/clearalllocalstorage
925
+ */
926
+ clearAllLocalStorage(options?: Partial<Loggable>): Chainable<null>
927
+
928
+ /**
929
+ * Get session storage for all origins.
930
+ *
931
+ * @see https://on.cypress.io/getallsessionstorage
932
+ */
933
+ getAllSessionStorage(options?: Partial<Loggable>): Chainable<StorageByOrigin>
934
+
935
+ /**
936
+ * Clear session storage for all origins.
937
+ *
938
+ * @see https://on.cypress.io/clearallsessionstorage
939
+ */
940
+ clearAllSessionStorage(options?: Partial<Loggable>): Chainable<null>
941
+
942
+ /**
943
+ * Clear data in local storage for the current origin.
796
944
  * Cypress automatically runs this command before each test to prevent state from being
797
945
  * shared across tests. You shouldn't need to use this command unless you're using it
798
946
  * to clear localStorage inside a single test. Yields `localStorage` object.
@@ -1086,8 +1234,6 @@ declare namespace Cypress {
1086
1234
  /**
1087
1235
  * Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
1088
1236
  *
1089
- * Only available if the `experimentalSessionAndOrigin` config option is enabled.
1090
- *
1091
1237
  * @see https://on.cypress.io/session
1092
1238
  */
1093
1239
  session(id: string | object, setup: () => void, options?: SessionOptions): Chainable<null>
@@ -1249,14 +1395,14 @@ declare namespace Cypress {
1249
1395
  get<S = any>(alias: string, options?: Partial<Loggable & Timeoutable & Withinable & Shadow>): Chainable<S>
1250
1396
 
1251
1397
  /**
1252
- * Get a browser cookie by its name for the current superdomain or for the domain specified.
1398
+ * Get a browser cookie by its name for the current hostname or for the domain specified.
1253
1399
  *
1254
1400
  * @see https://on.cypress.io/getcookie
1255
1401
  */
1256
1402
  getCookie(name: string, options?: CookieOptions): Chainable<Cookie | null>
1257
1403
 
1258
1404
  /**
1259
- * Get all of the browser cookies for the current superdomain or for the domain specified.
1405
+ * Get all of the browser cookies for the current hostname or for the domain specified.
1260
1406
  *
1261
1407
  * @see https://on.cypress.io/getcookies
1262
1408
  */
@@ -1430,6 +1576,13 @@ declare namespace Cypress {
1430
1576
  */
1431
1577
  not(selector: string, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery>
1432
1578
 
1579
+ /**
1580
+ * Invoke a command synchronously, without using the command queue.
1581
+ *
1582
+ * @see https://on.cypress.io/custom-queries
1583
+ */
1584
+ now(name: string, ...args: any[]): Promise<any> | ((subject: any) => any)
1585
+
1433
1586
  /**
1434
1587
  * These events come from Cypress as it issues commands and reacts to their state. These are all useful to listen to for debugging purposes.
1435
1588
  * @see https://on.cypress.io/catalog-of-events#App-Events
@@ -1678,66 +1831,6 @@ declare namespace Cypress {
1678
1831
  */
1679
1832
  root<E extends Node = HTMLHtmlElement>(options?: Partial<Loggable>): Chainable<JQuery<E>> // can't do better typing unless we ignore the `.within()` case
1680
1833
 
1681
- /**
1682
- * @deprecated Use `cy.intercept()` instead.
1683
- *
1684
- * Use `cy.route()` to manage the behavior of network requests.
1685
- * @see https://on.cypress.io/route
1686
- * @example
1687
- * cy.server()
1688
- * cy.route('https://localhost:7777/users', [{id: 1, name: 'Pat'}])
1689
- */
1690
- route(url: string | RegExp, response?: string | object): Chainable<null>
1691
- /**
1692
- * @deprecated Use `cy.intercept()` instead.
1693
- *
1694
- * Spy or stub request with specific method and url.
1695
- *
1696
- * @see https://on.cypress.io/route
1697
- * @example
1698
- * cy.server()
1699
- * // spy on POST /todos requests
1700
- * cy.route('POST', '/todos').as('add-todo')
1701
- */
1702
- route(method: string, url: string | RegExp, response?: string | object): Chainable<null>
1703
- /**
1704
- * @deprecated Use `cy.intercept()` instead.
1705
- *
1706
- * Set a route by returning an object literal from a callback function.
1707
- * Functions that return a Promise will automatically be awaited.
1708
- *
1709
- * @see https://on.cypress.io/route
1710
- * @example
1711
- * cy.server()
1712
- * cy.route(() => {
1713
- * // your logic here
1714
- * // return an appropriate routing object here
1715
- * return {
1716
- * method: 'POST',
1717
- * url: '/comments',
1718
- * response: this.commentsFixture
1719
- * }
1720
- * })
1721
- */
1722
- route(fn: () => RouteOptions): Chainable<null>
1723
- /**
1724
- * @deprecated Use `cy.intercept()` instead.
1725
- *
1726
- * Spy or stub a given route.
1727
- *
1728
- * @see https://on.cypress.io/route
1729
- * @example
1730
- * cy.server()
1731
- * cy.route({
1732
- * method: 'DELETE',
1733
- * url: '/users',
1734
- * status: 412,
1735
- * delay: 1000
1736
- * // and other options, see documentation
1737
- * })
1738
- */
1739
- route(options: Partial<RouteOptions>): Chainable<null>
1740
-
1741
1834
  /**
1742
1835
  * Take a screenshot of the application under test and the Cypress Command Log.
1743
1836
  *
@@ -1783,26 +1876,6 @@ declare namespace Cypress {
1783
1876
  */
1784
1877
  select(valueOrTextOrIndex: string | number | Array<string | number>, options?: Partial<SelectOptions>): Chainable<Subject>
1785
1878
 
1786
- /**
1787
- * @deprecated Use `cy.intercept()` instead.
1788
- *
1789
- * Start a server to begin routing responses to `cy.route()` and `cy.request()`.
1790
- *
1791
- * @example
1792
- * // start server
1793
- * cy.server()
1794
- * // get default server options
1795
- * cy.server().should((server) => {
1796
- * expect(server.delay).to.eq(0)
1797
- * expect(server.method).to.eq('GET')
1798
- * expect(server.status).to.eq(200)
1799
- * // and many others options
1800
- * })
1801
- *
1802
- * @see https://on.cypress.io/server
1803
- */
1804
- server(options?: Partial<ServerOptions>): Chainable<ServerOptions>
1805
-
1806
1879
  /**
1807
1880
  * Set a browser cookie.
1808
1881
  *
@@ -2404,10 +2477,6 @@ declare namespace Cypress {
2404
2477
 
2405
2478
  type Agent<T extends sinon.SinonSpy> = SinonSpyAgent<T> & T
2406
2479
 
2407
- interface CookieDefaults {
2408
- preserve: string | string[] | RegExp | ((cookie: Cookie) => boolean)
2409
- }
2410
-
2411
2480
  interface Failable {
2412
2481
  /**
2413
2482
  * Whether to fail on response codes other than 2xx and 3xx
@@ -2637,7 +2706,7 @@ declare namespace Cypress {
2637
2706
  interface CookieOptions extends Partial<Loggable & Timeoutable> {
2638
2707
  /**
2639
2708
  * Domain to set cookies on or get cookies from
2640
- * @default superdomain of the current app under test
2709
+ * @default hostname of the current app under test
2641
2710
  */
2642
2711
  domain?: string
2643
2712
  }
@@ -2695,7 +2764,7 @@ declare namespace Cypress {
2695
2764
  */
2696
2765
  env: { [key: string]: any }
2697
2766
  /**
2698
- * A String or Array of glob patterns used to ignore test files that would otherwise be shown in your list of tests. Cypress uses minimatch with the options: {dot: true, matchBase: true}. We suggest using http://globtester.com to test what files would match.
2767
+ * A String or Array of glob patterns used to ignore test files that would otherwise be shown in your list of tests. Cypress uses minimatch with the options: {dot: true, matchBase: true}. We suggest using a tool to test what files would match.
2699
2768
  * @default "*.hot-update.js"
2700
2769
  */
2701
2770
  excludeSpecPattern: string | string[]
@@ -2817,8 +2886,7 @@ declare namespace Cypress {
2817
2886
  */
2818
2887
  supportFile: string | false
2819
2888
  /**
2820
- * The test isolation ensures a clean browser context between tests. This option is only available when
2821
- * `experimentalSessionAndOrigin=true`.
2889
+ * The test isolation ensures a clean browser context between tests.
2822
2890
  *
2823
2891
  * Cypress will always reset/clear aliases, intercepts, clock, and viewport before each test
2824
2892
  * to ensure a clean test slate; i.e. this configuration only impacts the browser context.
@@ -2826,23 +2894,23 @@ declare namespace Cypress {
2826
2894
  * Note: the [`cy.session()`](https://on.cypress.io/session) command will inherent this value to determine whether
2827
2895
  * or not the page is cleared when the command executes. This command is only available in end-to-end testing.
2828
2896
  *
2829
- * - on - The page is cleared before each test. Cookies, local storage and session storage in all domains are cleared
2897
+ * - true - The page is cleared before each test. Cookies, local storage and session storage in all domains are cleared
2830
2898
  * before each test. The `cy.session()` command will also clear the page and current browser context when creating
2831
2899
  * or restoring the browser session.
2832
- * - off - The current browser state will persist between tests. The page does not clear before the test and cookies, local
2900
+ * - false - The current browser state will persist between tests. The page does not clear before the test and cookies, local
2833
2901
  * storage and session storage will be available in the next test. The `cy.session()` command will only clear the
2834
2902
  * current browser context when creating or restoring the browser session - the current page will not clear.
2835
2903
  *
2836
2904
  * Tradeoffs:
2837
2905
  * Turning test isolation off may improve performance of end-to-end tests, however, previous tests could impact the
2838
2906
  * browser state of the next test and cause inconsistency when using .only(). Be mindful to write isolated tests when
2839
- * test isolation is off. If a test in the suite impacts the state of other tests and it were to fail, you could see
2907
+ * test isolation is false. If a test in the suite impacts the state of other tests and it were to fail, you could see
2840
2908
  * misleading errors in later tests which makes debugging clunky. See the [documentation](https://on.cypress.io/test-isolation)
2841
2909
  * for more information.
2842
2910
  *
2843
- * @default null, when experimentalSessionAndOrigin=false. The default is 'on' when experimentalSessionAndOrigin=true.
2911
+ * @default true
2844
2912
  */
2845
- testIsolation: null | 'on' | 'off'
2913
+ testIsolation: boolean
2846
2914
  /**
2847
2915
  * Path to folder where videos will be saved after a headless or CI run
2848
2916
  * @default "cypress/videos"
@@ -2903,11 +2971,6 @@ declare namespace Cypress {
2903
2971
  * @default false
2904
2972
  */
2905
2973
  experimentalInteractiveRunEvents: boolean
2906
- /**
2907
- * 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.
2908
- * @default false
2909
- */
2910
- experimentalSessionAndOrigin: boolean
2911
2974
  /**
2912
2975
  * Whether Cypress will search for and replace obstructive code in third party .js or .html files.
2913
2976
  * NOTE: Setting this flag to true removes Subresource Integrity (SRI).
@@ -3004,6 +3067,11 @@ declare namespace Cypress {
3004
3067
  * @default false
3005
3068
  */
3006
3069
  experimentalRunAllSpecs?: boolean
3070
+ /**
3071
+ * Enables support for require/import within cy.origin.
3072
+ * @default false
3073
+ */
3074
+ experimentalOriginDependencies?: boolean
3007
3075
  }
3008
3076
 
3009
3077
  /**
@@ -3079,19 +3147,17 @@ declare namespace Cypress {
3079
3147
  socketIoRoute: string
3080
3148
  spec: Cypress['spec'] | null
3081
3149
  specs: Array<Cypress['spec']>
3082
- xhrRoute: string
3083
- xhrUrl: string
3084
3150
  }
3085
3151
 
3086
3152
  interface SuiteConfigOverrides extends Partial<
3087
- Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>
3153
+ Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>
3088
3154
  >, Partial<Pick<ResolvedConfigOptions, 'baseUrl' | 'testIsolation'>> {
3089
3155
  browser?: IsBrowserMatcher | IsBrowserMatcher[]
3090
3156
  keystrokeDelay?: number
3091
3157
  }
3092
3158
 
3093
3159
  interface TestConfigOverrides extends Partial<
3094
- Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>
3160
+ Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>
3095
3161
  >, Partial<Pick<ResolvedConfigOptions, 'baseUrl'>> {
3096
3162
  browser?: IsBrowserMatcher | IsBrowserMatcher[]
3097
3163
  keystrokeDelay?: number
@@ -3148,7 +3214,7 @@ declare namespace Cypress {
3148
3214
  }
3149
3215
  }
3150
3216
 
3151
- interface ComponentConfigOptions<ComponentDevServerOpts = any> extends Omit<CoreConfigOptions, 'baseUrl' | 'experimentalSessionAndOrigin' | 'experimentalStudio'> {
3217
+ interface ComponentConfigOptions<ComponentDevServerOpts = any> extends Omit<CoreConfigOptions, 'baseUrl' | 'experimentalStudio'> {
3152
3218
  devServer: DevServerFn<ComponentDevServerOpts> | DevServerConfigOptions
3153
3219
  devServerConfig?: ComponentDevServerOpts
3154
3220
  /**
@@ -3337,31 +3403,60 @@ declare namespace Cypress {
3337
3403
  interval: number
3338
3404
  }
3339
3405
 
3340
- /**
3341
- * Setting default options for cy.server()
3342
- * @see https://on.cypress.io/server
3343
- */
3344
- interface ServerOptions {
3345
- delay: number
3346
- method: HttpMethod
3347
- status: number
3348
- headers: object
3349
- response: any
3350
- onRequest(...args: any[]): void
3351
- onResponse(...args: any[]): void
3352
- onAbort(...args: any[]): void
3353
- enable: boolean
3354
- force404: boolean
3355
- urlMatchingOptions: object
3356
- ignore(xhr: Request): void
3357
- onAnyRequest(route: RouteOptions, proxy: any): void
3358
- onAnyResponse(route: RouteOptions, proxy: any): void
3359
- onAnyAbort(route: RouteOptions, proxy: any): void
3360
- }
3361
-
3362
3406
  interface Session {
3363
- // Clear all saved sessions and re-run the current spec file.
3407
+ /**
3408
+ * Clear all sessions saved on the backend, including cached global sessions.
3409
+ */
3364
3410
  clearAllSavedSessions: () => Promise<void>
3411
+ /**
3412
+ * Clear all storage and cookie data across all origins associated with the current session.
3413
+ */
3414
+ clearCurrentSessionData: () => Promise<void>
3415
+ /**
3416
+ * Get all storage and cookie data across all origins associated with the current session.
3417
+ */
3418
+ getCurrentSessionData: () => Promise<SessionData>
3419
+ /**
3420
+ * Get all storage and cookie data saved on the backend associated with the provided session id.
3421
+ */
3422
+ getSession: (id: string) => Promise<ServerSessionData>
3423
+ }
3424
+
3425
+ type ActiveSessions = Record<string, SessionData>
3426
+
3427
+ interface SessionData {
3428
+ id: string
3429
+ hydrated: boolean
3430
+ cacheAcrossSpecs: SessionOptions['cacheAcrossSpecs']
3431
+ cookies?: Cookie[] | null
3432
+ localStorage?: OriginStorage[] | null
3433
+ sessionStorage?: OriginStorage[] | null
3434
+ setup: () => void
3435
+ validate?: SessionOptions['validate']
3436
+ }
3437
+
3438
+ interface ServerSessionData extends Omit<SessionData, 'setup' |'validate'> {
3439
+ setup: string
3440
+ validate?: string
3441
+ }
3442
+
3443
+ interface SessionOptions {
3444
+ /**
3445
+ * Whether or not to persist the session across all specs in the run.
3446
+ * @default {false}
3447
+ */
3448
+ cacheAcrossSpecs?: boolean
3449
+ /**
3450
+ * Function to run immediately after the session is created and `setup` function runs or
3451
+ * after a session is restored and the page is cleared. If this returns `false`, throws an
3452
+ * exception, returns a Promise which resolves to `false` or rejects or contains any failing
3453
+ * Cypress command, the session is considered invalid.
3454
+ *
3455
+ * If validation fails immediately after `setup`, the test will fail.
3456
+ * If validation fails after restoring a session, `setup` will re-run.
3457
+ * @default {false}
3458
+ */
3459
+ validate?: () => Promise<false | void> | void
3365
3460
  }
3366
3461
 
3367
3462
  type SameSiteStatus = 'no_restriction' | 'strict' | 'lax'
@@ -5778,7 +5873,7 @@ declare namespace Cypress {
5778
5873
  * Useful for debugging purposes if you're confused about the order in which commands will execute.
5779
5874
  * @see https://on.cypress.io/catalog-of-events#App-Events
5780
5875
  */
5781
- (action: 'command:enqueued', fn: (command: EnqueuedCommand) => void): Cypress
5876
+ (action: 'command:enqueued', fn: (command: EnqueuedCommandAttributes) => void): Cypress
5782
5877
  /**
5783
5878
  * Fires when cy begins actually running and executing your command.
5784
5879
  * Useful for debugging and understanding how the command queue is async.
@@ -5906,7 +6001,7 @@ declare namespace Cypress {
5906
6001
  sameSite?: SameSiteStatus
5907
6002
  }
5908
6003
 
5909
- interface EnqueuedCommand {
6004
+ interface EnqueuedCommandAttributes {
5910
6005
  id: string
5911
6006
  name: string
5912
6007
  args: any[]
@@ -5914,9 +6009,17 @@ declare namespace Cypress {
5914
6009
  chainerId: string
5915
6010
  injected: boolean
5916
6011
  userInvocationStack?: string
6012
+ query?: boolean
5917
6013
  fn(...args: any[]): any
5918
6014
  }
5919
6015
 
6016
+ interface Command {
6017
+ get<K extends keyof EnqueuedCommandAttributes>(attr: K): EnqueuedCommandAttributes[K]
6018
+ get(): EnqueuedCommandAttributes
6019
+ set<K extends keyof EnqueuedCommandAttributes>(key: K, value: EnqueuedCommandAttributes[K]): Log
6020
+ set(options: Partial<EnqueuedCommandAttributes>): Log
6021
+ }
6022
+
5920
6023
  interface Exec {
5921
6024
  code: number
5922
6025
  stdout: string
@@ -5995,28 +6098,6 @@ declare namespace Cypress {
5995
6098
  viewportHeight: number
5996
6099
  }
5997
6100
 
5998
- interface WaitXHR {
5999
- duration: number
6000
- id: string
6001
- method: HttpMethod
6002
- request: {
6003
- body: string | ObjectLike
6004
- headers: ObjectLike
6005
- }
6006
- requestBody: WaitXHR['request']['body']
6007
- requestHeaders: WaitXHR['request']['headers']
6008
- response: {
6009
- body: string | ObjectLike
6010
- headers: ObjectLike
6011
- }
6012
- responseBody: WaitXHR['response']['body']
6013
- responseHeaders: WaitXHR['response']['headers']
6014
- status: number
6015
- statusMessage: string
6016
- url: string
6017
- xhr: XMLHttpRequest
6018
- }
6019
-
6020
6101
  type Encodings = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le' | null
6021
6102
  type PositionType = 'topLeft' | 'top' | 'topRight' | 'left' | 'center' | 'right' | 'bottomLeft' | 'bottom' | 'bottomRight'
6022
6103
  type ViewportPreset = 'macbook-16' | 'macbook-15' | 'macbook-13' | 'macbook-11' | 'ipad-2' | 'ipad-mini' | 'iphone-xr' | 'iphone-x' | 'iphone-6+' | 'iphone-se2' | 'iphone-8' | 'iphone-7' | 'iphone-6' | 'iphone-5' | 'iphone-4' | 'iphone-3' | 'samsung-s10' | 'samsung-note9'
package/vue/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@cypress/vue-v5.0.3](https://github.com/cypress-io/cypress/compare/@cypress/vue-v5.0.2...@cypress/vue-v5.0.3) (2022-12-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove cypress.server.defaults, cy.server and cy.route ([#24411](https://github.com/cypress-io/cypress/issues/24411)) ([2f18a8c](https://github.com/cypress-io/cypress/commit/2f18a8cbd2d1a90fe1f77a29cdc89571bf54109e))
7
+
8
+ # [@cypress/vue-v5.0.2](https://github.com/cypress-io/cypress/compare/@cypress/vue-v5.0.1...@cypress/vue-v5.0.2) (2022-11-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * fix windows-lint CI job ([#24758](https://github.com/cypress-io/cypress/issues/24758)) ([2166ba0](https://github.com/cypress-io/cypress/commit/2166ba0d9496037df843d55f07517f83817171a3))
14
+
1
15
  # [@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
16
 
3
17
 
@@ -95,6 +95,12 @@ function setupHooks(optionalCallback) {
95
95
  Cypress.Commands.overwrite('visit', () => {
96
96
  throw new Error('cy.visit from a component spec is not allowed');
97
97
  });
98
+ Cypress.Commands.overwrite('session', () => {
99
+ throw new Error('cy.session from a component spec is not allowed');
100
+ });
101
+ Cypress.Commands.overwrite('origin', () => {
102
+ throw new Error('cy.origin from a component spec is not allowed');
103
+ });
98
104
  // @ts-ignore
99
105
  Cypress.on('test:before:run', () => {
100
106
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -72,6 +72,12 @@ function setupHooks(optionalCallback) {
72
72
  Cypress.Commands.overwrite('visit', () => {
73
73
  throw new Error('cy.visit from a component spec is not allowed');
74
74
  });
75
+ Cypress.Commands.overwrite('session', () => {
76
+ throw new Error('cy.session from a component spec is not allowed');
77
+ });
78
+ Cypress.Commands.overwrite('origin', () => {
79
+ throw new Error('cy.origin from a component spec is not allowed');
80
+ });
75
81
  // @ts-ignore
76
82
  Cypress.on('test:before:run', () => {
77
83
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -19825,6 +19825,12 @@ function setupHooks(optionalCallback) {
19825
19825
  Cypress.Commands.overwrite('visit', () => {
19826
19826
  throw new Error('cy.visit from a component spec is not allowed');
19827
19827
  });
19828
+ Cypress.Commands.overwrite('session', () => {
19829
+ throw new Error('cy.session from a component spec is not allowed');
19830
+ });
19831
+ Cypress.Commands.overwrite('origin', () => {
19832
+ throw new Error('cy.origin from a component spec is not allowed');
19833
+ });
19828
19834
  // @ts-ignore
19829
19835
  Cypress.on('test:before:run', () => {
19830
19836
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
@@ -19817,6 +19817,12 @@ function setupHooks(optionalCallback) {
19817
19817
  Cypress.Commands.overwrite('visit', () => {
19818
19818
  throw new Error('cy.visit from a component spec is not allowed');
19819
19819
  });
19820
+ Cypress.Commands.overwrite('session', () => {
19821
+ throw new Error('cy.session from a component spec is not allowed');
19822
+ });
19823
+ Cypress.Commands.overwrite('origin', () => {
19824
+ throw new Error('cy.origin from a component spec is not allowed');
19825
+ });
19820
19826
  // @ts-ignore
19821
19827
  Cypress.on('test:before:run', () => {
19822
19828
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();