cypress 7.5.0 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ // Vendored from @cypress/listr-verbose-renderer
4
+ const figures = require('figures');
5
+
6
+ const cliCursor = require('cli-cursor');
7
+
8
+ const chalk = require('chalk');
9
+
10
+ const dayjs = require('dayjs');
11
+
12
+ const formattedLog = (options, output) => {
13
+ const timestamp = dayjs().format(options.dateFormat); // eslint-disable-next-line no-console
14
+
15
+ console.log(`${chalk.dim(`[${timestamp}]`)} ${output}`);
16
+ };
17
+
18
+ const renderHelper = (task, event, options) => {
19
+ const log = formattedLog.bind(undefined, options);
20
+
21
+ if (event.type === 'STATE') {
22
+ const message = task.isPending() ? 'started' : task.state;
23
+ log(`${task.title} [${message}]`);
24
+
25
+ if (task.isSkipped() && task.output) {
26
+ log(`${figures.arrowRight} ${task.output}`);
27
+ }
28
+ } else if (event.type === 'TITLE') {
29
+ log(`${task.title} [title changed]`);
30
+ }
31
+ };
32
+
33
+ const render = (tasks, options) => {
34
+ for (const task of tasks) {
35
+ task.subscribe(event => {
36
+ if (event.type === 'SUBTASKS') {
37
+ render(task.subtasks, options);
38
+ return;
39
+ }
40
+
41
+ renderHelper(task, event, options);
42
+ }, err => {
43
+ // eslint-disable-next-line no-console
44
+ console.log(err);
45
+ });
46
+ }
47
+ };
48
+
49
+ class VerboseRenderer {
50
+ constructor(tasks, options) {
51
+ this._tasks = tasks;
52
+ this._options = Object.assign({
53
+ dateFormat: 'HH:mm:ss'
54
+ }, options);
55
+ }
56
+
57
+ static get nonTTY() {
58
+ return true;
59
+ }
60
+
61
+ render() {
62
+ cliCursor.hide();
63
+ render(this._tasks, this._options);
64
+ }
65
+
66
+ end() {
67
+ cliCursor.show();
68
+ }
69
+
70
+ }
71
+
72
+ module.exports = VerboseRenderer;
@@ -16,8 +16,6 @@ const {
16
16
  Listr
17
17
  } = require('listr2');
18
18
 
19
- const verbose = require('@cypress/listr-verbose-renderer');
20
-
21
19
  const Promise = require('bluebird');
22
20
 
23
21
  const logSymbols = require('log-symbols');
@@ -43,6 +41,8 @@ const {
43
41
  errors
44
42
  } = require('../errors');
45
43
 
