Skip to content

Commit

Permalink
fix: Check existence earlier, than other characteristics like focused
Browse files Browse the repository at this point in the history
BREAKING CHANGE: If more "is*" instructions are used, the order has been changed to prevent unnecessary blocks. Earlier, visibility was checked before other features, which could confuse the error reporting. The new order of evaluation of "is*" instruction reflects their importance. The instructions can be put to a single block, evaluated in the "natural" order and fail with the most important condition:

 * isExisting
 * isVisible
 * isVisibleWithinViewport
 * isEnabled
 * isSelected
 * isFocused
 * isNotExisting
 * isNotVisible
 * isNotVisibleWithinViewport
 * isNotEnabled
 * isNotFocused

This is very unlikely to break anything in real-world commands, but still, better to be sure.
  • Loading branch information
prantlf committed Oct 8, 2019
1 parent 14c4723 commit 53c1d2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ One of the instructions has to be present in every command. These properties are
- [hasText](#hastext)
- [hasInnerHtml](#hasinnerhtml)
- [hasOuterHtml](#hasouterhtml)
- [isEnabled](#isenabled)
- [isExisting](#isexisting)
- [isFocused](#isfocused)
- [isSelected](#isselected)
- [isVisible](#isvisible)
- [isVisibleWithinViewport](#isvisiblewithinviewport)
- [isNotEnabled](#isnotenabled)
- [isEnabled](#isenabled)
- [isSelected](#isselected)
- [isFocused](#isfocused)
- [isNotExisting](#isnotexisting)
- [isNotFocused](#isnotfocused)
- [isNotSelected](#isnotselected)
- [isNotVisible](#isnotvisible)
- [isNotVisibleWithinViewport](#isnotvisiblewithinviewport)
- [isNotEnabled](#isnotenabled)
- [isNotSelected](#isnotselected)
- [isNotFocused](#isnotfocused)
- [break](#break)
- [abort](#abort)
- [file](#file)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,18 @@ One of the [instructions] has to be present in every command, otherwise its exec
* [hasText](INSTRUCTIONS.md#hastext)
* [hasInnerHtml](INSTRUCTIONS.md#hasinnerhtml)
* [hasOuterHtml](INSTRUCTIONS.md#hasouterhtml)
* [isEnabled](INSTRUCTIONS.md#isenabled)
* [isExisting](INSTRUCTIONS.md#isexisting)
* [isFocused](INSTRUCTIONS.md#isfocused)
* [isSelected](INSTRUCTIONS.md#isselected)
* [isVisible](INSTRUCTIONS.md#isvisible)
* [isVisibleWithinViewport](INSTRUCTIONS.md#isvisiblewithinviewport)
* [isNotEnabled](INSTRUCTIONS.md#isnotenabled)
* [isEnabled](INSTRUCTIONS.md#isenabled)
* [isSelected](INSTRUCTIONS.md#isselected)
* [isFocused](INSTRUCTIONS.md#isfocused)
* [isNotExisting](INSTRUCTIONS.md#isnotexisting)
* [isNotFocused](INSTRUCTIONS.md#isnotfocused)
* [isNotSelected](INSTRUCTIONS.md#isnotselected)
* [isNotVisible](INSTRUCTIONS.md#isnotvisible)
* [isNotVisibleWithinViewport](INSTRUCTIONS.md#isnotvisiblewithinviewport)
* [isNotEnabled](INSTRUCTIONS.md#isnotenabled)
* [isNotSelected](INSTRUCTIONS.md#isnotselected)
* [isNotFocused](INSTRUCTIONS.md#isnotfocused)
* [break](INSTRUCTIONS.md#break)
* [abort](INSTRUCTIONS.md#abort)
* [file](INSTRUCTIONS.md#file)
Expand Down
8 changes: 4 additions & 4 deletions tasks/html-dom-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const instructionKeys = [
'addValue', 'selectOptionByIndex', 'selectOptionByValue', 'moveCursor',
'click', 'clickIfVisible', 'keys', 'elementSendKeys', 'wait', 'hasAttribute',
'hasClass', 'hasValue', 'hasText', 'hasInnerHtml', 'hasOuterHtml',
'isEnabled', 'isExisting', 'isFocused', 'isSelected', 'isVisible',
'isVisibleWithinViewport', 'isNotEnabled', 'isNotExisting',
'isNotFocused', 'isNotSelected', 'isNotVisible',
'isNotVisibleWithinViewport', 'break', 'abort'
'isExisting', 'isVisible', 'isVisibleWithinViewport', 'isEnabled',
'isSelected', 'isFocused', 'isNotExisting', 'isNotVisible',
'isNotVisibleWithinViewport', 'isNotEnabled', 'isNotFocused',
'isNotSelected', 'break', 'abort'
]
const instructions = instructionKeys.map(instruction =>
require('./instructions/' + instruction))
Expand Down

0 comments on commit 53c1d2c

Please sign in to comment.