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
@@ -288,6 +288,16 @@ declare namespace CodeceptJS {
288
288
  * ```
289
289
  */
290
290
  runOnAndroid(caps: any, fn: any): void;
291
+ /**
292
+ * Returns app installation status.
293
+ *
294
+ * ```js
295
+ * I.checkIfAppIsInstalled("com.example.android.apis");
296
+ * ```
297
+ * @param bundleId - String ID of bundled app
298
+ * @returns Appium: support only Android
299
+ */
300
+ checkIfAppIsInstalled(bundleId: string): Promise<boolean>;
291
301
  /**
292
302
  * Check if an app is installed.
293
303
  *
@@ -329,6 +339,14 @@ declare namespace CodeceptJS {
329
339
  * @param [bundleId] - ID of bundle
330
340
  */
331
341
  removeApp(appId: string, bundleId?: string): void;
342
+ /**
343
+ * Reset the currently running app for current session.
344
+ *
345
+ * ```js
346
+ * I.resetApp();
347
+ * ```
348
+ */
349
+ resetApp(): void;
332
350
  /**
333
351
  * Check current activity on an Android device.
334
352
  *
@@ -1248,11 +1266,11 @@ declare namespace CodeceptJS {
1248
1266
  * )
1249
1267
  * const user = response.data.data;
1250
1268
  * ```
1251
- * @param variables - that may go along with the query
1252
- * @param options - are additional query options
1269
+ * @param [variables] - that may go along with the query
1270
+ * @param [options] - are additional query options
1253
1271
  * @returns Promise<any>
1254
1272
  */
1255
- sendQuery(query: string, variables: any, options: any, headers: any): any;
1273
+ sendQuery(query: string, variables?: any, options?: any, headers?: any): any;
1256
1274
  /**
1257
1275
  * Send query to GraphQL endpoint over http
1258
1276
  *
@@ -1273,11 +1291,11 @@ declare namespace CodeceptJS {
1273
1291
  * },
1274
1292
  * });
1275
1293
  * ```
1276
- * @param variables - that may go along with the mutation
1277
- * @param options - are additional query options
1294
+ * @param [variables] - that may go along with the mutation
1295
+ * @param [options] - are additional query options
1278
1296
  * @returns Promise<any>
1279
1297
  */
1280
- sendMutation(mutation: string, variables: any, options: any, headers: any): any;
1298
+ sendMutation(mutation: string, variables?: any, options?: any, headers?: any): any;
1281
1299
  }
1282
1300
  /**
1283
1301
  * Helper for managing remote data using GraphQL queries.
@@ -2670,7 +2688,7 @@ declare namespace CodeceptJS {
2670
2688
  /**
2671
2689
  * a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
2672
2690
  */
2673
- browser: string;
2691
+ browser?: string;
2674
2692
  /**
2675
2693
  * show browser window.
2676
2694
  */
@@ -2772,6 +2790,10 @@ declare namespace CodeceptJS {
2772
2790
  * pass additional chromium options
2773
2791
  */
2774
2792
  chromium?: any;
2793
+ /**
2794
+ * pass additional firefox options
2795
+ */
2796
+ firefox?: any;
2775
2797
  /**
2776
2798
  * (pass additional electron options
2777
2799
  */
@@ -2780,6 +2802,14 @@ declare namespace CodeceptJS {
2780
2802
  * (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge](https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge).
2781
2803
  */
2782
2804
  channel?: any;
2805
+ /**
2806
+ * An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
2807
+ */
2808
+ ignoreLog?: string[];
2809
+ /**
2810
+ * Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
2811
+ */
2812
+ ignoreHTTPSErrors?: boolean;
2783
2813
  };
2784
2814
  /**
2785
2815
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -3045,6 +3075,12 @@ declare namespace CodeceptJS {
3045
3075
  * ```
3046
3076
  */
3047
3077
  grabPopupText(): Promise<string | null>;
3078
+ /**
3079
+ * Create a new browser context with a page. \
3080
+ * Usually it should be run from a custom helper after call of `_startBrowser()`
3081
+ * @param [contextOptions] - See https://playwright.dev/docs/api/class-browser#browser-new-context
3082
+ */
3083
+ _createContextPage(contextOptions?: any): void;
3048
3084
  /**
3049
3085
  * Opens a web page in a browser. Requires relative or absolute url.
3050
3086
  * If url starts with `/`, opens a web page of a site defined in `url` config parameter.
@@ -3123,6 +3159,20 @@ declare namespace CodeceptJS {
3123
3159
  * > By default option `force: true` is set
3124
3160
  */
3125
3161
  dragAndDrop(srcElement: LocatorOrString, destElement: LocatorOrString, options?: any): void;
3162
+ /**
3163
+ * Restart browser with a new context and a new page
3164
+ *
3165
+ * ```js
3166
+ * // Restart browser and use a new timezone
3167
+ * I.restartBrowser({ timezoneId: 'America/Phoenix' });
3168
+ * // Open URL in a new page in changed timezone
3169
+ * I.amOnPage('/');
3170
+ * // Restart browser, allow reading/copying of text from/into clipboard in Chrome
3171
+ * I.restartBrowser({ permissions: ['clipboard-read', 'clipboard-write'] });
3172
+ * ```
3173
+ * @param [contextOptions] - [Options for browser context](https://playwright.dev/docs/api/class-browser#browser-new-context) when starting new browser
3174
+ */
3175
+ restartBrowser(contextOptions?: any): void;
3126
3176
  /**
3127
3177
  * Reload the current page.
3128
3178
  *
@@ -3350,7 +3400,7 @@ declare namespace CodeceptJS {
3350
3400
  */
3351
3401
  dontSeeElementInDOM(locator: CodeceptJS.LocatorOrString): void;
3352
3402
  /**
3353
- * Handles a file download.Aa file name is required to save the file on disk.
3403
+ * Handles a file download. A file name is required to save the file on disk.
3354
3404
  * Files are saved to "output" directory.
3355
3405
  *
3356
3406
  * Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
@@ -3359,10 +3409,10 @@ declare namespace CodeceptJS {
3359
3409
  * I.handleDownloads('downloads/avatar.jpg');
3360
3410
  * I.click('Download Avatar');
3361
3411
  * I.amInPath('output/downloads');
3362
- * I.waitForFile('downloads/avatar.jpg', 5);
3412
+ * I.waitForFile('avatar.jpg', 5);
3363
3413
  *
3364
3414
  * ```
3365
- * @param [fileName = downloads] - set filename for downloaded file
3415
+ * @param [fileName] - set filename for downloaded file
3366
3416
  */
3367
3417
  handleDownloads(fileName?: string): Promise<void>;
3368
3418
  /**
@@ -4023,7 +4073,7 @@ declare namespace CodeceptJS {
4023
4073
  * @param fn - function to be executed in browser context.
4024
4074
  * @param [arg] - optional argument to pass to the function
4025
4075
  */
4026
- executeScript(fn: string | ((...params: any[]) => any), arg?: any): void;
4076
+ executeScript(fn: string | ((...params: any[]) => any), arg?: any): Promise<any>;
4027
4077
  /**
4028
4078
  * Grab Locator if called within Context
4029
4079
  */
@@ -8857,7 +8907,7 @@ declare namespace CodeceptJS {
8857
8907
  */
8858
8908
  protocol?: string;
8859
8909
  /**
8860
- * path to WebDriver server,
8910
+ * path to WebDriver server.
8861
8911
  * @defaultValue /wd/hub
8862
8912
  */
8863
8913
  path?: string;