44
+ const verbose = require('../VerboseRenderer');
45
+
46
46
  const getNpmArgv = () => {
47
47
  const json = process.env.npm_config_argv;
48
48
 
@@ -10,8 +10,6 @@ const {
10
10
 
11
11
  const debug = require('debug')('cypress:cli');
12
12
 
13
- const verbose = require('@cypress/listr-verbose-renderer');
14
-
15
13
  const {
16
14
  stripIndent
17
15
  } = require('common-tags');
@@ -24,6 +22,8 @@ const path = require('path');
24
22
 
25
23
  const os = require('os');
26
24
 
25
+ const verbose = require('../VerboseRenderer');
26
+
27
27
  const {
28
28
  throwFormErrorText,
29
29
  errors
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "7.5.0",
3
+ "version": "7.6.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/listr-verbose-renderer": "^0.4.1",
11
10
  "@cypress/request": "^2.88.5",
12
11
  "@cypress/xvfb": "^1.2.4",
13
12
  "@types/node": "^14.14.31",
@@ -19,15 +18,18 @@
19
18
  "cachedir": "^2.3.0",
20
19
  "chalk": "^4.1.0",
21
20
  "check-more-types": "^2.24.0",
21
+ "cli-cursor": "^3.1.0",
22
22
  "cli-table3": "~0.6.0",
23
23
  "commander": "^5.1.0",
24
24
  "common-tags": "^1.8.0",
25
25
  "dayjs": "^1.10.4",
26
- "debug": "4.3.2",
26
+ "debug": "^4.3.2",
27
+ "enquirer": "^2.3.6",
27
28
  "eventemitter2": "^6.4.3",
28
29
  "execa": "4.1.0",
29
30
  "executable": "^4.1.1",
30
31
  "extract-zip": "2.0.1",
32
+ "figures": "^3.2.0",
31
33
  "fs-extra": "^9.1.0",
32
34
  "getos": "^3.2.1",
33
35
  "is-ci": "^3.0.0",
@@ -60,7 +60,7 @@ declare namespace Cypress {
60
60
  */
61
61
  displayName: string
62
62
  version: string
63
- majorVersion: number
63
+ majorVersion: number | string
64
64
  path: string
65
65
  isHeaded: boolean
66
66
  isHeadless: boolean
@@ -490,6 +490,13 @@ declare namespace Cypress {
490
490
  getElementCoordinatesByPositionRelativeToXY(element: JQuery | HTMLElement, x: number, y: number): ElementPositioning
491
491
  }
492
492
 
493
+ /**
494
+ * @see https://on.cypress.io/keyboard-api
495
+ */
496
+ Keyboard: {
497
+ defaults(options: Partial<KeyboardDefaultsOptions>): void
498
+ }
499
+
493
500
  /**
494
501
  * @see https://on.cypress.io/api/api-server
495
502
  */
@@ -2756,8 +2763,6 @@ declare namespace Cypress {
2756
2763
  clientRoute: string
2757
2764
  configFile: string
2758
2765
  cypressEnv: string
2759
- integrationExampleName: string
2760
- integrationExamplePath: string
2761
2766
  isNewProject: boolean
2762
2767
  isTextTerminal: boolean
2763
2768
  morgan: boolean
@@ -2786,6 +2791,7 @@ declare namespace Cypress {
2786
2791
 
2787
2792
  interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'baseUrl' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>> {
2788
2793
  browser?: IsBrowserMatcher | IsBrowserMatcher[]
2794
+ keystrokeDelay?: number
2789
2795
  }
2790
2796
 
2791
2797
  /**
@@ -2836,6 +2842,18 @@ declare namespace Cypress {
2836
2842
  env: object
2837
2843
  }
2838
2844
 
2845
+ /**
2846
+ * Options for Cypress.Keyboard.defaults()
2847
+ */
2848
+ interface KeyboardDefaultsOptions {
2849
+ /**
2850
+ * Time, in milliseconds, between each keystroke when typing. (Pass 0 to disable)
2851
+ *
2852
+ * @default 10
2853
+ */
2854
+ keystrokeDelay: number
2855
+ }
2856
+
2839
2857
  /**
2840
2858
  * Full set of possible options for cy.request call
2841
2859
  */
@@ -79,7 +79,7 @@ export namespace CyHttpMessages {
79
79
  /**
80
80
  * The headers of the HTTP message.
81
81
  */
82
- headers: { [key: string]: string }
82
+ headers: { [key: string]: string | string[] }
83
83
  }
84
84
 
85
85
  export type IncomingResponse = BaseMessage & {
@@ -131,6 +131,10 @@ export namespace CyHttpMessages {
131
131
  * Request URL.
132
132
  */
133
133
  url: string
134
+ /**
135
+ * URL query string as object.
136
+ */
137
+ query: Record<string, string|number>
134
138
  /**
135
139
  * The HTTP version used in the request. Read only.
136
140
  */
@@ -383,7 +387,7 @@ export type RouteHandler = string | StaticResponse | RouteHandlerController | ob
383
387
  /**
384
388
  * Describes a response that will be sent back to the browser to fulfill the request.
385
389
  */
386
- export type StaticResponse = GenericStaticResponse<string, string | object | boolean | null> & {
390
+ export type StaticResponse = GenericStaticResponse<string, string | object | boolean | ArrayBuffer | null> & {
387
391
  /**
388
392
  * Milliseconds to delay before the response is sent.
389
393
  * @deprecated Use `delay` instead of `delayMs`.