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
<palign="center">Extends <ahref="https://www.w3.org/TR/webdriver/">Selenium/WebDriver</a> and <ahref="https://docs.pytest.org/en/latest/index.html">pytest</a>.</p>
<imgsrc="https://img.shields.io/travis/seleniumbase/SeleniumBase/master.svg"alt="SeleniumBase on TravisCI" /></a> <ahref="https://github.com/seleniumbase/SeleniumBase/actions">
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Create and run tests:</h3>
162
161
163
-
*Use ``sbase mkdir DIR``to create a folder with sample tests:
162
+
*``sbase mkdir DIR``creates a folder with sample tests:
164
163
165
164
```bash
166
165
sbase mkdir ui_tests
167
166
cd ui_tests/
168
167
```
169
168
170
-
>This folder contains the following files:
169
+
>That folder will have the following files:
171
170
172
171
```
173
-
__init__.py
174
-
boilerplates/
175
-
my_first_test.py
176
-
parameterized_test.py
177
-
pytest.ini
178
-
requirements.txt
179
-
setup.cfg
180
-
test_demo_site.py
172
+
ui_tests/
173
+
│
174
+
├── __init__.py
175
+
├── my_first_test.py
176
+
├── parameterized_test.py
177
+
├── pytest.ini
178
+
├── requirements.txt
179
+
├── setup.cfg
180
+
├── test_demo_site.py
181
+
└── boilerplates/
182
+
│
183
+
├── __init__.py
184
+
├── base_test_case.py
185
+
├── boilerplate_test.py
186
+
├── page_objects.py
187
+
└── samples/
188
+
│
189
+
├── __init__.py
190
+
├── google_objects.py
191
+
└── google_test.py
181
192
```
182
193
183
194
*<b>Run a sample test with ``pytest``:</b>
@@ -186,8 +197,8 @@ test_demo_site.py
186
197
pytest test_demo_site.py
187
198
```
188
199
189
-
*Chrome is the default browser if not specified with ``--browser=BROWSER``.
190
-
*On Linux ``--headless`` is the default behavior (running with no GUI). You can also run in headless mode on any OS. If your Linux machine has a GUI and you want to see the web browser as tests run, add ``--headed`` or ``--gui``.
200
+
> (Chrome is the default browser if not specified with ``--browser=BROWSER``.)
201
+
> (On Linux,``--headless`` is the default behavior. You can also run in headless mode on any OS. If your Linux machine has a GUI and you want to see the web browser as tests run, add ``--headed`` or ``--gui``.)
191
202
192
203
<b>If you've cloned SeleniumBase from GitHub, you can also run tests from the [SeleniumBase/examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder:</b>
193
204
@@ -242,7 +253,7 @@ self.assert_text(TEXT) # Assert text is visible (has optional SELECTOR arg)
242
253
self.assert_title(PAGE_TITLE) # Assert page title
243
254
self.assert_no_404_errors() # Assert no 404 errors from files on the page
244
255
self.assert_no_js_errors() # Assert no JavaScript errors on the page (Chrome-ONLY)
All Python methods that start with ``test_`` will automatically be run when using ``pytest`` or ``nosetests`` on a Python file, (<i>or on folders containing Python files</i>). You can also be more specific on what to run within a file by using the following: (<i>Note that the syntax is different for pytest vs nosetests.</i>)
@@ -441,7 +452,7 @@ Inside your tests, you can use ``self.data`` to access that.
441
452
442
453
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Test Directory Customization:</h3>
443
454
444
-
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.) These files specify default configuration details for tests. (For nosetest runs, you can also specify a .cfg file by using ``--config``. Example ``nosetests [MY_TEST].py --config=[MY_CONFIG].cfg``)
455
+
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.) These files specify default configuration details for tests. (For nosetest runs, you can also specify a .cfg file by using ``--config``. Example ``nosetests [MY_TEST.py] --config=[MY_CONFIG.cfg]``)
445
456
446
457
As a shortcut, you'll be able to run ``sbase mkdir [DIRECTORY]`` to create a new folder that already contains necessary files and some example tests that you can run.
0 commit comments