codeceptjs 3.2.3 → 3.3.0-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 (48) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/docs/advanced.md +0 -4
  3. package/docs/api.md +227 -188
  4. package/docs/build/ApiDataFactory.js +13 -6
  5. package/docs/build/Appium.js +36 -36
  6. package/docs/build/GraphQL.js +11 -0
  7. package/docs/build/JSONResponse.js +297 -0
  8. package/docs/build/Nightmare.js +48 -48
  9. package/docs/build/Playwright.js +261 -146
  10. package/docs/build/Puppeteer.js +76 -67
  11. package/docs/build/REST.js +36 -0
  12. package/docs/build/TestCafe.js +44 -44
  13. package/docs/build/WebDriver.js +69 -69
  14. package/docs/helpers/ApiDataFactory.md +7 -0
  15. package/docs/helpers/Appium.md +3 -3
  16. package/docs/helpers/JSONResponse.md +230 -0
  17. package/docs/helpers/Playwright.md +282 -218
  18. package/docs/helpers/Puppeteer.md +9 -1
  19. package/docs/helpers/REST.md +30 -9
  20. package/docs/installation.md +2 -0
  21. package/docs/internal-api.md +265 -0
  22. package/docs/playwright.md +70 -15
  23. package/docs/plugins.md +125 -29
  24. package/docs/puppeteer.md +24 -8
  25. package/docs/quickstart.md +2 -3
  26. package/docs/reports.md +43 -2
  27. package/docs/translation.md +1 -1
  28. package/docs/videos.md +2 -2
  29. package/docs/webdriver.md +90 -2
  30. package/lib/command/init.js +5 -15
  31. package/lib/config.js +17 -13
  32. package/lib/helper/ApiDataFactory.js +13 -6
  33. package/lib/helper/Appium.js +3 -3
  34. package/lib/helper/GraphQL.js +11 -0
  35. package/lib/helper/JSONResponse.js +297 -0
  36. package/lib/helper/Playwright.js +199 -84
  37. package/lib/helper/Puppeteer.js +12 -3
  38. package/lib/helper/REST.js +36 -0
  39. package/lib/helper/extras/Console.js +8 -0
  40. package/lib/helper/extras/PlaywrightRestartOpts.js +35 -0
  41. package/lib/interfaces/bdd.js +3 -1
  42. package/lib/plugin/allure.js +12 -0
  43. package/lib/plugin/eachElement.js +127 -0
  44. package/lib/utils.js +20 -0
  45. package/package.json +6 -4
  46. package/translations/pt-BR.js +8 -0
  47. package/typings/index.d.ts +2 -0
  48. package/typings/types.d.ts +237 -11
