1 | * [I select "\_\_\_" in the "\_\_\_" drop down list](i-select-"\_\_\_"-in-the-"\_\_\_"-drop-down-list)
|
2 | * [regex](regex)
|
3 | * [execution](execution)
|
4 | * [timing](timing)
|
5 | # I select "\_\_\_" in the "\_\_\_" drop down list
|
6 | ## regex
|
7 | regex should match 'I select "Mountain Standard" in the "Time Zone" drop down list'
|
8 |
|
9 | ```
|
10 | verifyStepMatch('I select "Mountain Standard" in the "Time Zone" drop down list');
|
11 | ```
|
12 |
|
13 |
|
14 | regex should capture the option text, element name, and element type
|
15 |
|
16 | ```
|
17 | verifyStepCaptures('I select "Mountain Standard" in the "Time Zone" drop down list', 'Mountain Standard', 'Time Zone', ' drop down list');
|
18 | ```
|
19 |
|
20 |
|
21 | regex should capture the option text, element name, and a blank string if no element type is provided
|
22 |
|
23 | ```
|
24 | verifyStepCaptures('I select "Mountain Standard" in the "Time Zone"', 'Mountain Standard', 'Time Zone', '');
|
25 | ```
|
26 |
|
27 |
|
28 | ## execution
|
29 | execution should select the correct option by its text from the correct drop-down
|
30 |
|
31 | ```
|
32 | return executeStep('I select "Mountain Standard" in the "Time Zone" drop down list', function() {
|
33 | return Promise.all([
|
34 | expect(element(By.cssContainingText('option', 'Eastern Standard')).isSelected()).to.eventually.equal(false),
|
35 | expect(element(By.cssContainingText('option', 'Central Standard')).isSelected()).to.eventually.equal(false),
|
36 | expect(element(By.cssContainingText('option', 'Mountain Standard')).isSelected()).to.eventually.equal(true)
|
37 | ]);
|
38 | });
|
39 | ```
|
40 |
|
41 |
|
42 | ## timing
|
43 | timing should wait for the drop down menu to appear before selecting
|
44 |
|
45 | ```
|
46 | return browser.driver.executeScript("setTimeout( function() { $(\"div#test\").append(' <select id=\"timezone\"> <option selected>Eastern Standard</option> <option>Mountain Standard</option> <option>Central Standard</option> </select>'); }, 200 )").then(() => {
|
47 | return executeStep('I select "Mountain Standard" in the "Time Zone" drop down list', function() {
|
48 | expect(currentStepResult.status).to.equal(Cucumber.Status.PASSED);
|
49 | });
|
50 | });
|
51 | ```
|