1 | * [the "\_\_\_" should be enabled](the-"\_\_\_"-should-be-enabled)
|
2 | * [regex](regex)
|
3 | * [execution](execution)
|
4 | * [with enabled button](with-enabled-button)
|
5 | * [with disabled button](with-disabled-button)
|
6 | * [timing](timing)
|
7 | # the "\_\_\_" should be enabled
|
8 | ## regex
|
9 | regex should match 'the "\_\_\_" button...'
|
10 |
|
11 | ```
|
12 | verifyStepMatch('the "Save Configuration" button should be enabled');
|
13 | ```
|
14 |
|
15 |
|
16 | regex should match 'the "\_\_\_" field...'
|
17 |
|
18 | ```
|
19 | verifyStepMatch('the "Username" field should be enabled');
|
20 | ```
|
21 |
|
22 |
|
23 | regex should match 'the "\_\_\_" drop down list...'
|
24 |
|
25 | ```
|
26 | verifyStepMatch('the "Timezone" drop down list should be enabled');
|
27 | ```
|
28 |
|
29 |
|
30 | regex should match a step without an element type
|
31 |
|
32 | ```
|
33 | verifyStepMatch('the "Save Button" should be enabled');
|
34 | ```
|
35 |
|
36 |
|
37 | regex should match '...should be enabled'
|
38 |
|
39 | ```
|
40 | verifyStepMatch('the "Save Configuration" button should be enabled');
|
41 | ```
|
42 |
|
43 |
|
44 | regex should match '...should not be enabled'
|
45 |
|
46 | ```
|
47 | verifyStepMatch('the "Save Configuration" button should not be enabled');
|
48 | ```
|
49 |
|
50 |
|
51 | regex should capture the element name, element type, and the expectation
|
52 |
|
53 | ```
|
54 | verifyStepCaptures('the "Save Configuration" button should be enabled', 'Save Configuration', ' button', 'should');
|
55 | ```
|
56 |
|
57 |
|
58 | regex should capture the element name, the expectation, and a blank string if no element type is provided
|
59 |
|
60 | ```
|
61 | verifyStepCaptures('the "Save Configuration Button" should be enabled', 'Save Configuration Button', '', 'should');
|
62 | ```
|
63 |
|
64 |
|
65 | ## execution
|
66 | ### with enabled button
|
67 | with enabled button should succeed if it expects the button to be enabled
|
68 |
|
69 | ```
|
70 | return executeStep('the "Test" button should be enabled', function() {
|
71 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
72 | });
|
73 | ```
|
74 |
|
75 |
|
76 | with enabled button should fail if it expects the button to be disabled
|
77 |
|
78 | ```
|
79 | return executeStep('the "Test" button should not be enabled', function() {
|
80 | expect(currentStepResult.status).to.equal(Cucumber.Status.FAILED);
|
81 | });
|
82 | ```
|
83 |
|
84 |
|
85 | ### with disabled button
|
86 | with disabled button should fail if it expects the button to be enabled
|
87 |
|
88 | ```
|
89 | return executeStep('the "Test" button should be enabled', function() {
|
90 | expect(currentStepResult.status).to.equal(Cucumber.Status.FAILED);
|
91 | });
|
92 | ```
|
93 |
|
94 |
|
95 | with disabled button should succeed if it expects the button to be disabled
|
96 |
|
97 | ```
|
98 | return executeStep('the "Test" button should not be enabled', function() {
|
99 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
100 | });
|
101 | ```
|
102 |
|
103 |
|
104 | ## timing
|
105 | timing should wait for the element to be present before verifying
|
106 |
|
107 | ```
|
108 | return browser.driver.executeScript("setTimeout( function() { $('div#test').append('<button id=\"testButton\">Button</button>'); }, 200 )").then(() => {
|
109 | return executeStep('the "Test" button should be enabled', function() {
|
110 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
111 | });
|
112 | });
|
113 | ```
|