codeceptjs
Advanced tools
Comparing version 1.4.5 to 1.4.6
@@ -122,2 +122,3 @@ #!/usr/bin/env node | ||
.option('-f, --fgrep <string>', 'only run tests containing <string>') | ||
.option('-i, --invert', 'inverts --grep and --fgrep matches') | ||
.option('--steps', 'show step-by-step execution') | ||
@@ -124,0 +125,0 @@ .option('--verbose', 'output internal logging information') |
@@ -1,13 +0,21 @@ | ||
## 1.4.5 | ||
## 1.4.6 | ||
* Add **require** param to main config. Allows to require Node modules before executing tests. By @LukoyanovE | ||
* [Puppeteer] `dragSlider` action added by @PeterNgTr | ||
* [Puppeteer] Fixed opening browser in shell mode by @allenhwkim | ||
* [Puppeteer] Fixed making screenshot on additional sessions by @PeterNgTr. Fixes [#1266](https://github.com/Codeception/CodeceptJS/issues/1266) | ||
* Added `--invert` option to `run-multiple` command by @LukoyanovE | ||
* Fixed steps in Allure reports by @PeterNgTr | ||
* Add option `output` to customize output directory in [stepByStepReport plugin](https://codecept.io/plugins/#stepbystepreport). By @fpsthirty | ||
* Changed type definition of PageObjects to get auto completion by @rhicu | ||
* Fixed steps output for async/arrow functions in CLI by @LukoyanovE. See [#1329](https://github.com/Codeception/CodeceptJS/pull/1329) | ||
Example (`codecept.json`): | ||
## 1.4.5 | ||
```js | ||
"require": ["ts-node/register", "should"] | ||
``` | ||
* Add **require** param to main config. Allows to require Node modules before executing tests. By @LukoyanovE. For example: | ||
* Use `ts-node/register` to register TypeScript parser | ||
* Use `should` to register should-style assertions | ||
* Uses `ts-node/register` to register TypeScript parser | ||
* Uses `should` to register should-style assertions | ||
```js | ||
"require": ["ts-node/register", "should"] | ||
``` | ||
@@ -14,0 +22,0 @@ * [WebDriverIO] Fix timeouts definition to be compatible with W3C drivers. By @LukoyanovE |
@@ -469,2 +469,19 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
### dragSlider | ||
Drag the scrubber of a slider to a given position | ||
For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. | ||
```js | ||
I.dragSlider('#slider', 30); | ||
I.dragSlider('#slider', -70); | ||
``` | ||
#### Parameters | ||
- `locator` | ||
- `offsetX` (optional, default `0`) | ||
- `field` located by label|name|CSS|XPath|strict locator. | ||
- `value` position to drag. | ||
### executeAsyncScript | ||
@@ -471,0 +488,0 @@ |
@@ -172,2 +172,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- `fullPageScreenshots`: should full page screenshots be used. Default: false. | ||
- `output`: a directory where reports should be stored. Default: `output`. | ||
@@ -174,0 +175,0 @@ ##### Allure Reports |
@@ -108,3 +108,5 @@ # QuickStart | ||
### Next: [CodeceptJS Basics >>>](https://codecept.io/basics/) | ||
### Next: [Demo Project](https://github.com/DavertMik/codeceptjs-todomvc-puppeteer) | ||
--- | ||
@@ -111,0 +113,0 @@ |
@@ -181,3 +181,3 @@ const getConfig = require('./utils').getConfig; | ||
if (name === 'I') continue; | ||
callbackParams.push(`${name}:any`); | ||
callbackParams.push(`${name}:CodeceptJS.${name}`); | ||
const pageObject = supports[name]; | ||
@@ -184,0 +184,0 @@ const pageMethods = addAllMethodsInObject(pageObject, {}, []); |
@@ -17,3 +17,3 @@ const { | ||
const childOpts = {}; | ||
const copyOptions = ['override', 'steps', 'reporter', 'verbose', 'config', 'reporter-options', 'grep', 'fgrep', 'debug', 'plugins']; | ||
const copyOptions = ['override', 'steps', 'reporter', 'verbose', 'config', 'reporter-options', 'grep', 'fgrep', 'invert', 'debug', 'plugins']; | ||
let overrides = {}; | ||
@@ -20,0 +20,0 @@ |
@@ -1303,2 +1303,23 @@ const requireg = require('requireg'); | ||
/** | ||
* {{> ../webapi/dragSlider }} | ||
*/ | ||
async dragSlider(locator, offsetX = 0) { | ||
const src = await this._locate(locator); | ||
assertElementExists(src, locator, 'Slider Element'); | ||
// Note: Using private api ._clickablePoint because the .BoundingBox does not take into account iframe offsets! | ||
const sliderSource = await src[0]._clickablePoint(); | ||
// Drag start point | ||
await this.page.mouse.move(sliderSource.x, sliderSource.y, { steps: 5 }); | ||
await this.page.mouse.down(); | ||
// Drag destination | ||
await this.page.mouse.move(sliderSource.x + offsetX, sliderSource.y, { steps: 5 }); | ||
await this.page.mouse.up(); | ||
await this._waitForAction(); | ||
} | ||
/** | ||
* {{> ../webapi/grabAttributeFrom }} | ||
@@ -1320,2 +1341,6 @@ */ | ||
this.debug(`Screenshot is saving to ${outputFile}`); | ||
const openSessions = await this.browser.pages(); | ||
if (openSessions.length > 1) { | ||
this.page = await this.browser.targets()[this.browser.targets().length - 1].page(); | ||
} | ||
return this.page.screenshot({ path: outputFile, fullPage: fullPageOption, type: 'png' }); | ||
@@ -1322,0 +1347,0 @@ } |
@@ -16,3 +16,3 @@ const event = require('../event'); | ||
function enableDynamicConfigFor(type) { | ||
event.dispatcher.on(event[type].before, (context) => { | ||
event.dispatcher.on(event[type].before, (context = {}) => { | ||
function updateHelperConfig(helper, config) { | ||
@@ -19,0 +19,0 @@ const oldConfig = Object.assign({}, helper.options); |
@@ -80,5 +80,11 @@ const colors = require('chalk'); | ||
if (!step) return; | ||
// Avoid to print non-gherkin steps, when gherkin is running for --steps mode | ||
if (outputLevel === 1) { | ||
if (!step.isMetaStep() && step.hasBDDAncestor()) { | ||
return; | ||
} | ||
} | ||
let stepLine = step.toString(); | ||
if (step.metaStep) { | ||
if (outputLevel < 2) return; | ||
if (step.metaStep && outputLevel >= 2) { | ||
this.stepShift += 2; | ||
@@ -85,0 +91,0 @@ stepLine = colors.green(truncate(stepLine, this.spaceShift)); |
@@ -95,9 +95,9 @@ const event = require('../event'); | ||
event.dispatcher.on(event.step.started, (step) => { | ||
if (!step.metaStep && currentStep) { | ||
if (step.metaStep && (step.metaStep.actor.index('Context')) !== -1) { | ||
startMetaStep(step.metaStep); | ||
if (currentStep !== step) { | ||
reporter.startStep(step.toString()); | ||
currentStep = step; | ||
} | ||
} | ||
if (currentStep !== step) { | ||
reporter.startStep(step.toString()); | ||
currentStep = step; | ||
} | ||
}); | ||
@@ -104,0 +104,0 @@ |
@@ -25,2 +25,3 @@ const Container = require('../container'); | ||
fullPageScreenshots: false, | ||
output: global.output_dir, | ||
}; | ||
@@ -60,2 +61,3 @@ | ||
* * `fullPageScreenshots`: should full page screenshots be used. Default: false. | ||
* * `output`: a directory where reports should be stored. Default: `output`. | ||
* | ||
@@ -91,5 +93,6 @@ * ##### Allure Reports | ||
const pad = '0000'; | ||
const reportDir = config.output ? path.resolve(global.codecept_dir, config.output) : defaultConfig.output; | ||
event.dispatcher.on(event.test.before, (test) => { | ||
dir = path.join(global.output_dir, `record_${clearString(test.title).substring(0, 20)}_${uuid}`); | ||
dir = path.join(reportDir, `record_${clearString(test.title).substring(0, 20)}_${uuid}`); | ||
mkdirp.sync(dir); | ||
@@ -133,5 +136,5 @@ stepNum = 0; | ||
fs.writeFileSync(path.join(global.output_dir, 'records.html'), indexHTML); | ||
fs.writeFileSync(path.join(reportDir, 'records.html'), indexHTML); | ||
output.print(`${figures.circleFilled} Step-by-step preview: ${colors.white.bold(`file://${global.output_dir}/records.html`)}`); | ||
output.print(`${figures.circleFilled} Step-by-step preview: ${colors.white.bold(`file://${reportDir}/records.html`)}`); | ||
}); | ||
@@ -146,3 +149,3 @@ | ||
slides[fileName] = step; | ||
await helper.saveScreenshot(path.relative(global.output_dir, path.join(dir, fileName)), config.fullPageScreenshots); | ||
await helper.saveScreenshot(path.relative(reportDir, path.join(dir, fileName)), config.fullPageScreenshots); | ||
} catch (err) { | ||
@@ -193,3 +196,3 @@ output.plugin(`Can't save step screenshot: ${err}`); | ||
fs.writeFileSync(index, html); | ||
recordedTests[`${test.parent.title}: ${test.title}`] = path.relative(global.output_dir, index); | ||
recordedTests[`${test.parent.title}: ${test.title}`] = path.relative(reportDir, index); | ||
} | ||
@@ -196,0 +199,0 @@ |
@@ -103,2 +103,18 @@ const STACK_LINE = 4; | ||
} | ||
hasBDDAncestor() { | ||
let hasBDD = false; | ||
let processingStep; | ||
processingStep = this; | ||
while (processingStep.metaStep) { | ||
if (processingStep.metaStep.actor.match(/^(Given|When|Then|And)/)) { | ||
hasBDD = true; | ||
break; | ||
} else { | ||
processingStep = processingStep.metaStep; | ||
} | ||
} | ||
return hasBDD; | ||
} | ||
} | ||
@@ -105,0 +121,0 @@ |
{ | ||
"name": "codeceptjs", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "Modern Era Acceptance Testing Framework for NodeJS", | ||
@@ -60,3 +60,3 @@ "keywords": [ | ||
"@types/inquirer": "^0.0.35", | ||
"@types/node": "^8.10.29", | ||
"@types/node": "^8.10.37", | ||
"chai": "^3.4.1", | ||
@@ -77,3 +77,3 @@ "chai-as-promised": "^5.2.0", | ||
"protractor": "^5.4.1", | ||
"puppeteer": "^1.8.0", | ||
"puppeteer": "^1.10.0", | ||
"rosie": "^1.6.0", | ||
@@ -80,0 +80,0 @@ "sinon": "^1.17.2", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1229222
214
24939