1 | * [the "\_\_\_" should be active](the-"\_\_\_"-should-be-active)
|
2 | * [regex](regex)
|
3 | * [execution](execution)
|
4 | * [with an active element](with-an-active-element)
|
5 | * [with an inactive element](with-an-inactive-element)
|
6 | * [timing](timing)
|
7 | # the "\_\_\_" should be active
|
8 | ## regex
|
9 | regex should match "...should be active"
|
10 |
|
11 | ```
|
12 | verifyStepMatch('the "Active Field" should be active');
|
13 | ```
|
14 |
|
15 |
|
16 | regex should match "...should not be active"
|
17 |
|
18 | ```
|
19 | verifyStepMatch('the "Inactive Field" should not be active');
|
20 | ```
|
21 |
|
22 |
|
23 | regex should capture the element name, element type, and expectation
|
24 |
|
25 | ```
|
26 | verifyStepCaptures('the "Inactive" field should not be active', 'Inactive', ' field', 'should not');
|
27 | ```
|
28 |
|
29 |
|
30 | regex should capture the element name, expectation, and a blank string if no element type is provided
|
31 |
|
32 | ```
|
33 | verifyStepCaptures('the "Inactive Field" should not be active', 'Inactive Field', '', 'should not');
|
34 | ```
|
35 |
|
36 |
|
37 | ## execution
|
38 | ### with an active element
|
39 | with an active element should succeed if it expects the element to be active
|
40 |
|
41 | ```
|
42 | return executeStep('the "Button" should be active', function() {
|
43 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
44 | });
|
45 | ```
|
46 |
|
47 |
|
48 | with an active element should fail if it expects the element to be inactive
|
49 |
|
50 | ```
|
51 | return executeStep('the "Button" should not be active', function() {
|
52 | expect(currentStepResult.status).to.equal(Cucumber.Status.FAILED);
|
53 | });
|
54 | ```
|
55 |
|
56 |
|
57 | ### with an inactive element
|
58 | with an inactive element should fail if it expects the element to be active
|
59 |
|
60 | ```
|
61 | return executeStep('the "Button" should be active', function() {
|
62 | expect(currentStepResult.status).to.equal(Cucumber.Status.FAILED);
|
63 | });
|
64 | ```
|
65 |
|
66 |
|
67 | with an inactive element should succeed if it expects the element to be inactive
|
68 |
|
69 | ```
|
70 | return executeStep('the "Button" should not be active', function() {
|
71 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
72 | });
|
73 | ```
|
74 |
|
75 |
|
76 | ## timing
|
77 | timing should wait for the element to be present before verifying
|
78 |
|
79 | ```
|
80 | return browser.driver.executeScript("setTimeout( function() { $(\"div#test\").append('<button id=\"testButton\" class=\"active\">'); }, 200 )").then(() => {
|
81 | return executeStep('the "Button" should be active', function() {
|
82 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
83 | });
|
84 | });
|
85 | ```
|