From d8fe78f67ae52d616caf995ce4fd71921c6f3a95 Mon Sep 17 00:00:00 2001
From: Michael Mintz
๐ Start |
@@ -54,7 +52,7 @@
--------
Table of Contents: SeleniumBase - Table of Contents: SeleniumBase ChartMaker lets you use Python to generate HTML charts. Increase SaaS Product Adoption by 10x or more.
-๐ Start |
+๐ Start |
๐ Dashboard
SeleniumBase Workflows
+###
SeleniumBase Workflows
> **Table of Contents / Navigation:**
> - [**CI build**](workflows/python-package.yml)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fe5a705..07c78e85 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,3 @@
-
+ CHANGELOG
CHANGELOG
See: [SeleniumBase/releases](https://github.com/seleniumbase/SeleniumBase/releases)
diff --git a/README.md b/README.md
index 98d096f1..72d398b4 100755
--- a/README.md
+++ b/README.md
@@ -7,11 +7,9 @@
-
+SeleniumBase - Python Web UI Testing Made Easy
-
SeleniumBase - Python Web UI Testing Made Easy
-
-
+
-
pytest
:
```bash
--v # Verbose mode. Prints the full name of each test run.
+-v # Verbose mode. Prints the full name of each test and shows more details.
-q # Quiet mode. Print fewer details in the console output when running tests.
-x # Stop running the tests after the first failure is reached.
--html=report.html # Creates a detailed pytest-html report after tests finish.
@@ -554,7 +552,8 @@ pytest my_first_test.py --pdb
--incognito # (Enable Chrome's Incognito mode.)
--guest # (Enable Chrome's Guest mode.)
--devtools # (Open Chrome's DevTools when the browser opens.)
---reuse-session | --rs # (Reuse the browser session between tests.)
+--reuse-session | --rs # (Reuse browser session for all tests.)
+--reuse-class-session | --rcs # (Reuse session for tests in class.)
--crumbs # (Delete all cookies between tests reusing a session.)
--disable-beforeunload # (Disable the "beforeunload" event on Chrome.)
--window-size=WIDTH,HEIGHT # (Set the browser's starting window size.)
diff --git a/examples/boilerplates/ReadMe.md b/examples/boilerplates/ReadMe.md
index 786d18bf..8873621a 100755
--- a/examples/boilerplates/ReadMe.md
+++ b/examples/boilerplates/ReadMe.md
@@ -1,14 +1,14 @@
-
+
-
+ Example Boilerplates:
* Boilerplate files are located in the [SeleniumBase => examples/boilerplates/](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates) folder.
* Boilerplates can help you structure tests using common design patterns such as the Page Object Model.
* For all 20 SeleniumBase design patterns, see: [Syntax Formats](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/syntax_formats.md)
- Example Boilerplates:
+ Boilerplate Files:
* [base_test_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/base_test_case.py): This example demonstrates a test class inheriting [BaseCase](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py) for adding new methods.
* [page_objects.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/page_objects.py): This example demonstrates Page Objects for reusing commonly-used selectors in tests.
@@ -17,4 +17,4 @@
--------
-
+
diff --git a/examples/chart_maker/ReadMe.md b/examples/chart_maker/ReadMe.md
index cd4bafc9..bffbe98d 100755
--- a/examples/chart_maker/ReadMe.md
+++ b/examples/chart_maker/ReadMe.md
@@ -1,10 +1,10 @@
-## [ Boilerplate Files:
](https://github.com/seleniumbase/SeleniumBase/) ๐ ChartMaker ๐ถ
+## [
](https://github.com/seleniumbase/SeleniumBase/) ๐ ChartMaker ๐ถ
+
([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html))
@@ -40,20 +40,20 @@ pytest chart_presentation.py
Here are screenshots from the examples:
-
+
-
+
-
+
-
+
-
+
-
+
-
+ Here's a line chart example:
```python
from seleniumbase import BaseCase
@@ -83,7 +83,7 @@ pytest test_line_chart.py
Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.)
- Here's a line chart example:
+ For a more advanced example (multiple charts in a presentation):
```python
from seleniumbase import BaseCase
@@ -138,7 +138,7 @@ pytest chart_presentation.py
Multi-Series charts can also be created. Try the available examples to learn more.
- For a more advanced example (multiple charts in a presentation):
+ ChartMaker API
```python
self.create_pie_chart(
@@ -260,7 +260,7 @@ self.create_area_chart(
If creating multiple charts at the same time, you can pass the ``chart_name`` parameter to distinguish between different charts.
- ChartMaker API
+ Adding a data point to a chart:
```python
self.add_data_point(label, value, color=None, chart_name=None):
@@ -277,7 +277,7 @@ self.add_data_point(label, value, color=None, chart_name=None):
```
- Adding a data point to a chart:
+ Adding a new data series to an existing chart:
```python
self.add_series_to_chart(self, data_name=None, chart_name=None):
@@ -291,7 +291,7 @@ self.add_series_to_chart(self, data_name=None, chart_name=None):
```
- Adding a new data series to an existing chart:
+ Saving a chart to a file:
```python
self.save_chart(chart_name=None, filename=None):
@@ -307,7 +307,7 @@ self.save_chart(chart_name=None, filename=None):
The full HTML of the chart is saved to the ``saved_charts/`` folder.
- Saving a chart to a file:
+ Extracting the HTML of a chart:
```python
self.extract_chart(chart_name=None):
@@ -319,7 +319,7 @@ self.extract_chart(chart_name=None):
```
- Extracting the HTML of a chart:
+ Displaying a chart in the browser window:
```python
self.display_chart(chart_name=None, filename=None):
diff --git a/examples/desktop_apps/ReadMe.md b/examples/desktop_apps/ReadMe.md
index b8ac7c11..0a2c31ee 100755
--- a/examples/desktop_apps/ReadMe.md
+++ b/examples/desktop_apps/ReadMe.md
@@ -1,5 +1,5 @@
- Displaying a chart in the browser window:
+
-
+ Desktop Apps
* **Recorder** (Run using ``python recorder.py`` or ``sbase recorder``)
diff --git a/examples/presenter/ReadMe.md b/examples/presenter/ReadMe.md
index 575ff31e..0ff32d4a 100755
--- a/examples/presenter/ReadMe.md
+++ b/examples/presenter/ReadMe.md
@@ -6,7 +6,7 @@
Here's a sample presentation:
- Desktop Apps
+
([Click on the image/GIF for the actual presentation](https://seleniumbase.io/other/presenter.html))
@@ -23,7 +23,7 @@ pytest my_presentation.py
**Here's a presentation with a chart:**
-
+
([Click on the image/GIF for the actual presentation](https://seleniumbase.io/other/core_presentation.html))
@@ -150,7 +150,7 @@ class MyPresenterClass(BaseCase):
)
self.add_slide(
'Add images to slides:
',
- image="https://seleniumbase.io/other/seagulls.jpg")
+ image="https://seleniumbase.github.io/other/seagulls.jpg")
self.add_slide(
'Add code to slides:
',
code=(
@@ -220,7 +220,7 @@ class MyPresenterClass(BaseCase):
'self.create_presentation(theme="league")'))
self.add_slide(
'The End
',
- image="https://seleniumbase.io/img/sb_logo_10.png")
+ image="https://seleniumbase.github.io/img/sb_logo_10.png")
self.begin_presentation(
filename="presenter.html", show_notes=True, interval=0)
```
diff --git a/examples/tour_examples/ReadMe.md b/examples/tour_examples/ReadMe.md
index cdd1dab1..00529813 100755
--- a/examples/tour_examples/ReadMe.md
+++ b/examples/tour_examples/ReadMe.md
@@ -2,7 +2,7 @@
-## [](https://github.com/seleniumbase/SeleniumBase/) Interactive Product Tours ๐
+## [
](https://github.com/seleniumbase/SeleniumBase/) Interactive Product Tours ๐
](https://github.com/seleniumbase/SeleniumBase/) ๐ Translated Tests ๐บ
+## [
](https://github.com/seleniumbase/SeleniumBase/) ๐ Translated Tests ๐บ
SeleniumBase supports the following 10 languages: English, Chinese, Dutch, French, Italian, Japanese, Korean, Portuguese, Russian, and Spanish. (Examples can be found in SeleniumBase/examples/translations)
@@ -39,7 +39,7 @@ class ็งใฎใในใใฏใฉใน(ใปใฌใใฆใ ใในใใฑใผใน):
```
-
+ Translation API ๐บ
You can use SeleniumBase to selectively translate the method names of any test from one language to another with the console scripts interface. Additionally, the ``import`` line at the top of the Python file will change to import the new ``BaseCase``. Example: ``BaseCase`` becomes ``CasoDeTeste`` when a test is translated into Portuguese.
@@ -88,4 +88,4 @@ plus the 2-letter language code of the new language.
--------
- Translation API ๐บ
+
diff --git a/examples/visual_testing/ReadMe.md b/examples/visual_testing/ReadMe.md
index 3218963c..24f75a76 100755
--- a/examples/visual_testing/ReadMe.md
+++ b/examples/visual_testing/ReadMe.md
@@ -1,8 +1,8 @@
-
+
-## [](https://github.com/seleniumbase/SeleniumBase/) Automated Visual Regression Testing
+## [
](https://github.com/seleniumbase/SeleniumBase/) Automated Visual Regression Testing
Automated Visual Regression Testing can help you detect when the layout of a web page has changed. Instead of comparing pixels from screenshots, layout differences can be detected by comparing HTML tags and attributes with a baseline. If a change is detected, it could mean that something broke, the web page was redesigned, or dynamic content changed.
@@ -138,7 +138,7 @@ First differing element 33:
Here's the ``side_by_side.html`` file for that, (from the ``./latest_logs/`` folder), which shows a visual comparison of the two screenshots as a result of the missing "Donate" button:
-
+
Here's another example, where a web site logo is resized:
@@ -185,7 +185,7 @@ pytest test_layout_fail.py --html=report.html
```
Here's what the pytest HTML Report looks like:
-[](https://seleniumbase.io/cdn/img/visual_testing_report_2.png)
+[
](https://seleniumbase.github.io/cdn/img/visual_testing_report_2.png)
--------
diff --git a/help_docs/ReadMe.md b/help_docs/ReadMe.md
index 252ed66d..6edc13df 100755
--- a/help_docs/ReadMe.md
+++ b/help_docs/ReadMe.md
@@ -1,25 +1,27 @@
+
+
## [
](https://github.com/seleniumbase/SeleniumBase/) Help Docs
๐ฐ Features |
๐๏ธ Options
๐ Examples |
-๐ฑ Mobile
+๐ฑ Emulator
-๐ก Syntax Formats |
-๐ค CI/CD
+๐ Console Scripts |
+๐ Grid
๐ Methods / APIs |
๐ Tours
-๐ Console Scripts |
-๐ Grid
+๐ก Syntax Formats |
+๐ค CI/CD
โป๏ธ Boilerplates |
๐พ Locale Codes
@@ -27,12 +29,12 @@
๐น๏ธ JS Manager |
๐ผ๏ธ Visual Testing
-โบ๏ธ Recorder |
-๐ Node GUI
-
๐ Translator |
๐ Dialog Boxes
+โบ๏ธ Recorder |
+๐ Migrate
+
๐๏ธ Slides |
๐ถ Charts
](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Case Plans ๐๏ธ
+## [
](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Case Plans ๐๏ธ
-
+
๐๏ธ SeleniumBase Case Plans is Test Case Management Software that uses Markdown tables for displaying test plans directly in GitHub (and other source code management systems that support Markdown format).
@@ -160,7 +160,7 @@
sbase caseplans
```
-
+
๐๏ธ Once you are running the Case Plans GUI, select the existing tests that need Case Plans, and then click: ``Generate boilerplate Case Plans for selected tests missing them``. For each selected test that didn't already have a Case Plan file, one will be generated. Each new Case Plan file starts with default boilerplate code with a Markdown table. Eg:
@@ -200,11 +200,11 @@ sbase caseplans
๐๏ธ After you've created some Case Plans, you can use the ``Generate Summary of existing Case Plans`` button in the Case Plans GUI to generate the Case Plans Summary file.
-
+
๐๏ธ The generated Case Plans summary file, ``case_summary.md``, gets created in the same location where the Case Plans GUI was launched. This is NOT the same location where individual Case Plan boilerplates are generated, which is in the ``case_plans/`` folders. The ``case_plans/`` folders are generated where individual tests live, which means that if you have your tests in multiple folders, then you could also have multiple ``case_plans/`` folders. A ``case_summary.md`` file may look like this when rendered:
-
+
๐๏ธ When calling ``sbase caseplans``, you can provide additional arguments to limit the tests that appear in the list. The same discovery rules apply as when using ``pytest``. Eg:
diff --git a/help_docs/customizing_test_runs.md b/help_docs/customizing_test_runs.md
index e571bea3..3360ca97 100755
--- a/help_docs/customizing_test_runs.md
+++ b/help_docs/customizing_test_runs.md
@@ -84,7 +84,7 @@ pytest my_first_test.py --settings-file=custom_settings.py
๐๏ธ Here are some useful command-line options that come with ``pytest``:
```bash
--v # Verbose mode. Prints the full name of each test run.
+-v # Verbose mode. Prints the full name of each test and shows more details.
-q # Quiet mode. Print fewer details in the console output when running tests.
-x # Stop running the tests after the first failure is reached.
--html=report.html # Creates a detailed pytest-html report after tests finish.
@@ -172,7 +172,8 @@ pytest my_first_test.py --settings-file=custom_settings.py
--incognito # (Enable Chrome's Incognito mode.)
--guest # (Enable Chrome's Guest mode.)
--devtools # (Open Chrome's DevTools when the browser opens.)
---reuse-session | --rs # (Reuse the browser session between tests.)
+--reuse-session | --rs # (Reuse browser session for all tests.)
+--reuse-class-session | --rcs # (Reuse session for tests in class.)
--crumbs # (Delete all cookies between tests reusing a session.)
--disable-beforeunload # (Disable the "beforeunload" event on Chrome.)
--window-size=WIDTH,HEIGHT # (Set the browser's starting window size.)
diff --git a/help_docs/mobile_testing.md b/help_docs/mobile_testing.md
index 65d15f66..d67de06a 100755
--- a/help_docs/mobile_testing.md
+++ b/help_docs/mobile_testing.md
@@ -12,7 +12,7 @@ Use ``--mobile`` to run SeleniumBase tests using Chrome's mobile device emulator
pytest test_skype_site.py --mobile
```
-[
](https://seleniumbase.io/cdn/gif/skype_mobile_test_2.gif)
+[
](https://seleniumbase.github.io/cdn/gif/skype_mobile_test_2.gif)
To configure Device Metrics, use:
diff --git a/help_docs/syntax_formats.md b/help_docs/syntax_formats.md
index dace25ee..87dcf189 100755
--- a/help_docs/syntax_formats.md
+++ b/help_docs/syntax_formats.md
@@ -4,7 +4,7 @@
## [
](https://github.com/seleniumbase/SeleniumBase/) The 23 Syntax Formats
-SeleniumBase currently supports 23 unique syntax formats (AKA "design patterns") for structuring tests.
+
SeleniumBase currently supports 23 unique syntax formats ("design patterns") for structuring tests.
--------
@@ -42,7 +42,11 @@
-This format is used by most of the examples in the SeleniumBase examples folder. It's a great starting point for anyone learning SeleniumBase, and it follows good object-oriented programming principles. In this format, 1. BaseCase direct class inheritance
BaseCase
is imported at the top of a Python file, followed by a Python class inheriting BaseCase
. Then, any test method defined in that class automatically gains access to SeleniumBase methods, including the setUp()
and tearDown()
methods that are automatically called to spin up and spin down web browsers at the beginning and end of test methods. Here's an example of that:
+This format is used by most of the examples in the SeleniumBase examples folder. It's a great starting point for anyone learning SeleniumBase, and it follows good object-oriented programming principles.
+
+In this format, BaseCase
is imported at the top of a Python file, followed by a Python class inheriting BaseCase
. Then, any test method defined in that class automatically gains access to SeleniumBase methods, including the setUp()
and tearDown()
methods that are automatically called to spin up and spin down web browsers at the beginning and end of test methods.
+
+To run a test of this format, use **``pytest``** or ``nosetests``. If you add: ``if __name__ == "__main__":`` ``pytest.main([__file__])`` to the file, you can also use ``python`` as a runner, which invokes ``pytest``. Here's an example a script that uses ``BaseCase`` inheritance:
```python
from seleniumbase import BaseCase
@@ -57,6 +61,10 @@ class MyTestClass(BaseCase):
self.click_link("SeleniumBase Demo Page")
self.assert_exact_text("Demo Page", "h1")
self.assert_no_js_errors()
+
+if __name__ == "__main__": # To run with "python" instead of "pytest".
+ from pytest import main
+ main([__file__])
```
(See examples/test_demo_site.py for the full test.)
@@ -238,7 +246,7 @@ class OverrideDriverTest(BaseCase):
options.add_argument("--disable-3d-apis")
options.add_argument("--disable-notifications")
if self.headless:
- options.add_argument("--headless")
+ options.add_argument("--headless=chrome")
options.add_argument("--disable-gpu")
options.add_experimental_option(
"excludeSwitches", ["enable-automation", "enable-logging"],
@@ -292,41 +300,37 @@ import pytest
@pytest.fixture()
def sb(request):
- import sys
from selenium import webdriver
from seleniumbase import BaseCase
class BaseClass(BaseCase):
- def setUp(self):
- super(BaseClass, self).setUp()
-
- def tearDown(self):
- self.save_teardown_screenshot() # On failure or "--screenshot"
- super(BaseClass, self).tearDown()
-
- def base_method(self):
- pass
-
def get_new_driver(self, *args, **kwargs):
"""This method overrides get_new_driver() from BaseCase."""
options = webdriver.ChromeOptions()
- if "linux" in sys.platform:
+ if self.headless:
options.add_argument("--headless=chrome")
+ options.add_argument("--disable-gpu")
options.add_experimental_option(
"excludeSwitches", ["enable-automation"],
)
return webdriver.Chrome(options=options)
- if request.cls:
- request.cls.sb = BaseClass("base_method")
- request.cls.sb.setUp()
- yield request.cls.sb
- request.cls.sb.tearDown()
- else:
- sb = BaseClass("base_method")
- sb.setUp()
- yield sb
- sb.tearDown()
+ def setUp(self):
+ super(BaseClass, self).setUp()
+
+ def base_method(self):
+ pass
+
+ def tearDown(self):
+ self.save_teardown_screenshot() # On failure or "--screenshot"
+ super(BaseClass, self).tearDown()
+
+ sb = BaseClass("base_method")
+ sb.setUpClass()
+ sb.setUp()
+ yield sb
+ sb.tearDown()
+ sb.tearDownClass()
def test_override_fixture_no_class(sb):
sb.open("https://seleniumbase.io/demo_page")
@@ -352,6 +356,15 @@ def sb(request):
from seleniumwire import webdriver # Requires "pip install selenium-wire"
class BaseClass(BaseCase):
+ def get_new_driver(self, *args, **kwargs):
+ options = webdriver.ChromeOptions()
+ if "linux" in sys.platform:
+ options.add_argument("--headless=chrome")
+ options.add_experimental_option(
+ "excludeSwitches", ["enable-automation"],
+ )
+ return webdriver.Chrome(options=options)
+
def setUp(self):
super(BaseClass, self).setUp()
@@ -362,25 +375,12 @@ def sb(request):
def base_method(self):
pass
- def get_new_driver(self, *args, **kwargs):
- options = webdriver.ChromeOptions()
- if "linux" in sys.platform:
- options.add_argument("--headless=chrome")
- options.add_experimental_option(
- "excludeSwitches", ["enable-automation"],
- )
- return webdriver.Chrome(options=options)
-
- if request.cls:
- request.cls.sb = BaseClass("base_method")
- request.cls.sb.setUp()
- yield request.cls.sb
- request.cls.sb.tearDown()
- else:
- sb = BaseClass("base_method")
- sb.setUp()
- yield sb
- sb.tearDown()
+ sb = BaseClass("base_method")
+ sb.setUpClass()
+ sb.setUp()
+ yield sb
+ sb.tearDown()
+ sb.tearDownClass()
def test_wire_with_no_class(sb):
sb.open("https://seleniumbase.io/demo_page")
@@ -394,7 +394,7 @@ class TestWire:
print(request.url)
```
-(NOTE: The ``selenium-wire`` integration is now included with ``seleniumbase``: Add ``--wire`` as a ``pytest`` command-line option to activate. If you need both ``--wire`` with ``--undetected`` together, you'll still need to override ``get_new_driver()``.)
+(NOTE: The ``selenium-wire`` integration is now included with ``seleniumbase``: Add ``--wire`` as a ``pytest`` command-line option to activate. If you need both ``--wire`` with ``--undetected`` modes together, you'll still need to override ``get_new_driver()``.)
diff --git a/help_docs/thank_you.md b/help_docs/thank_you.md
index d4fb2d9e..315c0d4d 100755
--- a/help_docs/thank_you.md
+++ b/help_docs/thank_you.md
@@ -10,8 +10,8 @@
11. BaseCase with Chinese translations