Skip to content

Commit 3d7d272

Browse files
committed
Update the docs
1 parent 65f33d1 commit 3d7d272

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

help_docs/customizing_test_runs.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pytest test_demo_site.py --headless
2222
# Run tests multi-threaded using [n] threads
2323
pytest test_suite.py -n=4
2424

25-
# Reuse the browser session for all tests being run
25+
# Reuse the browser session for all tests ("--rs")
2626
pytest test_suite.py --reuse-session
2727

28-
# Reuse the browser session, but empty cookies between tests
28+
# Reuse the browser session, but erase cookies between tests
2929
pytest test_suite.py --reuse-session --crumbs
3030

3131
# Create a real-time dashboard for test results
@@ -182,7 +182,7 @@ sbase options
182182

183183
--------
184184

185-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Example tests using Logging:</h3>
185+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Example tests using Logging:</h3>
186186

187187
To see logging abilities, you can run a test suite that includes tests that fail on purpose:
188188

@@ -192,7 +192,7 @@ pytest test_suite.py
192192

193193
🔵 During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is specified (or if ARCHIVE_EXISTING_LOGS is set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py)), test logs will also get archived to the ``archived_logs/`` folder. Otherwise, the log files will be cleaned out when the next test run begins (by default).
194194

195-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Demo Mode:</h3>
195+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Demo Mode:</h3>
196196

197197
If any test is moving too fast for your eyes to see what's going on, you can run it in **Demo Mode** by adding ``--demo`` on the command line, which pauses the browser briefly between actions, highlights page elements being acted on, and lets you know what test assertions are happening in real time:
198198

