Skip to content

Commit c4f8039

Browse files
committed
Use correct indentation for Behave-Gherkin files
1 parent 8c09b76 commit c4f8039

File tree

11 files changed

+399
-397
lines changed

11 files changed

+399
-397
lines changed

examples/behave_bdd/ReadMe.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Took 0m1.672s
7676

7777
<img src="https://seleniumbase.io/cdn/img/sb_behave_dashboard.png" title="SeleniumBase" width="600">
7878

79-
### 🐝 Understanding Behave files:
79+
### 🐝 Behave-Gherkin files:
8080

8181
🐝 The ``*.feature`` files can use any step seen from:
8282

@@ -147,48 +147,48 @@ def add_item_to_cart(context, item):
147147
```gherkin
148148
Feature: SeleniumBase scenarios for the Swag Labs App
149149
150-
Background:
151-
Given Open the Swag Labs Login Page
152-
153-
Scenario: User can order a backpack from the store
154-
When Login to Swag Labs with standard_user
155-
Then Verify that the current user is logged in
156-
And Save price of "Backpack" to <item_price>
157-
When Add "Backpack" to Cart
158-
Then Verify shopping cart badge shows 1 item(s)
159-
When Click on shopping cart icon
160-
And Click Checkout
161-
And Enter checkout info: First, Last, 12345
162-
And Click Continue
163-
Then Verify 1 "Backpack"(s) in cart
164-
And Verify cost of "Backpack" is <item_price>
165-
And Verify item total is $29.99
166-
And Verify tax amount is $2.40
167-
And Verify total cost is $32.39
168-
When Click Finish
169-
Then Verify order complete
170-
When Logout from Swag Labs
171-
Then Verify on Login page
150+
Background:
151+
Given Open the Swag Labs Login Page
152+
153+
Scenario: User can order a backpack from the store
154+
When Login to Swag Labs with standard_user
155+
Then Verify that the current user is logged in
156+
And Save price of "Backpack" to <item_price>
157+
When Add "Backpack" to Cart
158+
Then Verify shopping cart badge shows 1 item(s)
159+
When Click on shopping cart icon
160+
And Click Checkout
161+
And Enter checkout info: First, Last, 12345
162+
And Click Continue
163+
Then Verify 1 "Backpack"(s) in cart
164+
And Verify cost of "Backpack" is <item_price>
165+
And Verify item total is $29.99
166+
And Verify tax amount is $2.40
167+
And Verify total cost is $32.39
168+
When Click Finish
169+
Then Verify order complete
170+
When Logout from Swag Labs
171+
Then Verify on Login page
172172
```
173173

174174
🐝 Here's another example of a ``*.feature`` file:
175175

176176
```gherkin
177177
Feature: SeleniumBase scenarios for the RealWorld App
178178
179-
Scenario: Verify RealWorld App (log in / sign out)
180-
Given Open "seleniumbase.io/realworld/login"
181-
And Clear Session Storage
182-
When Type "demo_user" into "#username"
183-
And Type "secret_pass" into "#password"
184-
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
185-
Then Assert text "Welcome!" in "h1"
186-
And Highlight element "img#image1"
187-
And Click 'a:contains("This Page")'
188-
And Save screenshot to logs
189-
When Click link "Sign out"
190-
Then Assert element 'a:contains("Sign in")'
191-
And Assert text "You have been signed out!"
179+
Scenario: Verify RealWorld App (log in / sign out)
180+
Given Open "seleniumbase.io/realworld/login"
181+
And Clear Session Storage
182+
When Type "demo_user" into "#username"
183+
And Type "secret_pass" into "#password"
184+
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
185+
Then Assert text "Welcome!" in "h1"
186+
And Highlight element "img#image1"
187+
And Click 'a:contains("This Page")'
188+
And Save screenshot to logs
189+
When Click link "Sign out"
190+
Then Assert element 'a:contains("Sign in")'
191+
And Assert text "You have been signed out!"
192192
```
193193

194194
🐝 If there's a test failure, that's easy to spot:
Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
Feature: SeleniumBase scenarios for the Calculator App
22

3-
Background:
4-
Given Open the Calculator App
3+
Background:
4+
Given Open the Calculator App
55

6-
Scenario: Pressing "C" outputs "0"
7-
When Press C
8-
Then Verify output is "0"
6+
Scenario: Pressing "C" outputs "0"
7+
When Press C
8+
Then Verify output is "0"
99

10-
Scenario: 1 + 2 + 3 + 4 + 5 = 15
11-
When Press C
12-
And Press 1
13-
And Press +
14-
And Press 2
15-
And Press +
16-
And Press 3
17-
And Press +
18-
And Press 4
19-
And Press +
20-
And Press 5
21-
Then Verify output is "1+2+3+4+5"
22-
When Press =
23-
Then Verify output is "15"
10+
Scenario: 1 + 2 + 3 + 4 + 5 = 15
11+
When Press C
12+
And Press 1
13+
And Press +
14+
And Press 2
15+
And Press +
16+
And Press 3
17+
And Press +
18+
And Press 4
19+
And Press +
20+
And Press 5
21+
Then Verify output is "1+2+3+4+5"
22+
When Press =
23+
Then Verify output is "15"
2424

