Comparing version 4.5.0 to 4.6.0
# Changelog | ||
## 4.6.0 (2017-01-30) | ||
* Add negation to the "wait for..." actions | ||
## 4.5.0 (2017-01-25) | ||
@@ -5,0 +9,0 @@ |
@@ -139,6 +139,7 @@ 'use strict'; | ||
name: 'wait-for-url', | ||
match: /^wait for (fragment|hash|path|url)( to be)? (.+)$/i, | ||
match: /^wait for (fragment|hash|path|url)( to (not )?be)? (.+)$/i, | ||
build: function(browser, page, options, matches) { | ||
var actionOptions = { | ||
expectedValue: matches[3], | ||
expectedValue: matches[4], | ||
negated: matches[3] !== undefined, | ||
subject: matches[1] | ||
@@ -166,3 +167,3 @@ }; | ||
options.log.debug(' … waiting ("' + result + '")'); | ||
if (result === actionOptions.expectedValue) { | ||
if ((result === actionOptions.expectedValue) === !actionOptions.negated) { | ||
done(); | ||
@@ -169,0 +170,0 @@ } else { |
{ | ||
"name": "pa11y", | ||
"version": "4.5.0", | ||
"version": "4.6.0", | ||
"description": "Pa11y is your automated accessibility testing pal", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -612,3 +612,3 @@ | ||
'wait for fragment to be #page-2', | ||
'wait for path to be /login', | ||
'wait for path to not be /login', | ||
'wait for url to be https://example.com/' | ||
@@ -660,7 +660,10 @@ ] | ||
This allows you to pause the test until a condition is met, and the page has either a given fragment, path, or URL. This will wait until Pa11y times out so it should be used after another action that would trigger the change in state. This action takes one of the forms: | ||
This allows you to pause the test until a condition is met, and the page has either a given fragment, path, or URL. This will wait until Pa11y times out so it should be used after another action that would trigger the change in state. You can also wait until the page does **not** have a given fragment, path, or URL using the `to not be` syntax. This action takes one of the forms: | ||
- `wait for fragment to be <fragment>` (including the preceeding `#`) | ||
- `wait for path to be <path>` (including the preceeding `/`) | ||
- `wait for fragment to be <fragment>` (including the preceding `#`) | ||
- `wait for fragment to not be <fragment>` (including the preceding `#`) | ||
- `wait for path to be <path>` (including the preceding `/`) | ||
- `wait for path to not be <path>` (including the preceding `/`) | ||
- `wait for url to be <url>` | ||
- `wait for url to not be <url>` | ||
@@ -667,0 +670,0 @@ E.g. |
@@ -741,2 +741,3 @@ /* eslint-disable one-var, max-len, max-statements */ | ||
undefined, | ||
undefined, | ||
'#foo' | ||
@@ -748,2 +749,3 @@ ]); | ||
' to be', | ||
undefined, | ||
'#foo' | ||
@@ -755,2 +757,3 @@ ]); | ||
' to be', | ||
undefined, | ||
'#foo' | ||
@@ -762,2 +765,3 @@ ]); | ||
' to be', | ||
undefined, | ||
'/foo' | ||
@@ -769,4 +773,33 @@ ]); | ||
' to be', | ||
undefined, | ||
'https://example.com/' | ||
]); | ||
assert.deepEqual('wait for fragment to not be #bar'.match(action.match), [ | ||
'wait for fragment to not be #bar', | ||
'fragment', | ||
' to not be', | ||
'not ', | ||
'#bar' | ||
]); | ||
assert.deepEqual('wait for hash to not be #bar'.match(action.match), [ | ||
'wait for hash to not be #bar', | ||
'hash', | ||
' to not be', | ||
'not ', | ||
'#bar' | ||
]); | ||
assert.deepEqual('wait for path to not be /sso/login'.match(action.match), [ | ||
'wait for path to not be /sso/login', | ||
'path', | ||
' to not be', | ||
'not ', | ||
'/sso/login' | ||
]); | ||
assert.deepEqual('wait for url to not be https://example.com/login'.match(action.match), [ | ||
'wait for url to not be https://example.com/login', | ||
'url', | ||
' to not be', | ||
'not ', | ||
'https://example.com/login' | ||
]); | ||
}); | ||
@@ -813,3 +846,4 @@ | ||
assert.deepEqual(page.evaluate.firstCall.args[1], { | ||
expectedValue: matches[3], | ||
expectedValue: matches[4], | ||
negated: false, | ||
subject: matches[1] | ||
@@ -899,2 +933,22 @@ }); | ||
describe('handles negation appropriately', function() { | ||
beforeEach(function(done) { | ||
page.evaluate.reset(); | ||
matches = 'wait for url to not be https://portal.com/login'.match(action.match); | ||
returnedValue = action.build({}, page, options, matches); | ||
returnedValue(done); | ||
}); | ||
it('checks for inequality if match string contains `to not be`', function() { | ||
assert.called(page.evaluate); | ||
assert.deepEqual(page.evaluate.firstCall.args[1], { | ||
expectedValue: 'https://portal.com/login', | ||
negated: true, | ||
subject: 'url' | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -901,0 +955,0 @@ |
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
293912
3768
907