Skip to content

Commit 268e1c2

Browse files
committed
Update the docs
1 parent 815dad7 commit 268e1c2

File tree

2 files changed

+65
-59
lines changed

2 files changed

+65
-59
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ SeleniumBase provides additional Pytest command-line options for tests:
241241
--no-sandbox # (The option to enable Chrome's "No-Sandbox" feature.)
242242
--disable-gpu # (The option to enable Chrome's "Disable GPU" feature.)
243243
--incognito # (The option to enable Chrome's Incognito mode.)
244+
--guest # (The option to enable Chrome's Guest mode.)
245+
--devtools # (The option to open Chrome's DevTools when the browser opens.)
244246
--reuse-session # (The option to reuse the browser session between tests.)
245247
--maximize-window # (The option to start with the web browser maximized.)
246248
--save-screenshot # (The option to save a screenshot after each test.)

help_docs/customizing_test_runs.md

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ In addition to [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/m
77
The following tests can be run from the [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder:
88

99
```bash
10-
# Run my_first_test.py in Chrome (default browser)
11-
pytest my_first_test.py
10+
# Run a test in Chrome (default browser)
11+
pytest test_swag_labs.py
1212

13-
# Run my_first_test.py in Firefox
14-
pytest my_first_test.py --browser=firefox
13+
# Run a test in Firefox
14+
pytest test_swag_labs.py --browser=firefox
1515

1616
# Run a test in Demo Mode (highlight assertions)
17-
pytest my_first_test.py --demo
17+
pytest test_swag_labs.py --demo
1818

1919
# Run a test in Headless Mode (invisible browser)
20-
pytest my_first_test.py --headless
20+
pytest test_swag_labs.py --headless
2121

2222
# Run tests multi-threaded using [n] threads
2323
pytest test_suite.py -n=4
@@ -69,6 +69,63 @@ You can interchange **pytest** with **nosetests** for most things, but using pyt
6969

7070
(NOTE: If you're using **pytest** for running tests outside of the SeleniumBase repo, **you'll want a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure**. If using **nosetests**, the same applies for [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg).)
7171

72+
Here are some useful command-line options that come with Pytest:
73+
```bash
74+
-v # Prints the full test name for each test.
75+
-q # Prints fewer details in the console output when running tests.
76+
-x # Stop running the tests after the first failure is reached.
77+
--html=report.html # Creates a detailed test report after tests complete. (Using the pytest-html plugin)
78+
--collect-only # Show what tests would get run without actually running them.
79+
-s # See print statements. (Should be on by default with pytest.ini present.)
80+
-n=NUM # Multithread the tests using that many threads. (Speed up test runs!)
81+
```
82+
83+
SeleniumBase provides additional Pytest command-line options for tests:
84+
```bash
85+
--browser=BROWSER # (The web browser to use.)
86+
--cap-file=FILE # (The web browser's desired capabilities to use.)
87+
--settings-file=FILE # (Overrides SeleniumBase settings.py values.)
88+
--env=ENV # (Set a test environment. Use "self.env" to use this in tests.)
89+
--data=DATA # (Extra data to pass to tests. Use "self.data" in tests.)
90+
--user-data-dir=DIR # (Set the Chrome user data directory to use.)
91+
--server=SERVER # (The server / IP address used by the tests.)
92+
--port=PORT # (The port that's used by the test server.)
93+
--proxy=SERVER:PORT # (This is the proxy server:port combo used by tests.)
94+
--agent=STRING # (This designates the web browser's User Agent to use.)
95+
--mobile # (The option to use the mobile emulator while running tests.)
96+
--metrics=STRING # ("CSSWidth,Height,PixelRatio" for mobile emulator tests.)
97+
--extension-zip=ZIP # (Load a Chrome Extension .zip file, comma-separated.)
98+
--extension-dir=DIR # (Load a Chrome Extension directory, comma-separated.)
99+
--headless # (The option to run tests headlessly. The default on Linux OS.)
100+
--headed # (The option to run tests with a GUI on Linux OS.)
101+
--start-page=URL # (The starting URL for the web browser when tests begin.)
102+
--archive-logs # (Archive old log files instead of deleting them.)
103+
--time-limit # (The option to set a time limit per test before failing it.)
104+
--slow # (The option to slow down the automation.)
105+
--demo # (The option to visually see test actions as they occur.)
106+
--demo-sleep=SECONDS # (The option to wait longer after Demo Mode actions.)
107+
--highlights=NUM # (Number of highlight animations for Demo Mode actions.)
108+
--message-duration=SECONDS # (The time length for Messenger alerts.)
109+
--check-js # (The option to check for JavaScript errors after page loads.)
110+
--ad-block # (The option to block some display ads after page loads.)
111+
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
112+
--disable-csp # (This disables the Content Security Policy of websites.)
113+
--enable-sync # (The option to enable "Chrome Sync".)
114+
--no-sandbox # (The option to enable Chrome's "No-Sandbox" feature.)
115+
--disable-gpu # (The option to enable Chrome's "Disable GPU" feature.)
116+
--incognito # (The option to enable Chrome's Incognito mode.)
117+
--guest # (The option to enable Chrome's Guest mode.)
118+
--devtools # (The option to open Chrome's DevTools when the browser opens.)
119+
--reuse-session # (The option to reuse the browser session between tests.)
120+
--maximize-window # (The option to start with the web browser maximized.)
121+
--save-screenshot # (The option to save a screenshot after each test.)
122+
--visual-baseline # (Set the visual baseline for Visual/Layout tests.)
123+
--timeout-multiplier=MULTIPLIER # (Multiplies the default timeout values.)
124+
```
125+
(For more details, see the full list of command-line options **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py)**.)
126+
127+
#### **Customizing default settings:**
128+
72129
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.
73130
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))
74131
``--settings-file=custom_settings.py``
@@ -178,59 +235,6 @@ nosetests test_suite.py --report
178235

179236
(NOTE: You can add ``--show_report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show_report`` when running tests locally because it pauses the test run.)
180237

181-
Here are some other useful command-line options that come with Pytest:
182-
```bash
183-
-v # Prints the full test name for each test.
184-
-q # Prints fewer details in the console output when running tests.
185-
-x # Stop running the tests after the first failure is reached.
186-
--html=report.html # Creates a detailed test report after tests complete. (Using the pytest-html plugin)
187-
--collect-only # Show what tests would get run without actually running them.
188-
-s # See print statements. (Should be on by default with pytest.ini present.)
189-
-n=NUM # Multithread the tests using that many threads. (Speed up test runs!)
190-
```
191-
192-
SeleniumBase provides additional Pytest command-line options for tests:
193-
```bash
194-
--browser=BROWSER # (The web browser to use.)
195-
--cap-file=FILE # (The web browser's desired capabilities to use.)
196-
--settings-file=FILE # (Overrides SeleniumBase settings.py values.)
197-
--env=ENV # (Set a test environment. Use "self.env" to use this in tests.)
198-
--data=DATA # (Extra data to pass to tests. Use "self.data" in tests.)
199-
--user-data-dir=DIR # (Set the Chrome user data directory to use.)
200-
--server=SERVER # (The server / IP address used by the tests.)
201-
--port=PORT # (The port that's used by the test server.)
202-
--proxy=SERVER:PORT # (This is the proxy server:port combo used by tests.)
203-
--agent=STRING # (This designates the web browser's User Agent to use.)
204-
--mobile # (The option to use the mobile emulator while running tests.)
205-
--metrics=STRING # ("CSSWidth,Height,PixelRatio" for mobile emulator tests.)
206-
--extension-zip=ZIP # (Load a Chrome Extension .zip file, comma-separated.)
207-
--extension-dir=DIR # (Load a Chrome Extension directory, comma-separated.)
208-
--headless # (The option to run tests headlessly. The default on Linux OS.)
209-
--headed # (The option to run tests with a GUI on Linux OS.)
210-
--start-page=URL # (The starting URL for the web browser when tests begin.)
211-
--archive-logs # (Archive old log files instead of deleting them.)
212-
--time-limit # (The option to set a time limit per test before failing it.)
213-
--slow # (The option to slow down the automation.)
214-
--demo # (The option to visually see test actions as they occur.)
215-
--demo-sleep=SECONDS # (The option to wait longer after Demo Mode actions.)
216-
--highlights=NUM # (Number of highlight animations for Demo Mode actions.)
217-
--message-duration=SECONDS # (The time length for Messenger alerts.)
218-
--check-js # (The option to check for JavaScript errors after page loads.)
219-
--ad-block # (The option to block some display ads after page loads.)
220-
--verify-delay=SECONDS # (The delay before MasterQA verification checks.)
221-
--disable-csp # (This disables the Content Security Policy of websites.)
222-
--enable-sync # (The option to enable "Chrome Sync".)
223-
--no-sandbox # (The option to enable Chrome's "No-Sandbox" feature.)
224-
--disable-gpu # (The option to enable Chrome's "Disable GPU" feature.)
225-
--incognito # (The option to enable Chrome's Incognito mode.)
226-
--reuse-session # (The option to reuse the browser session between tests.)
227-
--maximize-window # (The option to start with the web browser maximized.)
228-
--save-screenshot # (The option to save a screenshot after each test.)
229-
--visual-baseline # (Set the visual baseline for Visual/Layout tests.)
230-
--timeout-multiplier=MULTIPLIER # (Multiplies the default timeout values.)
231-
```
232-
(For more details, see the full list of command-line options **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py)**.)
233-
234238
#### **Using a Proxy Server:**
235239

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

0 commit comments

Comments
 (0)