25-
Scenario: 6 × 7 × 8 × 9 = 3024
26-
When Press C
27-
And Press 6
28-
And Press ×
29-
And Press 7
30-
And Press ×
31-
And Press 8
32-
And Press ×
33-
And Press 9
34-
Then Verify output is "6×7×8×9"
35-
When Press =
36-
Then Verify output is "3024"
25+
Scenario: 6 × 7 × 8 × 9 = 3024
26+
When Press C
27+
And Press 6
28+
And Press ×
29+
And Press 7
30+
And Press ×
31+
And Press 8
32+
And Press ×
33+
And Press 9
34+
Then Verify output is "6×7×8×9"
35+
When Press =
36+
Then Verify output is "3024"
3737

38-
Scenario: 44 - 11 = 33
39-
When Press C
40-
And Press 4
41-
And Press 4
42-
And Press -
43-
And Press 1
44-
And Press 1
45-
Then Verify output is "44-11"
46-
When Press =
47-
Then Verify output is "33"
38+
Scenario: 44 - 11 = 33
39+
When Press C
40+
And Press 4
41+
And Press 4
42+
And Press -
43+
And Press 1
44+
And Press 1
45+
Then Verify output is "44-11"
46+
When Press =
47+
Then Verify output is "33"
4848

49-
Scenario: 7.0 × (3 + 3) = 42
50-
When Press C
51-
And Press 7
52-
And Press .
53-
And Press 0
54-
And Press ×
55-
And Press (
56-
And Press 3
57-
And Press +
58-
And Press 3
59-
And Press )
60-
Then Verify output is "7.0×(3+3)"
61-
When Press =
62-
Then Verify output is "42"
49+
Scenario: 7.0 × (3 + 3) = 42
50+
When Press C
51+
And Press 7
52+
And Press .
53+
And Press 0
54+
And Press ×
55+
And Press (
56+
And Press 3
57+
And Press +
58+
And Press 3
59+
And Press )
60+
Then Verify output is "7.0×(3+3)"
61+
When Press =
62+
Then Verify output is "42"
6363

64-
Scenario: 4.5 × 68 = 306
65-
When Press C
66-
And Evaluate [4.5 × 68]
67-
Then Verify output is "306"
64+
Scenario: 4.5 × 68 = 306
65+
When Press C
66+
And Evaluate [4.5 × 68]
67+
Then Verify output is "306"
6868

69-
Scenario Outline: <First> ÷ <Second> = <Result>
70-
When Press C
71-
And Press [<First>]
72-
And Press ÷
73-
And Press [<Second>]
74-
And Press =
75-
Then Verify output is "<Result>"
76-
Examples:
77-
| First | Second | Result |
78-
| 1948 | 4 | 487 |
79-
| 21 | 0 | Error |
69+
Scenario Outline: <First> ÷ <Second> = <Result>
70+
When Press C
71+
And Press [<First>]
72+
And Press ÷
73+
And Press [<Second>]
74+
And Press =
75+
Then Verify output is "<Result>"
76+
Examples:
77+
| First | Second | Result |
78+
| 1948 | 4 | 487 |
79+
| 21 | 0 | Error |
8080

81-
Scenario: Save calculator screenshot to logs
82-
Given Press [1337]
83-
Given Save calculator screenshot to logs
81+
Scenario: Save calculator screenshot to logs
82+
Given Press [1337]
83+
Given Save calculator screenshot to logs
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Feature: SeleniumBase scenarios for the Fail Page
22

3-
Scenario: Fail test on purpose to see what happens
4-
When Open the Fail Page
5-
Then Fail test on purpose
3+
Scenario: Fail test on purpose to see what happens
4+
When Open the Fail Page
5+
Then Fail test on purpose
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Feature: SeleniumBase scenarios for the RealWorld App
22

3-
Scenario: Verify RealWorld App (log in / sign out)
4-
Given Open "seleniumbase.io/realworld/login"
5-
And Clear Session Storage
6-
When Type "demo_user" into "#username"
7-
And Type "secret_pass" into "#password"
8-
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
9-
Then Assert exact text "Welcome!" in "h1"
10-
And Highlight "img#image1"
11-
And Click 'a:contains("This Page")'
12-
And Save screenshot to logs
13-
When Click link "Sign out"
14-
Then Assert element 'a:contains("Sign in")'
15-
And Assert text "You have been signed out!"
3+
Scenario: Verify RealWorld App (log in / sign out)
4+
Given Open "seleniumbase.io/realworld/login"
5+
And Clear Session Storage
6+
When Type "demo_user" into "#username"
7+
And Type "secret_pass" into "#password"
8+
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
9+
Then Assert exact text "Welcome!" in "h1"
10+
And Highlight "img#image1"
11+
And Click 'a:contains("This Page")'
12+
And Save screenshot to logs
13+
When Click link "Sign out"
14+
Then Assert element 'a:contains("Sign in")'
15+
And Assert text "You have been signed out!"

0 commit comments

Comments
 (0)