cypress 8.3.0 → 8.5.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/bin/cypress CHANGED
File without changes
@@ -24,6 +24,8 @@ const {
24
24
  stripIndent
25
25
  } = require('common-tags');
26
26
 
27
+ const getProxyForUrl = require('proxy-from-env').getProxyForUrl;
28
+
27
29
  const {
28
30
  throwFormErrorText,
29
31
  errors
@@ -35,8 +37,8 @@ const util = require('../util');
35
37
 
36
38
  const defaultBaseUrl = 'https://download.cypress.io/';
37
39
 
38
- const getProxyUrl = () => {
39
- return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.npm_config_https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || process.env.npm_config_proxy || null;
40
+ const getProxyForUrlWithNpmConfig = url => {
41
+ return getProxyForUrl(url) || process.env.npm_config_https_proxy || process.env.npm_config_proxy || null;
40
42
  };
41
43
 
42
44
  const getRealOsArch = () => {
@@ -198,7 +200,7 @@ const downloadFromUrl = ({
198
200
  ca
199
201
  }) => {
200
202
  return new Promise((resolve, reject) => {
201
- const proxy = getProxyUrl();
203
+ const proxy = getProxyForUrlWithNpmConfig(url);
202
204
  debug('Downloading package', {
203
205
  url,
204
206
  proxy,
@@ -338,6 +340,6 @@ const start = opts => {
338
340
  module.exports = {
339
341
  start,
340
342
  getUrl,
341
- getProxyUrl,
343
+ getProxyForUrlWithNpmConfig,
342
344
  getCA
343
345
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "8.3.0",
3
+ "version": "8.5.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
7
7
  "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
8
8
  },
9
9
  "dependencies": {
10
- "@cypress/request": "^2.88.5",
10
+ "@cypress/request": "^2.88.6",
11
11
  "@cypress/xvfb": "^1.2.4",
12
12
  "@types/node": "^14.14.31",
13
13
  "@types/sinonjs__fake-timers": "^6.0.2",
@@ -41,6 +41,7 @@
41
41
  "minimist": "^1.2.5",
42
42
  "ospath": "^1.2.2",
43
43
  "pretty-bytes": "^5.6.0",
44
+ "proxy-from-env": "1.0.0",
44
45
  "ramda": "~0.27.1",
45
46
  "request-progress": "^3.0.0",
46
47
  "supports-color": "^8.1.1",
@@ -1949,6 +1949,8 @@ declare module "chai" {
1949
1949
  export = chai;
1950
1950
  }
1951
1951
 
1952
- interface Object {
1953
- should: Chai.Assertion;
1954
- }
1952
+ // const a = 1; a.should(1); doesn't work with Cypress
1953
+ // https://github.com/cypress-io/cypress/issues/16548
1954
+ // interface Object {
1955
+ // should: Chai.Assertion;
1956
+ // }
@@ -22,6 +22,19 @@ declare namespace Cypress {
22
22
  password: string
23
23
  }
24
24
 
25
+ interface RemoteState {
26
+ auth?: {
27
+ username: string
28
+ password: string
29
+ }
30
+ domainName: string
31
+ strategy: 'file' | 'http'
32
+ origin: string
33
+ fileServer: string
34
+ props: Record<string, any>
35
+ visiting: string
36
+ }
37
+
25
38
  interface Backend {
26
39
  /**
27
40
  * Firefox only: Force Cypress to run garbage collection routines.
@@ -155,7 +168,7 @@ declare namespace Cypress {
155
168
  /**
156
169
  * The interface for user-defined properties in Window object under test.
157
170
  */
158
- interface ApplicationWindow {} // tslint:disable-line
171
+ interface ApplicationWindow { } // tslint:disable-line
159
172
 
160
173
  /**
161
174
  * Several libraries are bundled with Cypress by default.
@@ -508,7 +521,7 @@ declare namespace Cypress {
508
521
  /**
509
522
  * @see https://on.cypress.io/keyboard-api
510
523
  */
511
- Keyboard: {
524
+ Keyboard: {
512
525
  defaults(options: Partial<KeyboardDefaultsOptions>): void
513
526
  }
514
527
 
@@ -566,7 +579,7 @@ declare namespace Cypress {
566
579
  }
567
580
 
568
581
  interface SessionOptions {
569
- validate?: () => false|void
582
+ validate?: () => false | void
570
583
  }
571
584
 
572
585
  type CanReturnChainable = void | Chainable | Promise<unknown>
@@ -704,36 +717,36 @@ declare namespace Cypress {
704
717
  ```
705
718
  */
706
719
  clearLocalStorage(re: RegExp): Chainable<Storage>
707
- /**
708
- * Clear data in local storage.
709
- * Cypress automatically runs this command before each test to prevent state from being
710
- * shared across tests. You shouldn’t need to use this command unless you’re using it
711
- * to clear localStorage inside a single test. Yields `localStorage` object.
712
- *
713
- * @see https://on.cypress.io/clearlocalstorage
714
- * @param {options} [object] - options object
715
- * @example
716
- ```
717
- // Removes all local storage items, without logging
718
- cy.clearLocalStorage({ log: false })
719
- ```
720
- */
720
+ /**
721
+ * Clear data in local storage.
722
+ * Cypress automatically runs this command before each test to prevent state from being
723
+ * shared across tests. You shouldn’t need to use this command unless you’re using it
724
+ * to clear localStorage inside a single test. Yields `localStorage` object.
725
+ *
726
+ * @see https://on.cypress.io/clearlocalstorage
727
+ * @param {options} [object] - options object
728
+ * @example
729
+ ```
730
+ // Removes all local storage items, without logging
731
+ cy.clearLocalStorage({ log: false })
732
+ ```
733
+ */
721
734
  clearLocalStorage(options: Partial<Loggable>): Chainable<Storage>
722
- /**
723
- * Clear data in local storage.
724
- * Cypress automatically runs this command before each test to prevent state from being
725
- * shared across tests. You shouldn’t need to use this command unless you’re using it
726
- * to clear localStorage inside a single test. Yields `localStorage` object.
727
- *
728
- * @see https://on.cypress.io/clearlocalstorage
729
- * @param {string} [key] - name of a particular item to remove (optional).
730
- * @param {options} [object] - options object
731
- * @example
732
- ```
733
- // Removes item "todos" without logging
734
- cy.clearLocalStorage("todos", { log: false })
735
- ```
736
- */
735
+ /**
736
+ * Clear data in local storage.
737
+ * Cypress automatically runs this command before each test to prevent state from being
738
+ * shared across tests. You shouldn’t need to use this command unless you’re using it
739
+ * to clear localStorage inside a single test. Yields `localStorage` object.
740
+ *
741
+ * @see https://on.cypress.io/clearlocalstorage
742
+ * @param {string} [key] - name of a particular item to remove (optional).
743
+ * @param {options} [object] - options object
744
+ * @example
745
+ ```
746
+ // Removes item "todos" without logging
747
+ cy.clearLocalStorage("todos", { log: false })
748
+ ```
749
+ */
737
750
  clearLocalStorage(key: string, options: Partial<Loggable>): Chainable<Storage>
738
751
 
739
752
  /**
@@ -821,7 +834,7 @@ declare namespace Cypress {
821
834
  * // or use this shortcut
822
835
  * cy.clock().invoke('restore')
823
836
  */
824
- clock(now: number|Date, options?: Loggable): Chainable<Clock>
837
+ clock(now: number | Date, options?: Loggable): Chainable<Clock>
825
838
  /**
826
839
  * Mocks global clock but only overrides specific functions.
827
840
  *
@@ -830,7 +843,7 @@ declare namespace Cypress {
830
843
  * // keep current date but override "setTimeout" and "clearTimeout"
831
844
  * cy.clock(null, ['setTimeout', 'clearTimeout'])
832
845
  */
833
- clock(now: number|Date, functions?: Array<'setTimeout' | 'clearTimeout' | 'setInterval' | 'clearInterval' | 'Date'>, options?: Loggable): Chainable<Clock>
846
+ clock(now: number | Date, functions?: Array<'setTimeout' | 'clearTimeout' | 'setInterval' | 'clearInterval' | 'Date'>, options?: Loggable): Chainable<Clock>
834
847
  /**
835
848
  * Mocks global clock and all functions.
836
849
  *
@@ -964,14 +977,14 @@ declare namespace Cypress {
964
977
  */
965
978
  debug(options?: Partial<Loggable>): Chainable<Subject>
966
979
 
967
- /**
968
- * Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
969
- *
970
- * Only available if the `experimentalSessionSupport` config option is enabled.
971
- *
972
- * @see https://on.cypress.io/session
973
- */
974
- session(id: string|object, setup?: SessionOptions['validate'], options?: SessionOptions): Chainable<null>
980
+ /**
981
+ * Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
982
+ *
983
+ * Only available if the `experimentalSessionSupport` config option is enabled.
984
+ *
985
+ * @see https://on.cypress.io/session
986
+ */
987
+ session(id: string | object, setup?: SessionOptions['validate'], options?: SessionOptions): Chainable<null>
975
988
 
976
989
  /**
977
990
  * Get the window.document of the page that is currently active.
@@ -982,7 +995,7 @@ declare namespace Cypress {
982
995
  * .its('contentType')
983
996
  * .should('eq', 'text/html')
984
997
  */
985
- document(options?: Partial<Loggable>): Chainable<Document>
998
+ document(options?: Partial<Loggable & Timeoutable>): Chainable<Document>
986
999
 
987
1000
  /**
988
1001
  * Iterate through an array like structure (arrays or objects with a length property).
@@ -1635,17 +1648,11 @@ declare namespace Cypress {
1635
1648
  scrollTo(x: number | string, y: number | string, options?: Partial<ScrollToOptions>): Chainable<Subject>
1636
1649
 
1637
1650
  /**
1638
- * Select an `<option>` with specific text within a `<select>`.
1651
+ * Select an `<option>` with specific text, value, or index within a `<select>`.
1639
1652
  *
1640
1653
  * @see https://on.cypress.io/select
1641
1654
  */
1642
- select(text: string | string[], options?: Partial<SelectOptions>): Chainable<Subject>
1643
- /**
1644
- * Select an `<option>` with specific value(s) within a `<select>`.
1645
- *
1646
- * @see https://on.cypress.io/select
1647
- */
1648
- select(value: string | string[], options?: Partial<SelectOptions>): Chainable<Subject>
1655
+ select(valueOrTextOrIndex: string | number | Array<string | number>, options?: Partial<SelectOptions>): Chainable<Subject>
1649
1656
 
1650
1657
  /**
1651
1658
  * @deprecated Use `cy.intercept()` instead.
@@ -1896,13 +1903,13 @@ declare namespace Cypress {
1896
1903
  *
1897
1904
  * @see https://on.cypress.io/then
1898
1905
  */
1899
- then<S extends HTMLElement>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
1900
- /**
1901
- * Enables you to work with the subject yielded from the previous command / promise.
1902
- *
1903
- * @see https://on.cypress.io/then
1904
- */
1905
- then<S extends ArrayLike<HTMLElement>>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S extends ArrayLike<infer T> ? T : never>>
1906
+ then<S extends HTMLElement>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
1907
+ /**
1908
+ * Enables you to work with the subject yielded from the previous command / promise.
1909
+ *
1910
+ * @see https://on.cypress.io/then
1911
+ */
1912
+ then<S extends ArrayLike<HTMLElement>>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S extends ArrayLike<infer T> ? T : never>>
1906
1913
  /**
1907
1914
  * Enables you to work with the subject yielded from the previous command / promise.
1908
1915
  *
@@ -1958,7 +1965,7 @@ declare namespace Cypress {
1958
1965
  *
1959
1966
  * @see https://on.cypress.io/title
1960
1967
  */
1961
- title(options?: Partial<Loggable>): Chainable<string>
1968
+ title(options?: Partial<Loggable & Timeoutable>): Chainable<string>
1962
1969
 
1963
1970
  /**
1964
1971
  * Trigger an event on a DOM element.
@@ -2060,7 +2067,7 @@ declare namespace Cypress {
2060
2067
  * @alias cy.location('href')
2061
2068
  * @see https://on.cypress.io/url
2062
2069
  */
2063
- url(options?: Partial<Loggable & Timeoutable>): Chainable<string>
2070
+ url(options?: Partial<UrlOptions>): Chainable<string>
2064
2071
 
2065
2072
  /**
2066
2073
  * Control the size and orientation of the screen for your application.
@@ -2488,6 +2495,47 @@ declare namespace Cypress {
2488
2495
  cmdKey: boolean
2489
2496
  }
2490
2497
 
2498
+ interface PEMCert {
2499
+ /**
2500
+ * Path to the certificate file, relative to project root.
2501
+ */
2502
+ cert: string
2503
+ /**
2504
+ * Path to the private key file, relative to project root.
2505
+ */
2506
+ key: string
2507
+ /**
2508
+ * Path to a text file containing the passphrase, relative to project root.
2509
+ */
2510
+ passphrase?: string
2511
+ }
2512
+
2513
+ interface PFXCert {
2514
+ /**
2515
+ * Path to the certificate container, relative to project root.
2516
+ */
2517
+ pfx: string
2518
+ /**
2519
+ * Path to a text file containing the passphrase, relative to project root.
2520
+ */
2521
+ passphrase?: string
2522
+ }
2523
+
2524
+ interface ClientCertificate {
2525
+ /**
2526
+ * URL to match requests against. Wildcards following [minimatch](https://github.com/isaacs/minimatch) rules are supported.
2527
+ */
2528
+ url: string
2529
+ /**
2530
+ * Paths to one or more CA files to validate certs against, relative to project root.
2531
+ */
2532
+ ca?: string[]
2533
+ /**
2534
+ * A PEM format certificate/private key pair or PFX certificate container
2535
+ */
2536
+ certs: PEMCert[] | PFXCert[]
2537
+ }
2538
+
2491
2539
  interface ResolvedConfigOptions {
2492
2540
  /**
2493
2541
  * Url used as prefix for [cy.visit()](https://on.cypress.io/visit) or [cy.request()](https://on.cypress.io/request) command’s url
@@ -2700,7 +2748,7 @@ declare namespace Cypress {
2700
2748
  * To enable test retries only in runMode, set e.g. `{ openMode: null, runMode: 2 }`
2701
2749
  * @default null
2702
2750
  */
2703
- retries: Nullable<number | {runMode?: Nullable<number>, openMode?: Nullable<number>}>
2751
+ retries: Nullable<number | { runMode?: Nullable<number>, openMode?: Nullable<number> }>
2704
2752
  /**
2705
2753
  * Enables including elements within the shadow DOM when using querying
2706
2754
  * commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json,
@@ -2750,6 +2798,11 @@ declare namespace Cypress {
2750
2798
  * @default {}
2751
2799
  */
2752
2800
  e2e: Omit<ResolvedConfigOptions, TestingType>
2801
+
2802
+ /**
2803
+ * An array of objects defining the certificates
2804
+ */
2805
+ clientCertificates: ClientCertificate[]
2753
2806
  }
2754
2807
 
2755
2808
  /**
@@ -2810,19 +2863,15 @@ declare namespace Cypress {
2810
2863
  projectName: string
2811
2864
  projectRoot: string
2812
2865
  proxyUrl: string
2866
+ remote: RemoteState
2813
2867
  report: boolean
2814
2868
  reporterRoute: string
2815
2869
  reporterUrl: string
2816
2870
  socketId: null | string
2817
2871
  socketIoCookie: string
2818
2872
  socketIoRoute: string
2819
- spec: {
2820
- absolute: string
2821
- name: string
2822
- relative: string
2823
- specFilter: null | string
2824
- specType: 'integration' | 'component'
2825
- }
2873
+ spec: Cypress['spec'] | null
2874
+ specs: Array<Cypress['spec']>
2826
2875
  xhrRoute: string
2827
2876
  xhrUrl: string
2828
2877
  }
@@ -2836,7 +2885,7 @@ declare namespace Cypress {
2836
2885
  * All configuration items are optional.
2837
2886
  */
2838
2887
  type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, TestingType>>
2839
- type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }
2888
+ type ConfigOptions = CoreConfigOptions & { e2e?: CoreConfigOptions, component?: CoreConfigOptions }
2840
2889
 
2841
2890
  interface PluginConfigOptions extends ResolvedConfigOptions {
2842
2891
  /**
@@ -3173,6 +3222,18 @@ declare namespace Cypress {
3173
3222
  eventConstructor: string
3174
3223
  }
3175
3224
 
3225
+ /**
3226
+ * Options to change the default behavior of .url()
3227
+ */
3228
+ interface UrlOptions extends Loggable, Timeoutable {
3229
+ /**
3230
+ * Whether the url is decoded
3231
+ *
3232
+ * @default false
3233
+ */
3234
+ decode: boolean
3235
+ }
3236
+
3176
3237
  /** Options to change the default behavior of .writeFile */
3177
3238
  interface WriteFileOptions extends Loggable {
3178
3239
  flag: string
@@ -5263,7 +5324,7 @@ declare namespace Cypress {
5263
5324
  tag?: string
5264
5325
  }
5265
5326
 
5266
- interface DevServerOptions {
5327
+ interface DevServerConfig {
5267
5328
  specs: Spec[]
5268
5329
  config: ResolvedConfigOptions & RuntimeConfigOptions
5269
5330
  devServerEvents: NodeJS.EventEmitter
@@ -5282,7 +5343,7 @@ declare namespace Cypress {
5282
5343
  (action: 'before:spec', fn: (spec: Spec) => void | Promise<void>): void
5283
5344
  (action: 'before:browser:launch', fn: (browser: Browser, browserLaunchOptions: BrowserLaunchOptions) => void | BrowserLaunchOptions | Promise<BrowserLaunchOptions>): void
5284
5345
  (action: 'file:preprocessor', fn: (file: FileObject) => string | Promise<string>): void
5285
- (action: 'dev-server:start', fn: (file: DevServerOptions) => Promise<ResolvedDevServerConfig>): void
5346
+ (action: 'dev-server:start', fn: (file: DevServerConfig) => Promise<ResolvedDevServerConfig>): void
5286
5347
  (action: 'task', tasks: Tasks): void
5287
5348
  }
5288
5349
 
@@ -5636,48 +5697,48 @@ declare namespace Cypress {
5636
5697
  }
5637
5698
  ```
5638
5699
  */
5639
- interface cy extends Chainable<undefined> {}
5700
+ interface cy extends Chainable<undefined> { }
5640
5701
  }
5641
5702
 
5642
5703
  declare namespace Mocha {
5643
5704
  interface TestFunction {
5644
- /**
5645
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5646
- * as a thunk.
5647
- */
5648
- (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5649
-
5650
- /**
5651
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5652
- * as a thunk.
5653
- */
5654
- (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5705
+ /**
5706
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5707
+ * as a thunk.
5708
+ */
5709
+ (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5710
+
5711
+ /**
5712
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5713
+ * as a thunk.
5714
+ */
5715
+ (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5655
5716
  }
5656
5717
  interface ExclusiveTestFunction {
5657
- /**
5658
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5659
- * as a thunk.
5660
- */
5661
- (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5662
-
5663
- /**
5664
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5665
- * as a thunk.
5666
- */
5667
- (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5718
+ /**
5719
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5720
+ * as a thunk.
5721
+ */
5722
+ (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5723
+
5724
+ /**
5725
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5726
+ * as a thunk.
5727
+ */
5728
+ (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5668
5729
  }
5669
5730
  interface PendingTestFunction {
5670
- /**
5671
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5672
- * as a thunk.
5673
- */
5674
- (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5675
-
5676
- /**
5677
- * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5678
- * as a thunk.
5679
- */
5680
- (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5731
+ /**
5732
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5733
+ * as a thunk.
5734
+ */
5735
+ (title: string, config: Cypress.TestConfigOverrides, fn?: Func): Test
5736
+
5737
+ /**
5738
+ * Describe a specification or test-case with the given `title`, TestOptions, and callback `fn` acting
5739
+ * as a thunk.
5740
+ */
5741
+ (title: string, config: Cypress.TestConfigOverrides, fn?: AsyncFunc): Test
5681
5742
  }
5682
5743
 
5683
5744
  interface SuiteFunction {
File without changes