@@ -206,23 +206,23 @@ You can override the default wait time by either updating [settings.py](https://
206206
pytest my_first_test.py --demo --demo-sleep=1.2
207207
```
208208

209-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Passing additional data to tests:</h3>
209+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Passing additional data to tests:</h3>
210210

211211
If you want to pass additional data from the command line to your tests, you can use ``--data=STRING``. Now inside your tests, you can use ``self.data`` to access that.
212212

213-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests multithreaded:</h3>
213+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Running tests multithreaded:</h3>
214214

215215
To run pytest tests using multiple processes, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
216216

217-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Retrying failing tests automatically:</h3>
217+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Retrying failing tests automatically:</h3>
218218

219219
You can use ``--reruns=NUM`` to retry failing tests that many times. Use ``--reruns-delay=SECONDS`` to wait that many seconds between retries. Example:
220220

221221
```bash
222222
pytest --reruns=1 --reruns-delay=1
223223
```
224224

225-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Debugging tests:</h3>
225+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Debugging tests:</h3>
226226

227227
You can use the following calls in your scripts to help you debug issues:
228228

@@ -240,7 +240,7 @@ pytest my_first_test.py --pdb -s
240240

241241
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
242242

243-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Combinations of options:</h3>
243+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Combinations of options:</h3>
244244

245245
There are times when you'll want to combine various command-line options for added effect.
246246
For instance, the multi-process option, ``-n=4``, can be customized by adding:
@@ -261,7 +261,7 @@ The above not only runs tests in parallel processes, but it also tells tests in
261261

262262
--------
263263

264-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>
264+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>
265265

266266
🔵 The ``--dashboard`` option for pytest generates a SeleniumBase Dashboard located at ``dashboard.html``, which updates automatically as tests run and produce results. Example:
267267

@@ -289,7 +289,7 @@ pytest test_suite.py --dashboard --rs --headless
289289

290290
--------
291291

292-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Pytest Reports:</h3>
292+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Pytest Reports:</h3>
293293

294294
🔵 Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
295295

@@ -319,7 +319,7 @@ pytest test_suite.py --junit-xml=report.xml
319319

320320
--------
321321

322-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Nosetest Reports:</h3>
322+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Nosetest Reports:</h3>
323323

324324
The ``--report`` option gives you a fancy report after your test suite completes.
325325

@@ -333,7 +333,7 @@ nosetests test_suite.py --report
333333

334334
--------
335335

336-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Customizing default settings:</h3>
336+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Customizing default settings:</h3>
337337

338338
An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) is by using a custom settings file.
339339
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
@@ -342,9 +342,9 @@ Here's the command-line option to add to tests: (See [examples/custom_settings.p
342342

343343
--------
344344

345-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:</h3>
345+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Running tests on a remote Selenium Grid:</h3>
346346

347-
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, [TestingBot](https://testingbot.com/features)'s Selenium Grid, other Grids, and even your own Grid:
347+
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, other Grids, and even your own Grid:
348348

349349
(For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities)
350350

@@ -360,16 +360,16 @@ Here's how to connect to a Sauce Labs Selenium Grid server for running tests:
360360
pytest test_demo_site.py --server=USERNAME:[email protected] --port=443 --protocol=https
361361
```
362362

363-
Here's how to connect to a TestingBot Selenium Grid server for running tests:
363+
Here's how to connect to a Perfecto Mobile Selenium Grid server for running tests:
364364

365365
```bash
366-
pytest test_demo_site.py --server=USERNAME:KEY@hub.testingbot.com --port=80
366+
pytest test_demo_site.py --server=USERNAME:KEY@demo.perfectomobile.com/nexperience/perfectomobile --port=443
367367
```
368368

369-
Here's how to connect to a CrossBrowserTesting Selenium Grid server for running tests:
369+
Here's how to connect to a TestingBot Selenium Grid server for running tests:
370370

371371
```bash
372-
pytest test_demo_site.py --server=USERNAME:KEY@hub.crossbrowsertesting.com --port=80
372+
pytest test_demo_site.py --server=USERNAME:KEY@hub.testingbot.com --port=80
373373
```
374374

375375
Here's how to connect to a LambdaTest Selenium Grid server for running tests:
@@ -378,17 +378,23 @@ Here's how to connect to a LambdaTest Selenium Grid server for running tests:
378378
pytest test_demo_site.py --server=USERNAME:[email protected] --port=80
379379
```
380380

381+
Here's how to connect to a CrossBrowserTesting Selenium Grid server for running tests:
382+
383+
```bash
384+
pytest test_demo_site.py --server=USERNAME:[email protected] --port=80
385+
```
386+
381387
Or you can create your own Selenium Grid for test distribution. ([See this ReadMe for details](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md))
382388

383-
To use a server on the ``https`` protocol, add ``--protocol=https``:
389+
To use a server on the ``https`` protocol, add ``--protocol=https``: (*Now automatic if the port is 443.*)
384390

385391
```bash
386392
pytest test_demo_site.py --protocol=https --server=IP_ADDRESS --port=PORT
387393
```
388394

389395
--------
390396

391-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Using a Proxy Server:</h3>
397+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>
392398

393399
If you wish to use a proxy server for your browser tests (Chromium or Firefox), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line.
394400

@@ -418,15 +424,15 @@ pytest proxy_test.py --proxy=proxy1
418424

419425
--------
420426

421-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Changing the User-Agent:</h3>
427+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Changing the User-Agent:</h3>
422428

423429
If you wish to change the User-Agent for your browser tests (Chrome and Firefox only), you can add ``--agent="USER-AGENT-STRING"`` as an argument on the command line.
424430

425431
```bash
426432
pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
427433
```
428434

429-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Mobile Device Testing:</h3>
435+
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Mobile Device Testing:</h3>
430436

431437
Use ``--mobile`` to quickly run your tests using Chrome's mobile device emulator with default values for device metrics (CSS Width, CSS Height, Pixel-Ratio) and a default value set for the user agent. To configure the mobile device metrics, use ``--metrics="CSS_Width,CSS_Height,Pixel_Ratio"`` to set those values. You'll also be able to set the user agent with ``--agent="USER-AGENT-STRING"`` (a default user agent will be used if not specified). To find real values for device metrics, [see this GitHub Gist](https://gist.github.com/sidferreira/3f5fad525e99b395d8bd882ee0fd9d00). For a list of available user agent strings, [check out this page](https://developers.whatismybrowser.com/useragents/explore/).
432438

mkdocs_build/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ docutils==0.18
44
python-dateutil==2.8.2
55
livereload==2.6.3;python_version>="3.6"
66
joblib==1.1.0;python_version>="3.6"
7-
Markdown==3.3.4;python_version>="3.6"
7+
Markdown==3.3.6;python_version>="3.6"
88
MarkupSafe==2.0.1;python_version>="3.6"
99
pyparsing==2.4.7;python_version>="3.6"
1010
keyring==23.2.1;python_version>="3.6"

seleniumbase/fixtures/base_case.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9004,6 +9004,7 @@ def assert_text(
90049004
):
90059005
"""Similar to wait_for_text_visible()
90069006
Raises an exception if the element or the text is not found.
9007+
The text only needs to be a subset within the complete text.
90079008
Returns True if successful. Default timeout = SMALL_TIMEOUT."""
90089009
self.__check_scope()
90099010
if not timeout:
@@ -9046,8 +9047,8 @@ def assert_text(
90469047
def assert_exact_text(
90479048
self, text, selector="html", by=By.CSS_SELECTOR, timeout=None
90489049
):
9049-
"""Similar to assert_text(), but the text must be exact, rather than
9050-
exist as a subset of the full text.
9050+
"""Similar to assert_text(), but the text must be exact,
9051+
rather than exist as a subset of the full text.
90519052
(Extra whitespace at the beginning or the end doesn't count.)
90529053
Raises an exception if the element or the text is not found.
90539054
Returns True if successful. Default timeout = SMALL_TIMEOUT."""

0 commit comments

Comments
 (0)