UNPKG

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