Skip to content

Commit

Permalink
Merge pull request #26 from zymotik/master
Browse files Browse the repository at this point in the history
Remove deprecated Nightwatch 'client.assertion' reference
  • Loading branch information
msteitle authored Dec 6, 2018
2 parents 397960f + 6b96c75 commit 65b2776
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
24 changes: 4 additions & 20 deletions commands/captureElementScreenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ CaptureElementScreenshot.prototype.command = function command(
});

if (width === 0 || height === 0) {
this.client.assertion(
false,
null,
null,
`The element identified by the selector <${selector}> is not visible or its dimensions equals 0. width: ${width}, height: ${height}`, // eslint-disable-line max-len
true
)
this.api.assert.fail(`The element identified by the selector <${selector}> is not visible or its dimensions equals 0. width: ${width}, height: ${height}`) // eslint-disable-line max-len);
}

Jimp.read(new Buffer(screenshotEncoded, 'base64')).then((screenshot) => {
Expand All @@ -76,24 +70,14 @@ CaptureElementScreenshot.prototype.command = function command(
}

screenshot.crop(x, y, width, height)
this.client.assertion(
true,
null,
null,
`The screenshot for selector <${selector}> was captured successfully.`,
true
)

this.api.assert.ok(true, `The screenshot for selector <${selector}> was captured successfully.`);

callback(screenshot)
this.emit('complete', screenshot)
})
}).catch((errorMessage) => {
this.client.assertion(
false,
'success',
errorMessage,
`The screenshot for selector <${selector}> could not be captured.`
)
this.api.assert.fail(`The screenshot for selector <${selector}> could not be captured.`);
this.emit('complete', errorMessage, this)
})
}
Expand Down
2 changes: 1 addition & 1 deletion demo/nightwatch.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const REPORTS_PATH = path.join(__dirname, 'reports', 'e2e')
const SCREENSHOT_PATH = path.join(__dirname, 'reports', 'screenshots')
const BINPATH = path.join(process.cwd(), 'node_modules', 'nightwatch', 'bin')

const SELENIUM_VERSION = '3.5.2' // https://selenium-release.storage.googleapis.com/index.html
const SELENIUM_VERSION = '3.5.1' // https://selenium-release.storage.googleapis.com/index.html
const SELENIUM_PATH = path.join(BINPATH, 'selenium-server', SELENIUM_VERSION + '-' + 'server.jar')
const CHROME_DRIVER_VERSION = '2.31' // https://chromedriver.storage.googleapis.com/index.html
const CHROME_PATH = path.join(BINPATH, 'chromedriver', CHROME_DRIVER_VERSION + '-' + process.arch + '-' + 'chromedriver')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"eslint-plugin-react": "^7.3.0",
"http-server": "^0.10.0",
"jest": "^20.0.4",
"nightwatch": "^0.9.16",
"nightwatch": "^1.0.14",
"npm-run-all": "^4.0.2",
"phantomjs-prebuilt": "^2.1.15",
"rimraf": "^2.6.1",
Expand Down

0 comments on commit 65b2776

Please sign in to comment.