Skip to content

Commit 53c1d2c

Browse files
committed
fix: Check existence earlier, than other characteristics like focused
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.
1 parent 14c4723 commit 53c1d2c

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

INSTRUCTIONS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ One of the instructions has to be present in every command. These properties are
2828
- [hasText](#hastext)
2929
- [hasInnerHtml](#hasinnerhtml)
3030
- [hasOuterHtml](#hasouterhtml)
31-
- [isEnabled](#isenabled)
3231
- [isExisting](#isexisting)
33-
- [isFocused](#isfocused)
34-
- [isSelected](#isselected)
3532
- [isVisible](#isvisible)
3633
- [isVisibleWithinViewport](#isvisiblewithinviewport)
37-
- [isNotEnabled](#isnotenabled)
34+
- [isEnabled](#isenabled)
35+
- [isSelected](#isselected)
36+
- [isFocused](#isfocused)
3837
- [isNotExisting](#isnotexisting)
39-
- [isNotFocused](#isnotfocused)
40-
- [isNotSelected](#isnotselected)
4138
- [isNotVisible](#isnotvisible)
4239
- [isNotVisibleWithinViewport](#isnotvisiblewithinviewport)
40+
- [isNotEnabled](#isnotenabled)
41+
- [isNotSelected](#isnotselected)
42+
- [isNotFocused](#isnotfocused)
4343
- [break](#break)
4444
- [abort](#abort)
4545
- [file](#file)

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,18 @@ One of the [instructions] has to be present in every command, otherwise its exec
303303
* [hasText](INSTRUCTIONS.md#hastext)
304304
* [hasInnerHtml](INSTRUCTIONS.md#hasinnerhtml)
305305
* [hasOuterHtml](INSTRUCTIONS.md#hasouterhtml)
306-
* [isEnabled](INSTRUCTIONS.md#isenabled)
307306
* [isExisting](INSTRUCTIONS.md#isexisting)
308-
* [isFocused](INSTRUCTIONS.md#isfocused)
309-
* [isSelected](INSTRUCTIONS.md#isselected)
310307
* [isVisible](INSTRUCTIONS.md#isvisible)
311308
* [isVisibleWithinViewport](INSTRUCTIONS.md#isvisiblewithinviewport)
312-
* [isNotEnabled](INSTRUCTIONS.md#isnotenabled)
309+
* [isEnabled](INSTRUCTIONS.md#isenabled)
310+
* [isSelected](INSTRUCTIONS.md#isselected)
311+
* [isFocused](INSTRUCTIONS.md#isfocused)
313312
* [isNotExisting](INSTRUCTIONS.md#isnotexisting)
314-
* [isNotFocused](INSTRUCTIONS.md#isnotfocused)
315-
* [isNotSelected](INSTRUCTIONS.md#isnotselected)
316313
* [isNotVisible](INSTRUCTIONS.md#isnotvisible)
317314
* [isNotVisibleWithinViewport](INSTRUCTIONS.md#isnotvisiblewithinviewport)
315+
* [isNotEnabled](INSTRUCTIONS.md#isnotenabled)
316+
* [isNotSelected](INSTRUCTIONS.md#isnotselected)
317+
* [isNotFocused](INSTRUCTIONS.md#isnotfocused)
318318
* [break](INSTRUCTIONS.md#break)
319319
* [abort](INSTRUCTIONS.md#abort)
320320
* [file](INSTRUCTIONS.md#file)

tasks/html-dom-snapshot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const instructionKeys = [
1212
'addValue', 'selectOptionByIndex', 'selectOptionByValue', 'moveCursor',
1313
'click', 'clickIfVisible', 'keys', 'elementSendKeys', 'wait', 'hasAttribute',
1414
'hasClass', 'hasValue', 'hasText', 'hasInnerHtml', 'hasOuterHtml',
15-
'isEnabled', 'isExisting', 'isFocused', 'isSelected', 'isVisible',
16-
'isVisibleWithinViewport', 'isNotEnabled', 'isNotExisting',
17-
'isNotFocused', 'isNotSelected', 'isNotVisible',
18-
'isNotVisibleWithinViewport', 'break', 'abort'
15+
'isExisting', 'isVisible', 'isVisibleWithinViewport', 'isEnabled',
16+
'isSelected', 'isFocused', 'isNotExisting', 'isNotVisible',
17+
'isNotVisibleWithinViewport', 'isNotEnabled', 'isNotFocused',
18+
'isNotSelected', 'break', 'abort'
1919
]
2020
const instructions = instructionKeys.map(instruction =>
2121
require('./instructions/' + instruction))

0 commit comments

Comments
 (0)