hermione-assert-view-extended
Advanced tools
Comparing version 0.2.0 to 1.0.0
22
index.js
'use strict'; | ||
module.exports = (hermione, opts = {}) => { | ||
const commands = opts.commands || {}; | ||
const hooks = opts.hooks || {}; | ||
const globalStyles = opts.globalStyles || {}; | ||
@@ -54,14 +54,14 @@ const globalExecute = opts.globalExecute || {}; | ||
if (globalExecute.before) { | ||
globalExecute.before = normalizeExecute(globalExecute.before); | ||
beforeExecute = globalExecute.before[0].bind(null, ...globalExecute.before.splice(1)); | ||
if (globalExecute.beforeEach) { | ||
globalExecute.beforeEach = normalizeExecute(globalExecute.beforeEach); | ||
beforeExecute = globalExecute.beforeEach[0].bind(null, ...globalExecute.beforeEach.splice(1)); | ||
} | ||
if (globalExecute.after) { | ||
globalExecute.after = normalizeExecute(globalExecute.after); | ||
afterExecute = globalExecute.after[0].bind(null, ...globalExecute.after.splice(1)); | ||
if (globalExecute.afterEach) { | ||
globalExecute.afterEach = normalizeExecute(globalExecute.afterEach); | ||
afterExecute = globalExecute.afterEach[0].bind(null, ...globalExecute.afterEach.splice(1)); | ||
} | ||
if (commands.before && typeof commands.before.call !== 'undefined') { | ||
await browser.then(() => commands.before.call({ browser }, name, selector, options)); | ||
if (hooks.beforeEach && typeof hooks.beforeEach.call !== 'undefined') { | ||
await browser.then(() => hooks.beforeEach.call({ browser }, name, selector, options)); | ||
} | ||
@@ -99,4 +99,4 @@ | ||
if (commands.after && typeof commands.after.call !== 'undefined') { | ||
await browser.then(() => commands.after.call({ browser }, name, selector, options)); | ||
if (hooks.afterEach && typeof hooks.afterEach.call !== 'undefined') { | ||
await browser.then(() => hooks.afterEach.call({ browser }, name, selector, options)); | ||
} | ||
@@ -103,0 +103,0 @@ }, true); |
{ | ||
"name": "hermione-assert-view-extended", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "Hermione plugin for extend assertView command.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,7 +16,7 @@ # hermione-assert-view-extended | ||
{ | ||
commands: { | ||
before: function(name, selector, options) { | ||
hooks: { | ||
beforeEach: function(name, selector, options) { | ||
return this.browser.moveTo(0, 0); | ||
}, | ||
after: function(name, selector, options) { | ||
afterEach: function(name, selector, options) { | ||
console.log(`Asserted view '${name}' for '${selector}' selector.`); | ||
@@ -43,3 +43,3 @@ } | ||
globalExecute: { | ||
before: [ | ||
beforeEach: [ | ||
function(message) { | ||
@@ -50,3 +50,3 @@ alert(message); | ||
], | ||
after: function() { | ||
afterEach: function() { | ||
alert('Bye bye!'); | ||
@@ -62,5 +62,5 @@ } | ||
| --- | --- | --- | | ||
| `commands` | | Hermione commands which will be called before/after call assertView in `then()`. | | ||
| `commands.before` | | Hermione commands which will be called before call assertView and first inner execute. | | ||
| `commands.after` | | Hermione commands which will be called after call assertView and last inner execute. | | ||
| `hooks` | | Hermione commands which will be called before/after call assertView in `then()`. | | ||
| `hooks.beforeEach` | | Hermione commands which will be called before call assertView and first inner execute. | | ||
| `hooks.afterEach` | | Hermione commands which will be called after call assertView and last inner execute. | | ||
| `globalStyles` | | CSS injection appended in `<head>` before call assertView. It will be removed after call assertView. | | ||
@@ -73,4 +73,4 @@ | `globalStyles.animationDisable` | `false` | Disable CSS animation (`transition-duration: 0s`, `animation-duration: 0s`, etc.). | | ||
| `globalExecute` | | Scripts executed before/after call assertView in the inner execut with other manipulation. | | ||
| `globalExecute.before` | | JS function executed before call assertView. | | ||
| `globalExecute.after` | | JS function executed after call assertView. | | ||
| `globalExecute.beforeEach` | | JS function executed before call assertView. | | ||
| `globalExecute.afterEach` | | JS function executed after call assertView. | | ||
@@ -77,0 +77,0 @@ ## Licence |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9448
1