codeceptjs 3.3.7-beta.1 → 3.3.8-beta.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/docs/basics.md +2 -3
  3. package/docs/bdd.md +33 -0
  4. package/docs/best.md +8 -8
  5. package/docs/build/Appium.js +60 -22
  6. package/docs/build/GraphQL.js +6 -6
  7. package/docs/build/Nightmare.js +4 -4
  8. package/docs/build/Playwright.js +102 -39
  9. package/docs/build/Polly.js +0 -0
  10. package/docs/build/Protractor.js +25 -25
  11. package/docs/build/Puppeteer.js +7 -7
  12. package/docs/build/SeleniumWebdriver.js +0 -0
  13. package/docs/build/TestCafe.js +12 -12
  14. package/docs/build/WebDriver.js +32 -32
  15. package/docs/changelog.md +36 -1
  16. package/docs/helpers/Appium.md +103 -79
  17. package/docs/helpers/GraphQL.md +6 -6
  18. package/docs/helpers/Playwright.md +280 -245
  19. package/docs/helpers/Puppeteer.md +1 -1
  20. package/docs/helpers/REST.md +1 -1
  21. package/docs/helpers/WebDriver.md +2 -2
  22. package/docs/playwright.md +14 -0
  23. package/docs/quickstart.md +40 -13
  24. package/docs/translation.md +83 -56
  25. package/docs/typescript.md +49 -3
  26. package/docs/wiki/Books-&-Posts.md +0 -0
  27. package/docs/wiki/Community-Helpers-&-Plugins.md +0 -0
  28. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -0
  29. package/docs/wiki/Examples.md +0 -0
  30. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
  31. package/docs/wiki/Home.md +0 -0
  32. package/docs/wiki/Release-Process.md +0 -0
  33. package/docs/wiki/Roadmap.md +0 -0
  34. package/docs/wiki/Tests.md +0 -0
  35. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
  36. package/docs/wiki/Videos.md +0 -0
  37. package/lib/codecept.js +3 -1
  38. package/lib/command/definitions.js +26 -2
  39. package/lib/command/generate.js +23 -9
  40. package/lib/command/init.js +32 -7
  41. package/lib/command/run.js +5 -1
  42. package/lib/container.js +15 -15
  43. package/lib/helper/Appium.js +60 -22
  44. package/lib/helper/GraphQL.js +6 -6
  45. package/lib/helper/Nightmare.js +4 -4
  46. package/lib/helper/Playwright.js +102 -41
  47. package/lib/helper/Protractor.js +25 -25
  48. package/lib/helper/Puppeteer.js +7 -7
  49. package/lib/helper/TestCafe.js +12 -12
  50. package/lib/helper/WebDriver.js +32 -32
  51. package/lib/helper/errors/ElementNotFound.js +1 -1
  52. package/lib/helper/extras/PlaywrightRestartOpts.js +0 -2
  53. package/lib/interfaces/bdd.js +26 -1
  54. package/lib/listener/artifacts.js +19 -0
  55. package/lib/rerun.js +12 -13
  56. package/lib/scenario.js +15 -23
  57. package/lib/step.js +5 -5
  58. package/lib/translation.js +32 -0
  59. package/package.json +11 -17
  60. package/translations/ru-RU.js +1 -0
  61. package/typings/index.d.ts +29 -1
  62. package/typings/promiseBasedTypes.d.ts +10466 -0
  63. package/typings/types.d.ts +62 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.3.7-beta.1",
3
+ "version": "3.3.8-beta.1",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -42,7 +42,7 @@
42
42
  "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.js --fix",
43
43
  "docs": "./runok.js docs",
44
44
  "test:unit": "mocha test/unit --recursive",
45
- "test:runner": "mocha test/runner --recursive",
45
+ "test:runner": "mocha test/runner --recursive --timeout 5000",
46
46
  "test": "npm run test:unit && npm run test:runner",
47
47
  "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
48
48
  "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
@@ -50,7 +50,8 @@
50
50
  "dev:graphql": "nodemon test/data/graphql/index.js",
51
51
  "publish:site": "./runok.js publish:site",
52
52
  "update-contributor-faces": "contributor-faces .",
53
- "dtslint": "dtslint typings --localTs './node_modules/typescript/lib'"
53
+ "dtslint": "dtslint typings --localTs './node_modules/typescript/lib'",
54
+ "prepare": "husky install"
54
55
  },
55
56
  "dependencies": {
56
57
  "@codeceptjs/configure": "^0.8.0",
@@ -86,8 +87,8 @@
86
87
  "promise-retry": "^1.1.1",
87
88
  "requireg": "^0.2.2",
88
89
  "resq": "^1.10.2",
89
- "sprintf-js": "^1.1.1",
90
90
  "semver": "^6.3.0",
91
+ "sprintf-js": "^1.1.1",
91
92
  "uuid": "^8.3.2"
92
93
  },