@@ -64,6 +64,18 @@ const defaultConfig = {
64
64
  * * `addAttachment(name, buffer, type)` - add an attachment to current test / suite
65
65
  * * `addLabel(name, value)` - adds a label to current test
66
66
  * * `addParameter(kind, name, value)` - adds a parameter to current test
67
+ * * `createStep(name, stepFunc)` - create a step, stepFunc could consist an attachment
68
+ * Example of usage:
69
+ * ```js
70
+ * allure.createStep('New created step', () => {
71
+ * allure.addAttachment(
72
+ * 'Request params',
73
+ * '{"clientId":123, "name":"Tom", "age":29}',
74
+ * 'application/json'
75
+ * );
76
+ * });
77
+ * ```
78
+ * ![Created Step Image](https://user-images.githubusercontent.com/63167966/139339384-e6e70a62-3638-406d-a224-f32473071428.png)
67
79
  * * `severity(value)` - adds severity label
68
80
  * * `epic(value)` - adds epic label
69
81
  * * `feature(value)` - adds feature label
@@ -0,0 +1,127 @@
1
+ const output = require('../output');
2
+ const store = require('../store');
3
+ const recorder = require('../recorder');
4
+ const container = require('../container');
5
+ const event = require('../event');
6
+ const Step = require('../step');
7
+ const { isAsyncFunction } = require('../utils');
8
+
9
+ const defaultConfig = {
10
+ registerGlobal: true,
11
+ };
12
+
13
+ /**
14
+ * Provides `eachElement` global function to iterate over found elements to perform actions on them.
15
+ *
16
+ * `eachElement` takes following args:
17
+ * * `purpose` - the goal of an action. A comment text that will be displayed in output.
18
+ * * `locator` - a CSS/XPath locator to match elements
19
+ * * `fn(element, index)` - **asynchronous** function which will be executed for each matched element.
20
+ *
21
+ * Example of usage:
22
+ *
23
+ * ```js
24
+ * // this example works with Playwright and Puppeteer helper
25
+ * await eachElement('click all checkboxes', 'form input[type=checkbox]', async (el) => {
26
+ * await el.click();
27
+ * });
28
+ * ```
29
+ * Click odd elements:
30
+ *
31
+ * ```js
32
+ * // this example works with Playwright and Puppeteer helper
33
+ * await eachElement('click odd buttons', '.button-select', async (el, index) => {
34
+ * if (index % 2) await el.click();
35
+ * });
36
+ * ```
37
+ *
38
+ * Check all elements for visibility:
39
+ *
40
+ * ```js
41
+ * // this example works with Playwright and Puppeteer helper
42
+ * const assert = require('assert');
43
+ * await eachElement('check all items are visible', '.item', async (el) => {
44
+ * assert(await el.isVisible());
45
+ * });
46
+ * ```
47
+ * This method works with WebDriver, Playwright, Puppeteer, Appium helpers.
48
+ *
49
+ * Function parameter `el` represents a matched element.
50
+ * Depending on a helper API of `el` can be different. Refer to API of corresponding browser testing engine for a complete API list:
51
+ *
52
+ * * [Playwright ElementHandle](https://playwright.dev/docs/api/class-elementhandle)
53
+ * * [Puppeteer](https://pptr.dev/#?product=Puppeteer&show=api-class-elementhandle)
54
+ * * [webdriverio element](https://webdriver.io/docs/api)
55
+ *
56
+ * #### Configuration
57
+ *
58
+ * * `registerGlobal` - to register `eachElement` function globally, true by default
59
+ *
60
+ * If `registerGlobal` is false you can use eachElement from the plugin:
61
+ *
62
+ * ```js
63
+ * const eachElement = codeceptjs.container.plugins('eachElement');
64
+ * ```
65
+ *
66
+ * @param {string} purpose
67
+ * @param {CodeceptJS.LocatorOrString} locator
68
+ * @param {Function} fn
69
+ * @return {Promise<*> | undefined}
70
+ */
71
+ function eachElement(purpose, locator, fn) {
72
+ if (store.dryRun) return;
73
+ const helpers = Object.values(container.helpers());
74
+
75
+ const helper = helpers.filter(h => !!h._locate)[0];
76
+
77
+ if (!helper) {
78
+ throw new Error('No helper enabled with _locate method with returns a list of elements.');
79
+ }
80
+
81
+ if (!isAsyncFunction(fn)) {
82
+ throw new Error('Async function should be passed into each element');
83
+ }
84
+
85
+ const step = new Step(helper, `${purpose || 'each element'} within "${locator}"`);
86
+ step.helperMethod = '_locate';
87
+ // eachElement('select all users', 'locator', async (el) => {
88
+ event.dispatcher.emit(event.step.before, step);
89
+
90
+ return recorder.add('register each element wrapper', async () => {
91
+ event.emit(event.step.started, step);
92
+ const els = await helper._locate(locator);
93
+ output.debug(`Found ${els.length} elements for each elements to iterate`);
94
+
95
+ const errs = [];
96
+ let i = 0;
97
+ for (const el of els) {
98
+ try {
99
+ await fn(el, i);
100
+ } catch (err) {
101
+ output.error(`eachElement: failed operation on element #${i} ${el}`);
102
+ errs.push(err);
103
+ }
104
+ i++;
105
+ }
106
+
107
+ if (errs.length) {
108
+ event.dispatcher.emit(event.step.after, step);
109
+ event.emit(event.step.failed, step, errs[0]);
110
+ event.emit(event.step.finished, step);
111
+ throw errs[0];
112
+ }
113
+
114
+ event.dispatcher.emit(event.step.after, step);
115
+ event.emit(event.step.passed, step, null);
116
+ event.emit(event.step.finished, step);
117
+ });
118
+ }
119
+
120
+ module.exports = function (config) {
121
+ config = Object.assign(defaultConfig, config);
122
+
123
+ if (config.registerGlobal) {
124
+ global.eachElement = eachElement;
125
+ }
126
+ return eachElement;
127
+ };
package/lib/utils.js CHANGED
@@ -431,3 +431,23 @@ module.exports.modifierKeys = modifierKeys;
431
431
  module.exports.isModifierKey = function (key) {
432
432
  return modifierKeys.includes(key);
433
433
  };
434
+
435
+ module.exports.requireWithFallback = function (...packages) {
436
+ const exists = function (pkg) {
437
+ try {
438
+ require.resolve(pkg);
439
+ } catch (e) {
440
+ return false;
441
+ }
442
+
443
+ return true;
444
+ };
445
+
446
+ for (const pkg of packages) {
447
+ if (exists(pkg)) {
448
+ return require(pkg);
449
+ }
450
+ }
451
+
452
+ throw new Error(`Cannot find modules ${packages.join(',')}`);
453
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.2.3",
3
+ "version": "3.3.0-beta.1",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -59,6 +59,7 @@
59
59
  "allure-js-commons": "^1.3.2",
60
60
  "arrify": "^2.0.1",
61
61
  "axios": "^0.21.1",
62
+ "chai-deep-match": "^1.2.1",
62
63
  "chalk": "^4.1.0",
63
64
  "commander": "^2.20.3",
64
65
  "cross-spawn": "^7.0.3",
@@ -72,6 +73,7 @@
72
73
  "gherkin": "^5.1.0",
73
74
  "glob": "^6.0.1",
74
75
  "inquirer": "^6.5.2",
76
+ "joi": "^17.6.0",
75
77
  "js-beautify": "^1.11.0",
76
78
  "lodash.clonedeep": "^4.5.0",
77
79
  "lodash.merge": "^4.6.2",
@@ -97,7 +99,7 @@
97
99
  "@wdio/selenium-standalone-service": "^5.16.10",
98
100
  "@wdio/utils": "^5.23.0",
99
101
  "apollo-server-express": "^2.19.0",
100
- "chai": "^3.4.1",
102
+ "chai": "^3.5.0",
101
103
  "chai-as-promised": "^5.2.0",
102
104
  "chai-subset": "^1.6.0",
103
105
  "contributor-faces": "^1.0.3",
@@ -110,7 +112,7 @@
110
112
  "eslint-plugin-mocha": "^6.3.0",
111
113
  "expect": "^26.6.2",
112
114
  "express": "^4.17.1",
113
- "faker": "^5.5.1",
115
+ "faker": "5.5.3",
114
116
  "form-data": "^3.0.0",
115
117
  "graphql": "^14.6.0",
116
118
  "husky": "^4.3.5",
@@ -120,7 +122,7 @@
120
122
  "mocha-parallel-tests": "^2.3.0",
121
123
  "nightmare": "^3.0.2",
122
124
  "nodemon": "^1.19.4",
123
- "playwright": "^1.9.1",
125
+ "playwright": "^1.18.1",
124
126
  "puppeteer": "^10.0.0",
125
127
  "qrcode-terminal": "^0.12.0",
126
128
  "rosie": "^1.6.0",
@@ -1,5 +1,13 @@
1
1
  module.exports = {
2
2
  I: 'Eu',
3
+ contexts: {
4
+ Feature: 'Funcionalidade',
5
+ Scenario: 'Cenário',
6
+ Before: 'Antes',
7
+ After: 'Depois',
8
+ BeforeSuite: 'AntesDaSuite',
9
+ AfterSuite: 'DepoisDaSuite',
10
+ },
3
11
  actions: {
4
12
  amOutsideAngularApp: 'naoEstouEmAplicacaoAngular',
5
13
  amInsideAngularApp: 'estouNaAplicacaoAngular',
@@ -2,6 +2,8 @@
2
2
  /// <reference path="./types.d.ts" />
3
3
  /// <reference types="webdriverio" />
4
4
  /// <reference path="./Mocha.d.ts" />
5
+ /// <reference types="joi" />
6
+ /// <reference types="playwright" />
5
7
 
6
8
  declare namespace CodeceptJS {
7
9
  type WithTranslation<T> = T &
@@ -186,11 +186,14 @@ declare namespace CodeceptJS {
186
186
  * // create user with defined email
187
187
  * // and receive it when inside async function
188
188
  * const user = await I.have('user', { email: 'user@user.com'});
189
+ * // create a user with options that will not be included in the final request
190
+ * I.have('user', { }, { age: 33, height: 55 })
189
191
  * ```
190
192
  * @param factory - factory to use
191
193
  * @param params - predefined parameters
194
+ * @param options - options for programmatically generate the attributes
192
195
  */
193
- have(factory: any, params: any): void;
196
+ have(factory: any, params: any, options: any): void;
194
197
  /**
195
198
  * Generates bunch of records and saves multiple API requests to store them.
196
199
  *
@@ -200,9 +203,12 @@ declare namespace CodeceptJS {
200
203
  *
201
204
  * // create 3 posts by one author
202
205
  * I.haveMultiple('post', 3, { author: 'davert' });
206
+ *
207
+ * // create 3 posts by one author with options
208
+ * I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' });
203
209
  * ```
204
210
  */
205
- haveMultiple(factory: any, times: any, params: any): void;
211
+ haveMultiple(factory: any, times: any, params: any, options: any): void;
206
212
  /**
207
213
  * Executes request to create a record in API.
208
214
  * Can be replaced from a in custom helper.
@@ -560,11 +566,11 @@ declare namespace CodeceptJS {
560
566
  * Perform a swipe on the screen.
561
567
  *
562
568
  * ```js
563
- * I.performswipe(100,200);
569
+ * I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 });
564
570
  * ```
565
571
  * @param to - Appium: support Android and iOS
566
572
  */
567
- performSwipe(from: number, to: number): void;
573
+ performSwipe(from: any, to: any): void;
568
574
  /**
569
575
  * Perform a swipe down on an element.
570
576
  *
@@ -1433,6 +1439,179 @@ declare namespace CodeceptJS {
1433
1439
  */
1434
1440
  _requestDelete(operation: string, data: any): void;
1435
1441
  }
1442
+ /**
1443
+ * This helper allows performing assertions on JSON responses paired with following helpers:
1444
+ *
1445
+ * * REST
1446
+ * * GraphQL
1447
+ * * Playwright
1448
+ *
1449
+ * It can check status codes, response data, response structure.
1450
+ *
1451
+ *
1452
+ * ## Configuration
1453
+ *
1454
+ * * `requestHelper` - a helper which will perform requests. `REST` by default, also `Playwright` or `GraphQL` can be used. Custom helpers must have `onResponse` hook in their config, which will be executed when request is performed.
1455
+ *
1456
+ * ### Examples
1457
+ *
1458
+ * Zero-configuration when paired with REST:
1459
+ *
1460
+ * ```js
1461
+ * // inside codecept.conf.js
1462
+ * {
1463
+ * helpers: {
1464
+ * REST: {
1465
+ * endpoint: 'http://site.com/api',
1466
+ * },
1467
+ * JSONResponse: {}
1468
+ * }
1469
+ * }
1470
+ * ```
1471
+ * Explicitly setting request helper if you use `makeApiRequest` of Playwright to perform requests and not paired REST:
1472
+ *
1473
+ * ```js
1474
+ * // inside codecept.conf.js
1475
+ * // ...
1476
+ * helpers: {
1477
+ * Playwright: {
1478
+ * url: 'https://localhost',
1479
+ * browser: 'chromium',
1480
+ * },
1481
+ * JSONResponse: {
1482
+ * requestHelper: 'Playwright',
1483
+ * }
1484
+ * }
1485
+ * ```
1486
+ * ## Access From Helpers
1487
+ *
1488
+ * If you plan to add custom assertions it is recommended to create a helper that will retrieve response object from JSONResponse:
1489
+ *
1490
+ *
1491
+ * ```js
1492
+ * // inside custom helper
1493
+ * const response = this.helpers.JSONResponse.response;
1494
+ * ```
1495
+ *
1496
+ * ## Methods
1497
+ */
1498
+ class JSONResponse {
1499
+ /**
1500
+ * Checks that response code is equal to the provided one
1501
+ *
1502
+ * ```js
1503
+ * I.seeResponseCodeIs(200);
1504
+ * ```
1505
+ */
1506
+ seeResponseCodeIs(code: number): void;
1507
+ /**
1508
+ * Checks that response code is not equal to the provided one
1509
+ *
1510
+ * ```js
1511
+ * I.dontSeeResponseCodeIs(500);
1512
+ * ```
1513
+ */
1514
+ dontSeeResponseCodeIs(code: number): void;
1515
+ /**
1516
+ * Checks that the response code is 4xx
1517
+ */
1518
+ seeResponseCodeIsClientError(): void;
1519
+ /**
1520
+ * Checks that the response code is 3xx
1521
+ */
1522
+ seeResponseCodeIsRedirection(): void;
1523
+ /**
1524
+ * Checks that the response code is 5xx
1525
+ */
1526
+ seeResponseCodeIsServerError(): void;
1527
+ /**
1528
+ * Checks that the response code is 2xx
1529
+ * Use it instead of seeResponseCodeIs(200) if server can return 204 instead.
1530
+ *
1531
+ * ```js
1532
+ * I.seeResponseCodeIsSuccessful();
1533
+ * ```
1534
+ */
1535
+ seeResponseCodeIsSuccessful(): void;
1536
+ /**
1537
+ * Checks for deep inclusion of a provided json in a response data.
1538
+ *
1539
+ * ```js
1540
+ * // response.data == { user: { name: 'jon', email: 'jon@doe.com' } }
1541
+ *
1542
+ * I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } });
1543
+ * ```
1544
+ */
1545
+ seeResponseContainsJson(json: any): void;
1546
+ /**
1547
+ * Checks for deep inclusion of a provided json in a response data.
1548
+ *
1549
+ * ```js
1550
+ * // response.data == { data: { user: 1 } }
1551
+ *
1552
+ * I.dontSeeResponseContainsJson({ user: 2 });
1553
+ * ```
1554
+ */
1555
+ dontSeeResponseContainsJson(json: any): void;
1556
+ /**
1557
+ * Checks for deep inclusion of a provided json in a response data.
1558
+ *
1559
+ * ```js
1560
+ * // response.data == { user: { name: 'jon', email: 'jon@doe.com' } }
1561
+ *
1562
+ * I.seeResponseContainsKeys(['user']);
1563
+ * ```
1564
+ */
1565
+ seeResponseContainsKeys(keys: any[]): void;
1566
+ /**
1567
+ * Executes a callback function passing in `response` object and chai assertions with `expect`
1568
+ * Use it to perform custom checks of response data
1569
+ *
1570
+ * ```js
1571
+ * I.seeResponseValidByCallback({ data, status, expect } => {
1572
+ * expect(status).to.eql(200);
1573
+ * expect(data).keys.to.include(['user', 'company']);
1574
+ * });
1575
+ * ```
1576
+ */
1577
+ seeResponseValidByCallback(fn: (...params: any[]) => any): void;
1578
+ /**
1579
+ * Checks that response data equals to expected:
1580
+ *
1581
+ * ```js
1582
+ * // response.data is { error: 'Not allowed' }
1583
+ *
1584
+ * I.seeResponseEquals({ error: 'Not allowed' })
1585
+ * ```
1586
+ */
1587
+ seeResponseEquals(resp: any): void;
1588
+ /**
1589
+ * Validates JSON structure of response using [joi library](https://joi.dev).
1590
+ * See [joi API](https://joi.dev/api/) for complete reference on usage.
1591
+ *
1592
+ * Use pre-initialized joi instance by passing function callback:
1593
+ *
1594
+ * ```js
1595
+ * // response.data is { name: 'jon', id: 1 }
1596
+ *
1597
+ * I.seeResponseMatchesJsonSchema(joi => {
1598
+ * return joi.object({
1599
+ * name: joi.string();
1600
+ * id: joi.number();
1601
+ * })
1602
+ * });
1603
+ *
1604
+ * // or pass a valid schema
1605
+ * const joi = require('joi);
1606
+ *
1607
+ * I.seeResponseMatchesJsonSchema(joi.object({
1608
+ * name: joi.string();
1609
+ * id: joi.number();
1610
+ * });
1611
+ * ```
1612
+ */
1613
+ seeResponseMatchesJsonSchema(fnOrSchema: any): void;
1614
+ }
1436
1615
  /**
1437
1616
  * Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
1438
1617
  * fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
@@ -2385,12 +2564,18 @@ declare namespace CodeceptJS {
2385
2564
  *
2386
2565
  * This helper works with a browser out of the box with no additional tools required to install.
2387
2566
  *
2388
- * Requires `playwright` package version ^1 to be installed:
2567
+ * Requires `playwright` or `playwright-core` package version ^1 to be installed:
2389
2568
  *
2390
2569
  * ```
2391
- * npm i playwright@^1 --save
2570
+ * npm i playwright@^1.18 --save
2571
+ * ```
2572
+ * or
2573
+ * ```
2574
+ * npm i playwright-core@^1.18 --save
2392
2575
  * ```
2393
2576
  *
2577
+ * Using playwright-core package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
2578
+ *
2394
2579
  * ## Configuration
2395
2580
  *
2396
2581
  * This helper should be configured in codecept.json or codecept.conf.js
@@ -2574,15 +2759,15 @@ declare namespace CodeceptJS {
2574
2759
  * First argument is a description of an action.
2575
2760
  * Second argument is async function that gets this helper as parameter.
2576
2761
  *
2577
- * { [`page`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md), [`context`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md) [`browser`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md) } objects from Playwright API are available.
2762
+ * { [`page`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md), [`browserContext`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md) [`browser`](https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md) } objects from Playwright API are available.
2578
2763
  *
2579
2764
  * ```js
2580
- * I.usePlaywrightTo('emulate offline mode', async ({ context }) => {
2581
- * await context.setOffline(true);
2765
+ * I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
2766
+ * await browserContext.setOffline(true);
2582
2767
  * });
2583
2768
  * ```
2584
2769
  * @param description - used to show in logs.
2585
- * @param fn - async functuion that executed with Playwright helper as argument
2770
+ * @param fn - async function that executed with Playwright helper as argument
2586
2771
  */
2587
2772
  usePlaywrightTo(description: string, fn: (...params: any[]) => any): void;
2588
2773
  /**
@@ -3713,6 +3898,23 @@ declare namespace CodeceptJS {
3713
3898
  * @param [fullPage = false] - (optional, `false` by default) flag to enable fullscreen screenshot mode.
3714
3899
  */
3715
3900
  saveScreenshot(fileName: string, fullPage?: boolean): void;
3901
+ /**
3902
+ * Performs [api request](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get) using
3903
+ * the cookies from the current browser session.
3904
+ *
3905
+ * ```js
3906
+ * const users = await I.makeApiRequest('GET', '/api/users', { params: { page: 1 }});
3907
+ * users[0]
3908
+ * I.makeApiRequest('PATCH', )
3909
+ * ```
3910
+ *
3911
+ * > This is Playwright's built-in alternative to using REST helper's sendGet, sendPost, etc methods.
3912
+ * @param method - HTTP method
3913
+ * @param url - endpoint
3914
+ * @param options - request options depending on method used
3915
+ * @returns response
3916
+ */
3917
+ makeApiRequest(method: string, url: string, options: any): Promise<object>;
3716
3918
  /**
3717
3919
  * Pauses execution for a number of seconds.
3718
3920
  *
@@ -5274,7 +5476,15 @@ declare namespace CodeceptJS {
5274
5476
  * Browser control is executed via DevTools Protocol (instead of Selenium).
5275
5477
  * This helper works with a browser out of the box with no additional tools required to install.
5276
5478
  *
5277
- * Requires `puppeteer` package to be installed.
5479
+ * Requires `puppeteer` or `puppeteer-core` package to be installed.
5480
+ * ```
5481
+ * npm i puppeteer --save
5482
+ * ```
5483
+ * or
5484
+ * ```
5485
+ * npm i puppeteer-core --save
5486
+ * ```
5487
+ * Using `puppeteer-core` package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
5278
5488
  *
5279
5489
  * > Experimental Firefox support [can be activated](https://codecept.io/helpers/Puppeteer-firefox).
5280
5490
  *
@@ -6919,6 +7129,21 @@ declare namespace CodeceptJS {
6919
7129
  * ## Methods
6920
7130
  */
6921
7131
  class REST {
7132
+ /**
7133
+ * Sets request headers for all requests of this test
7134
+ * @param headers - headers list
7135
+ */
7136
+ haveRequestHeaders(headers: any): void;
7137
+ /**
7138
+ * Adds a header for Bearer authentication
7139
+ *
7140
+ * ```js
7141
+ * // we use secret function to hide token from logs
7142
+ * I.amBearerAuthenticated(secret('heregoestoken'))
7143
+ * ```
7144
+ * @param accessToken - Bearer access token
7145
+ */
7146
+ amBearerAuthenticated(accessToken: string): void;
6922
7147
  /**
6923
7148
  * Executes axios request
6924
7149
  * @returns response
@@ -9819,6 +10044,7 @@ declare namespace CodeceptJS {
9819
10044
  * If js file provided: require it and get .config key
9820
10045
  * If json file provided: load and parse JSON
9821
10046
  * If directory provided:
10047
+ * * try to load `codecept.config.js` from it
9822
10048
  * * try to load `codecept.conf.js` from it
9823
10049
  * * try to load `codecept.json` from it
9824
10050
  * If none of above: fail.