You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/ReadMe.md
+66-10Lines changed: 66 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
<!-- SeleniumBase Docs -->
2
2
3
-
## [<imgsrc="https://seleniumbase.github.io/img/logo6.png"title="SeleniumBase"width="32">](https://github.com/seleniumbase/SeleniumBase/) Example Tests:
3
+
## [<imgsrc="https://seleniumbase.github.io/img/logo7.png"title="SeleniumBase"width="32">](https://github.com/seleniumbase/SeleniumBase/) Example Tests:
(NOTE: Some example tests fail on purpose to demonstrate [logging features](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).)
15
15
16
-
<h3><imgsrc="https://seleniumbase.github.io/img/logo6.png"title="SeleniumBase"width="32" /> Example tests with run commands to help you get started:</h3>
17
-
18
-
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) in Chrome: (Default: ``--browser=chrome``)
16
+
--------
19
17
20
-
```bash
21
-
pytest my_first_test.py
22
-
```
18
+
<h3><imgsrc="https://seleniumbase.github.io/img/logo7.png"title="SeleniumBase"width="32" /> Example tests with run commands to help you get started:</h3>
23
19
24
-
<imgsrc="https://seleniumbase.github.io/cdn/gif/swag_labs_4.gif"title="Testing Swag Labs with SeleniumBase" /><br />
20
+
--------
25
21
26
-
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py) on the SeleniumBase Demo Site:
22
+
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py): (Default option: ``--browser=chrome``)
Run [test_coffee_cart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_coffee_cart.py) to test the [Coffee Cart](https://seleniumbase.io/coffee/) app:
Run a [Wordle-solver example](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/wordle_test.py):
49
61
50
62
```bash
@@ -53,12 +65,16 @@ pytest wordle_test.py
53
65
54
66
<imgsrc="https://seleniumbase.github.io/cdn/gif/wordle.gif"title="Solving Wordle with SeleniumBase" /><br />
55
67
68
+
--------
69
+
56
70
Run an example test in Headless Mode: (invisible browser)
57
71
58
72
```bash
59
73
pytest my_first_test.py --headless
60
74
```
61
75
76
+
--------
77
+
62
78
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) using Chrome's mobile device emulator: (default settings)
Run a [test suite](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_suite.py) with verbose output: (see more details)
79
99
80
100
```bash
81
101
pytest test_suite.py -v
82
102
```
83
103
104
+
--------
105
+
84
106
Run a test suite multi-threaded using [n] threads:
85
107
86
108
```bash
87
109
pytest test_suite.py -n=4
88
110
```
89
111
112
+
--------
113
+
90
114
Run a [parameterized test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/parameterized_test.py): (Generates multiple tests from one)
91
115
92
116
```bash
93
117
pytest parameterized_test.py -v
94
118
```
95
119
120
+
--------
121
+
96
122
Run a test suite and generate a SeleniumBase Dashboard:
97
123
98
124
```bash
99
125
pytest test_suite.py --dashboard
100
126
```
101
127
128
+
--------
129
+
102
130
Run a test suite and generate a pytest report:
103
131
104
132
```bash
105
133
pytest test_suite.py --html=report.html
106
134
```
107
135
136
+
--------
137
+
108
138
Run a [failing test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py): (See the ``latest_logs/`` folder for logs and screenshots)
109
139
110
140
```bash
111
141
pytest test_fail.py
112
142
```
113
143
144
+
--------
145
+
114
146
Run a failing test with Debug-mode enabled: (``pdb`` activates on failures)
115
147
116
148
```bash
117
149
pytest test_fail.py --pdb -s
118
150
```
119
151
152
+
--------
153
+
120
154
Run a test suite that demonstrates the use of pytest markers:
121
155
122
156
```bash
123
157
pytest -m marker_test_suite -v
124
158
```
125
159
160
+
--------
161
+
126
162
Run a test suite that reuses the browser session between tests:
127
163
128
164
```bash
129
165
pytest test_suite.py --reuse-session
130
166
```
131
167
168
+
--------
169
+
132
170
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/rate_limiting_test.py) demonstrating the ``rate_limited`` Python decorator:
133
171
134
172
```bash
135
173
pytest rate_limiting_test.py
136
174
```
137
175
176
+
--------
177
+
138
178
Run an [example test](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/upload_file_test.py) that demonstrates how to upload a file to a website:
139
179
140
180
```bash
@@ -161,12 +201,16 @@ Run an example test with nosetests:
161
201
nosetests my_first_test.py
162
202
```
163
203
204
+
--------
205
+
164
206
Run an example test suite and generate a nosetest report:
165
207
166
208
```bash
167
209
nosetests test_suite.py --report --show-report
168
210
```
169
211
212
+
--------
213
+
170
214
Run an example test using a nosetest configuration file:
171
215
172
216
```bash
@@ -181,7 +225,7 @@ For more advanced run commands, such as using a proxy server, see [../help_docs/
181
225
182
226
If you just need to perform some quick website verification on various devices, you can use the <ahref="https://seleniumbase.io/devices/">SeleniumBase Device Farm</a>. Just plug in a website URL, and it will display how the website looks on four different devices:
183
227
184
-
<ahref="https://seleniumbase.io/devices/"><imgsrc="https://seleniumbase.github.io/cdn/img/github_demo2.png"width="540"title="SeleniumBase Mobile Mode" /></a><br />
228
+
<ahref="https://seleniumbase.io/devices/?url=github.com"><imgsrc="https://seleniumbase.github.io/cdn/img/github_demo2.png"width="540"title="SeleniumBase Mobile Mode" /></a><br />
185
229
186
230
--------
187
231
@@ -193,6 +237,18 @@ python gui_test_runner.py
193
237
194
238
<imgsrc="https://seleniumbase.github.io/cdn/img/gui_test_runner.png"title="GUI Test Runner"width="320" />
195
239
240
+
(The newer [SeleniumBase Commander](https://seleniumbase.io/help_docs/commander/) improves on that.)
241
+
242
+
--------
243
+
244
+
🎖️ To launch the SeleniumBase Commander GUI for pytest:
0 commit comments