93
94
  "devDependencies": {
@@ -116,7 +117,7 @@
116
117
  "express": "^4.17.2",
117
118
  "form-data": "^3.0.1",
118
119
  "graphql": "^14.6.0",
119
- "husky": "^4.3.8",
120
+ "husky": "^8.0.1",
120
121
  "jsdoc": "^3.6.10",
121
122
  "jsdoc-typeof-plugin": "^1.0.0",
122
123
  "json-server": "^0.10.1",
@@ -132,28 +133,21 @@
132
133
  "sinon-chai": "^3.7.0",
133
134
  "testcafe": "^1.18.3",
134
135
  "ts-morph": "^3.1.3",
136
+ "ts-node": "^10.9.1",
135
137
  "tsd-jsdoc": "https://github.com/englercj/tsd-jsdoc.git",
136
138
  "typedoc": "^0.23.10",
137
139
  "typedoc-plugin-markdown": "^3.13.4",
138
- "typescript": "^4.4.3",
140
+ "typescript": "^4.8.4",
139
141
  "wdio-docker-service": "^1.5.0",
140
142
  "webdriverio": "^7.16.14",
141
143
  "xml2js": "^0.4.23",
142
144
  "xmldom": "^0.1.31",
143
- "xpath": "0.0.27"
145
+ "xpath": "0.0.27",
146
+ "inquirer-test": "^2.0.1"
144
147
  },
145
148
  "engines": {
146
149
  "node": ">=8.9.1",
147
150
  "npm": ">=5.6.0"
148
151
  },
149
- "peerDependencies": {
150
- "@faker-js/faker": "^5.5.3"
151
- },
152
- "es6": true,
153
- "husky": {
154
- "hooks": {
155
- "pre-commit": "npm run lint",
156
- "pre-push": "npm run test:unit"
157
- }
158
- }
152
+ "es6": true
159
153
  }
@@ -9,6 +9,7 @@ module.exports = {
9
9
  AfterSuite: 'После_всего',
10
10
  },
11
11
  actions: {
12
+ say: 'сообщаю',
12
13
  waitForElement: 'ожидаю_элемент',
13
14
  waitForVisible: 'ожидаю_увидеть',
14
15
  waitForText: 'ожидаю_текст',
@@ -1,5 +1,6 @@
1
1
  // Project: https://github.com/codeception/codeceptjs/
2
2
  /// <reference path="./types.d.ts" />
3
+ /// <reference path="./promiseBasedTypes.d.ts" />
3
4
  /// <reference types="webdriverio" />
4
5
  /// <reference path="./Mocha.d.ts" />
5
6
  /// <reference types="joi" />
@@ -230,8 +231,13 @@ declare namespace CodeceptJS {
230
231
  * [Execute JS code after finishing tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall)
231
232
  */
232
233
  teardownAll?: (() => Promise<void>) | boolean | string;
234
+
233
235
  /** Enable [localized test commands](https://codecept.io/translation/) */
234
236
  translation?: string;
237
+
238
+ /** Additional vocabularies for [localication](https://codecept.io/translation/) */
239
+ vocabularies?: Array<string>;
240
+
235
241
  /**
236
242
  * [Require additional JS modules](https://codecept.io/configuration/#require)
237
243
  *
@@ -257,9 +263,16 @@ declare namespace CodeceptJS {
257
263
  /** load feature files by pattern. Multiple patterns can be specified as array */
258
264
  features: string | Array<string>,
259
265
  /** load step definitions from JS files */
260
- steps: Array<string>
266
+ steps: string | Array<string>
261
267
  };
262
268
 
269
+ /**
270
+ * Enable full promise-based helper methods for [TypeScript](https://codecept.io/typescript/) project.
271
+ * If true, all helper methods are typed as asynchronous;
272
+ * Otherwise, it remains as it works in versions prior to 3.3.6
273
+ */
274
+ fullPromiseBased?: boolean;
275
+
263
276
  [key: string]: any;
264
277
  };
265
278
 
@@ -348,11 +361,21 @@ declare namespace CodeceptJS {
348
361
  interface Globals {
349
362
  codeceptjs: typeof codeceptjs;
350
363
  }
364
+
365
+ interface IParameterTypeDefinition<T> {
366
+ name: string
367
+ regexp: readonly RegExp[] | readonly string[] | RegExp | string
368
+ transformer: (...match: string[]) => T
369
+ useForSnippets?: boolean
370
+ preferForRegexpMatch?: boolean
371
+ }
351
372
  }
352
373
 
353
374
  // Globals
354
375
  declare const codecept_dir: string;
355
376
  declare const output_dir: string;
377
+ declare function tryTo(...fn): Promise<boolean>;
378
+ declare function retryTo(...fn): Promise<null>;
356
379
 
357
380
  declare const actor: CodeceptJS.actor;
358
381
  declare const codecept_actor: CodeceptJS.actor;
@@ -382,6 +405,7 @@ declare const xScenario: CodeceptJS.IScenario;
382
405
  declare const xFeature: CodeceptJS.IFeature;
383
406
  declare function Data(data: any): CodeceptJS.IData;
384
407
  declare function xData(data: any): CodeceptJS.IData;
408
+ declare function defineParameterType(options: CodeceptJS.IParameterTypeDefinition<any>): void
385
409
 
386
410
  // Hooks
387
411
  declare const BeforeSuite: CodeceptJS.IHook;
@@ -416,11 +440,15 @@ declare namespace NodeJS {
416
440
  locate: typeof locate;
417
441
  inject: typeof inject;
418
442
  secret: typeof secret;
443
+ // plugins
444
+ tryTo: typeof tryTo;
445
+ retryTo: typeof retryTo;
419
446
 
420
447
  // BDD
421
448
  Given: typeof Given;
422
449
  When: typeof When;
423
450
  Then: typeof Then;
451
+ DefineParameterType: typeof defineParameterType
424
452
  }
425
453
  }
426
454