codeceptjs 2.6.10 → 2.6.11
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/CHANGELOG.md +7 -0
- package/docs/basics.md +2 -1
- package/docs/bdd.md +1 -2
- package/docs/build/Appium.js +1 -2
- package/docs/build/FileSystem.js +3 -3
- package/docs/build/Mochawesome.js +1 -1
- package/docs/build/Nightmare.js +5 -5
- package/docs/build/Playwright.js +40 -14
- package/docs/build/Protractor.js +2 -2
- package/docs/build/WebDriver.js +18 -6
- package/docs/changelog.md +134 -127
- package/docs/community-helpers.md +1 -1
- package/docs/helpers/Playwright.md +1 -1
- package/docs/translation.md +20 -0
- package/docs/wiki/{Community-Helpers.md → Community-Helpers-&-Plugins.md} +1 -1
- package/docs/wiki/Home.md +8 -4
- package/docs/wiki/Tests.md +64 -61
- package/lib/actor.js +1 -1
- package/lib/assert/empty.js +1 -1
- package/lib/assert/equal.js +1 -1
- package/lib/assert/include.js +1 -1
- package/lib/assert/truth.js +1 -1
- package/lib/codecept.js +2 -3
- package/lib/command/configMigrate.js +3 -5
- package/lib/command/definitions.js +1 -2
- package/lib/command/dryRun.js +1 -2
- package/lib/command/gherkin/init.js +1 -1
- package/lib/command/gherkin/snippets.js +3 -3
- package/lib/command/gherkin/steps.js +2 -3
- package/lib/command/info.js +1 -2
- package/lib/command/init.js +1 -1
- package/lib/command/interactive.js +1 -2
- package/lib/command/list.js +3 -4
- package/lib/command/run-multiple.js +2 -3
- package/lib/command/run-rerun.js +2 -4
- package/lib/command/run.js +1 -2
- package/lib/container.js +1 -1
- package/lib/data/context.js +1 -1
- package/lib/event.js +1 -1
- package/lib/helper/Appium.js +1 -2
- package/lib/helper/FileSystem.js +3 -3
- package/lib/helper/Mochawesome.js +1 -1
- package/lib/helper/Nightmare.js +5 -5
- package/lib/helper/Playwright.js +40 -14
- package/lib/helper/Protractor.js +2 -2
- package/lib/helper/WebDriver.js +18 -6
- package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
- package/lib/hooks.js +1 -2
- package/lib/interfaces/gherkin.js +0 -1
- package/lib/listener/helpers.js +1 -2
- package/lib/listener/mocha.js +0 -1
- package/lib/locator.js +2 -2
- package/lib/pause.js +1 -1
- package/lib/plugin/allure.js +1 -1
- package/lib/plugin/autoDelay.js +2 -2
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/standardActingHelpers.js +0 -2
- package/lib/recorder.js +1 -1
- package/package.json +3 -2
- package/translations/fr-FR.js +63 -0
- package/translations/index.js +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 2.6.11
|
|
2
|
+
|
|
3
|
+
* [Playwright] Playwright 1.4 compatibility
|
|
4
|
+
* [Playwright] Added `ignoreHTTPSErrors` config option (default: false). See #2566 by gurjeetbains
|
|
5
|
+
* Added French translation by @vimar
|
|
6
|
+
* [WebDriver] Updated `dragSlider` to work in WebDriver W3C protocol. Fixes #2557 by suniljaiswal01
|
|
7
|
+
|
|
1
8
|
## 2.6.10
|
|
2
9
|
|
|
3
10
|
* Fixed saving options for suite via `Feature('title', {key: value})` by @Diokuz. See #2553 and [Docs](https://codecept.io/advanced/#dynamic-configuration)
|
package/docs/basics.md
CHANGED
|
@@ -213,7 +213,7 @@ I.fillField('password', secret('123456'));
|
|
|
213
213
|
|
|
214
214
|
### Assertions
|
|
215
215
|
|
|
216
|
-
In order to verify the expected behavior of a web application,
|
|
216
|
+
In order to verify the expected behavior of a web application, its content should be checked.
|
|
217
217
|
CodeceptJS provides built-in assertions for that. They start with a `see` (or `dontSee`) prefix.
|
|
218
218
|
|
|
219
219
|
The most general and common assertion is `see`, which checks visilibility of a text on a page:
|
|
@@ -637,6 +637,7 @@ I.see('There were problems creating your account.');
|
|
|
637
637
|
```
|
|
638
638
|
|
|
639
639
|
> ⚠ `within` can cause problems when used incorrectly. If you see a weird behavior of a test try to refactor it to not use `within`. It is recommended to keep within for simplest cases when possible.
|
|
640
|
+
> Since `within` returns a Promise, it may be necessary to `await` the result even when you're not intending to use the return value.
|
|
640
641
|
|
|
641
642
|
`within` can also work with IFrames. A special `frame` locator is required to locate the iframe and get into its context.
|
|
642
643
|
|
package/docs/bdd.md
CHANGED
|
@@ -265,7 +265,7 @@ If we use hashes() with the previous exemple :
|
|
|
265
265
|
Given('I have products in my cart', (table) => { // eslint-disable-line
|
|
266
266
|
//parse the table by header
|
|
267
267
|
const tableByHeader = table.parse().hashes();
|
|
268
|
-
for (const row
|
|
268
|
+
for (const row of tableByHeader) {
|
|
269
269
|
|
|
270
270
|
// take values
|
|
271
271
|
const name = row.name;
|
|
@@ -416,4 +416,3 @@ To run only tests without features use `--tests` option:
|
|
|
416
416
|
```
|
|
417
417
|
npx codeceptjs run --tests
|
|
418
418
|
```
|
|
419
|
-
|
package/docs/build/Appium.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
let webdriverio;
|
|
2
2
|
let wdioV4;
|
|
3
|
-
let SCREEN_SIZE;
|
|
4
3
|
|
|
5
4
|
const fs = require('fs');
|
|
6
5
|
const requireg = require('requireg');
|
|
7
6
|
|
|
8
7
|
const Webdriver = require('./WebDriver');
|
|
9
8
|
const AssertionFailedError = require('../assert/error');
|
|
10
|
-
const truth = require('../assert/truth')
|
|
9
|
+
const { truth } = require('../assert/truth');
|
|
11
10
|
const recorder = require('../recorder');
|
|
12
11
|
const Locator = require('../locator');
|
|
13
12
|
const ConnectionRefused = require('./errors/ConnectionRefused');
|
package/docs/build/FileSystem.js
CHANGED
|
@@ -3,9 +3,9 @@ const path = require('path');
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
|
|
5
5
|
const Helper = require('../helper');
|
|
6
|
-
const fileExists = require('../utils')
|
|
7
|
-
const fileIncludes = require('../assert/include')
|
|
8
|
-
const fileEquals = require('../assert/equal')
|
|
6
|
+
const { fileExists } = require('../utils');
|
|
7
|
+
const { fileIncludes } = require('../assert/include');
|
|
8
|
+
const { fileEquals } = require('../assert/equal');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Helper for testing filesystem.
|
package/docs/build/Nightmare.js
CHANGED
|
@@ -3,11 +3,11 @@ const requireg = require('requireg');
|
|
|
3
3
|
const urlResolve = require('url').resolve;
|
|
4
4
|
|
|
5
5
|
const Helper = require('../helper');
|
|
6
|
-
const stringIncludes = require('../assert/include')
|
|
7
|
-
const urlEquals = require('../assert/equal')
|
|
8
|
-
const equals = require('../assert/equal')
|
|
9
|
-
const empty = require('../assert/empty')
|
|
10
|
-
const truth = require('../assert/truth')
|
|
6
|
+
const { includes: stringIncludes } = require('../assert/include');
|
|
7
|
+
const { urlEquals } = require('../assert/equal');
|
|
8
|
+
const { equals } = require('../assert/equal');
|
|
9
|
+
const { empty } = require('../assert/empty');
|
|
10
|
+
const { truth } = require('../assert/truth');
|
|
11
11
|
const Locator = require('../locator');
|
|
12
12
|
const ElementNotFound = require('./errors/ElementNotFound');
|
|
13
13
|
const {
|
package/docs/build/Playwright.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const requireg = require('requireg');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
const fsExtra = require('fs-extra');
|
|
5
4
|
|
|
6
5
|
const Helper = require('../helper');
|
|
7
6
|
const Locator = require('../locator');
|
|
@@ -11,7 +10,7 @@ const { urlEquals } = require('../assert/equal');
|
|
|
11
10
|
const { equals } = require('../assert/equal');
|
|
12
11
|
const { empty } = require('../assert/empty');
|
|
13
12
|
const { truth } = require('../assert/truth');
|
|
14
|
-
|
|
13
|
+
|
|
15
14
|
const {
|
|
16
15
|
xpathLocator,
|
|
17
16
|
ucfirst,
|
|
@@ -160,7 +159,7 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
|
|
|
160
159
|
* }
|
|
161
160
|
* ```
|
|
162
161
|
*
|
|
163
|
-
* #### Example #6:
|
|
162
|
+
* #### Example #6: Launch tests emulating iPhone 6
|
|
164
163
|
*
|
|
165
164
|
*
|
|
166
165
|
*
|
|
@@ -234,6 +233,7 @@ class Playwright extends Helper {
|
|
|
234
233
|
keepBrowserState: false,
|
|
235
234
|
show: false,
|
|
236
235
|
defaultPopupAction: 'accept',
|
|
236
|
+
ignoreHTTPSErrors: false, // Adding it here o that context can be set up to ignore the SSL errors
|
|
237
237
|
};
|
|
238
238
|
|
|
239
239
|
config = Object.assign(defaults, config);
|
|
@@ -549,7 +549,7 @@ class Playwright extends Helper {
|
|
|
549
549
|
this.browser.on('targetchanged', (target) => {
|
|
550
550
|
this.debugSection('Url', target.url());
|
|
551
551
|
});
|
|
552
|
-
this.browserContext = await this.browser.newContext({ acceptDownloads: true, ...this.options.emulate })
|
|
552
|
+
this.browserContext = await this.browser.newContext({ ignoreHTTPSErrors: this.options.ignoreHTTPSErrors, acceptDownloads: true, ...this.options.emulate });// Adding the HTTPSError ignore in the context so that we can ignore those errors
|
|
553
553
|
|
|
554
554
|
const existingPages = await this.browserContext.pages();
|
|
555
555
|
|
|
@@ -725,7 +725,7 @@ class Playwright extends Helper {
|
|
|
725
725
|
assertElementExists(els);
|
|
726
726
|
|
|
727
727
|
// Use manual mouse.move instead of .hover() so the offset can be added to the coordinates
|
|
728
|
-
const { x, y } = await els[0]
|
|
728
|
+
const { x, y } = await clickablePoint(els[0]);
|
|
729
729
|
await this.page.mouse.move(x + offsetX, y + offsetY);
|
|
730
730
|
return this._waitForAction();
|
|
731
731
|
}
|
|
@@ -813,7 +813,7 @@ class Playwright extends Helper {
|
|
|
813
813
|
const els = await this._locate(locator);
|
|
814
814
|
assertElementExists(els, locator, 'Element');
|
|
815
815
|
await els[0].scrollIntoViewIfNeeded();
|
|
816
|
-
const elementCoordinates = await els[0]
|
|
816
|
+
const elementCoordinates = await clickablePoint(els[0]);
|
|
817
817
|
await this.executeScript((offsetX, offsetY) => window.scrollBy(offsetX, offsetY), { offsetX: elementCoordinates.x + offsetX, offsetY: elementCoordinates.y + offsetY });
|
|
818
818
|
} else {
|
|
819
819
|
await this.executeScript(({ offsetX, offsetY }) => window.scrollTo(offsetX, offsetY), { offsetX, offsetY });
|
|
@@ -2210,8 +2210,8 @@ class Playwright extends Helper {
|
|
|
2210
2210
|
const src = await this._locate(locator);
|
|
2211
2211
|
assertElementExists(src, locator, 'Slider Element');
|
|
2212
2212
|
|
|
2213
|
-
// Note: Using private api
|
|
2214
|
-
const sliderSource = await src[0]
|
|
2213
|
+
// Note: Using clickablePoint private api because the .BoundingBox does not take into account iframe offsets!
|
|
2214
|
+
const sliderSource = await clickablePoint(src[0]);
|
|
2215
2215
|
|
|
2216
2216
|
// Drag start point
|
|
2217
2217
|
await this.page.mouse.move(sliderSource.x, sliderSource.y, { steps: 5 });
|
|
@@ -2892,7 +2892,14 @@ async function proceedClick(locator, context = null, options = {}) {
|
|
|
2892
2892
|
} else {
|
|
2893
2893
|
assertElementExists(els, locator, 'Clickable element');
|
|
2894
2894
|
}
|
|
2895
|
-
|
|
2895
|
+
/*
|
|
2896
|
+
using the force true options itself but instead dispatching a click
|
|
2897
|
+
*/
|
|
2898
|
+
if (options.force) {
|
|
2899
|
+
await els[0].dispatchEvent('click');
|
|
2900
|
+
} else {
|
|
2901
|
+
await els[0].click(options);
|
|
2902
|
+
}
|
|
2896
2903
|
const promises = [];
|
|
2897
2904
|
if (options.waitForNavigation) {
|
|
2898
2905
|
promises.push(this.waitForNavigation());
|
|
@@ -3014,9 +3021,9 @@ async function proceedDragAndDrop(sourceLocator, destinationLocator, options = {
|
|
|
3014
3021
|
const dst = await this._locate(destinationLocator);
|
|
3015
3022
|
assertElementExists(dst, destinationLocator, 'Destination Element');
|
|
3016
3023
|
|
|
3017
|
-
// Note: Using private api
|
|
3018
|
-
const dragSource = await src[0]
|
|
3019
|
-
const dragDestination = await dst[0]
|
|
3024
|
+
// Note: Using clickablePoint private api becaues the .BoundingBox does not take into account iframe offsets!
|
|
3025
|
+
const dragSource = await clickablePoint(src[0]);
|
|
3026
|
+
const dragDestination = await clickablePoint(dst[0]);
|
|
3020
3027
|
|
|
3021
3028
|
// Drag start point
|
|
3022
3029
|
await this.page.mouse.move(dragSource.x, dragSource.y, { steps: 5 });
|
|
@@ -3141,10 +3148,20 @@ function $XPath(element, selector) {
|
|
|
3141
3148
|
async function targetCreatedHandler(page) {
|
|
3142
3149
|
if (!page) return;
|
|
3143
3150
|
this.withinLocator = null;
|
|
3144
|
-
page.on('load', (
|
|
3151
|
+
page.on('load', () => {
|
|
3145
3152
|
page.$('body')
|
|
3146
3153
|
.catch(() => null)
|
|
3147
|
-
.then(context =>
|
|
3154
|
+
.then(async context => {
|
|
3155
|
+
if (this.context._type === 'Frame') {
|
|
3156
|
+
// we are inside iframe?
|
|
3157
|
+
const frameEl = await this.context.frameElement();
|
|
3158
|
+
this.context = await frameEl.contentFrame();
|
|
3159
|
+
return;
|
|
3160
|
+
}
|
|
3161
|
+
// if context element was in iframe - keep it
|
|
3162
|
+
// if (await this.context.ownerFrame()) return;
|
|
3163
|
+
this.context = context;
|
|
3164
|
+
});
|
|
3148
3165
|
});
|
|
3149
3166
|
page.on('console', (msg) => {
|
|
3150
3167
|
this.debugSection(`Browser:${ucfirst(msg.type())}`, (msg._text || '') + msg.args().join(' '));
|
|
@@ -3227,3 +3244,12 @@ function getNormalizedKey(key) {
|
|
|
3227
3244
|
}
|
|
3228
3245
|
return normalizedKey;
|
|
3229
3246
|
}
|
|
3247
|
+
|
|
3248
|
+
async function clickablePoint(el) {
|
|
3249
|
+
const rect = await el.boundingBox();
|
|
3250
|
+
if (!rect) throw new ElementNotFound(el);
|
|
3251
|
+
const {
|
|
3252
|
+
x, y, width, height,
|
|
3253
|
+
} = rect;
|
|
3254
|
+
return { x: x + width / 2, y: y + height / 2 };
|
|
3255
|
+
}
|
package/docs/build/Protractor.js
CHANGED
|
@@ -10,8 +10,8 @@ const requireg = require('requireg');
|
|
|
10
10
|
const Helper = require('../helper');
|
|
11
11
|
const stringIncludes = require('../assert/include').includes;
|
|
12
12
|
const { urlEquals, equals } = require('../assert/equal');
|
|
13
|
-
const empty = require('../assert/empty')
|
|
14
|
-
const truth = require('../assert/truth')
|
|
13
|
+
const { empty } = require('../assert/empty');
|
|
14
|
+
const { truth } = require('../assert/truth');
|
|
15
15
|
const {
|
|
16
16
|
xpathLocator,
|
|
17
17
|
fileExists,
|
package/docs/build/WebDriver.js
CHANGED
|
@@ -2527,12 +2527,24 @@ class WebDriver extends Helper {
|
|
|
2527
2527
|
|
|
2528
2528
|
// for chrome
|
|
2529
2529
|
if (browser.isW3C) {
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2530
|
+
const xOffset = await this.grabElementBoundingRect(locator, 'x');
|
|
2531
|
+
const yOffset = await this.grabElementBoundingRect(locator, 'y');
|
|
2532
|
+
|
|
2533
|
+
return browser.performActions([{
|
|
2534
|
+
type: 'pointer',
|
|
2535
|
+
id: 'pointer1',
|
|
2536
|
+
parameters: { pointerType: 'mouse' },
|
|
2537
|
+
actions: [
|
|
2538
|
+
{
|
|
2539
|
+
type: 'pointerMove', origin: 'pointer', duration: 1000, x: xOffset, y: yOffset,
|
|
2540
|
+
},
|
|
2541
|
+
{ type: 'pointerDown', button: 0 },
|
|
2542
|
+
{
|
|
2543
|
+
type: 'pointerMove', origin: 'pointer', duration: 1000, x: offsetX, y: 0,
|
|
2544
|
+
},
|
|
2545
|
+
{ type: 'pointerUp', button: 0 },
|
|
2546
|
+
],
|
|
2547
|
+
},
|
|
2536
2548
|
]);
|
|
2537
2549
|
}
|
|
2538
2550
|
|