Skip to content

Mostly Bug Fixes #1471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<br />
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md">🎖️ GUI</a> |
<a href="https://seleniumbase.io/demo_page">📰 TestPage</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">📒 CasePlans</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">🗂️ CasePlans</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/html_inspector.md">🔎 Inspector</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🧬 Hybrid</a> |
<a href="https://seleniumbase.io/devices/?url=seleniumbase.com">💻 Farm</a>
Expand Down Expand Up @@ -877,9 +877,9 @@ self.wait_for_element_present("div.my_class", timeout=10)
self.wait_for_element_visible("a.my_class", timeout=5)
```

(NOTE: The short versions of this are ``self.find_element(ELEMENT)`` and ``self.assert_element(ELEMENT)``. The find_element() version returns the element)
(NOTE: The short versions of that are ``self.find_element(ELEMENT)`` and ``self.assert_element(ELEMENT)``. The ``find_element()`` version returns the element.)

Since the line above returns the element, you can combine that with .click() as shown below:
Since the line above returns the element, you can combine that with ``.click()`` as shown below:

```python
self.find_element("a.my_class", timeout=5).click()
Expand Down
22 changes: 11 additions & 11 deletions help_docs/case_plans.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Case Plans 📒🗂️
## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) SeleniumBase Case Plans 🗂️

<img src="https://seleniumbase.io/cdn/img/cp/sb_case_plans.png" title="SeleniumBase Case Plans Summary" width="625">

📒 <b>SeleniumBase Case Plans</b> 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).
🗂️ <b>SeleniumBase Case Plans</b> 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).

📒 The ``case_summary.md`` file is generated from individual Case Plans that exist in the ``case_plans/`` folders of your repository. (See the example below to learn how the Case Summary file may look.)
🗂️ The ``case_summary.md`` file is generated from individual Case Plans that exist in the ``case_plans/`` folders of your repository. (See the example below to learn how the Case Summary file may look.)

--------

Expand Down Expand Up @@ -152,15 +152,15 @@

--------

📒 Before you can generate a ``case_summary.md`` file that includes your existing Case Plans, first you'll need to select which existing tests you want to create boilerplate Case Plans from. For that, you can use the SeleniumBase Case Plans GUI:
🗂️ Before you can generate a ``case_summary.md`` file that includes your existing Case Plans, first you'll need to select which existing tests you want to create boilerplate Case Plans from. For that, you can use the SeleniumBase Case Plans GUI:

```bash
sbase caseplans
```

<img src="https://seleniumbase.io/cdn/img/cp/case_plan_boilerplate_gen.png" title="SeleniumBase Case Plans GUI" width="525">

📒 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:
🗂️ 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:

```bash
``proxy_test.py::ProxyTests::test_proxy``
Expand All @@ -172,7 +172,7 @@ sbase caseplans

```

📒 When rendered as a Markdown table, the result looks like this:
🗂️ When rendered as a Markdown table, the result looks like this:

``proxy_test.py::ProxyTests::test_proxy``
---
Expand All @@ -181,9 +181,9 @@ sbase caseplans
| 1 | Perform Action 1 | Verify Action 1 |
| 2 | Perform Action 2 | Verify Action 2 |

📒 Markdown tables are flexible, but must be constructed correctly to be displayed. For a Markdown table to render, it's important that you place pipes (``|``), dashes (``-``), and spaces in the correct locations. If you want a line break in a step, use ``<br />``. If you want an empty step, put a space between pipes, eg: ``| |``.
🗂️ Markdown tables are flexible, but must be constructed correctly to be displayed. For a Markdown table to render, it's important that you place pipes (``|``), dashes (``-``), and spaces in the correct locations. If you want a line break in a step, use ``<br />``. If you want an empty step, put a space between pipes, eg: ``| |``.

📒 Here's an example of a Case Plan for [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py):
🗂️ Here's an example of a Case Plan for [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py):

``my_first_test.py::MyTestClass::test_swag_labs``
---
Expand All @@ -196,15 +196,15 @@ sbase caseplans
| 5 | Click on the ``FINISH`` button. | There is a ``Thank You`` message and a ``Pony Express`` delivery logo. |
| 6 | Log out from the website. | Logout was successful. |

📒 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.
🗂️ 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.

<img src="https://seleniumbase.io/cdn/img/cp/case_plan_summary_gen.png" title="SeleniumBase Case Plans GUI" width="550">

📒 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:
🗂️ 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:

<img src="https://seleniumbase.io/cdn/img/cp/case_plan_summary.png" title="SeleniumBase Case Plans Summary" width="550">

📒 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:
🗂️ 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:

```bash
sbase caseplans
Expand Down
2 changes: 1 addition & 1 deletion help_docs/customizing_test_runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/
🎛️ You might also want to combine multiple options at once. For example:

```bash
pytest -n=4 --reuse-session --headless -v --dashboard --html=report.html
pytest --headless --rs -n=4 -v --dashboard --html=report.html
```

The above not only runs tests in parallel processes, but it also tells tests in the same process to share the same browser session, runs the tests in headless mode, displays the full name of each test on a separate line, creates a realtime dashboard of the test results, and creates a full report after all tests complete.
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ copyright: Copyright &copy; 2014 - 2022 Michael Mintz
markdown_extensions:
- admonition
- md_in_html
- tables
- toc:
permalink: true
- pymdownx.highlight:
linenums: false
- pymdownx.tabbed:
alternate_style: true
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.inlinehilite
Expand Down
4 changes: 2 additions & 2 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Jinja2==3.1.2
click==8.1.3
zipp==3.8.1
ghp-import==2.1.0
readme-renderer==36.0
readme-renderer==37.0
pymdown-extensions==9.5
importlib-metadata==4.12.0
bleach==5.0.1
Expand All @@ -25,7 +25,7 @@ nltk==3.7
tornado==6.2
watchdog==2.1.9
mkdocs==1.3.1
mkdocs-material==8.4.0
mkdocs-material==8.4.1
mkdocs-exclude-search==0.6.4
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.0.3
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ packaging>=20.9;python_version<"3.6"
packaging>=21.3;python_version>="3.6"
setuptools>=44.1.1;python_version<"3.6"
setuptools>=59.6.0;python_version>="3.6" and python_version<"3.7"
setuptools>=65.1.0;python_version>="3.7"
setuptools>=65.2.0;python_version>="3.7"
tomli>=1.2.3;python_version>="3.6" and python_version<"3.7"
tomli>=2.0.1;python_version>="3.7"
wheel>=0.37.1
Expand Down Expand Up @@ -38,8 +38,8 @@ chardet==3.0.4;python_version<"3.6"
chardet==4.0.0;python_version>="3.6" and python_version<"3.7"
chardet==5.0.0;python_version>="3.7"
charset-normalizer==2.0.12;python_version>="3.6" and python_version<"3.7"
charset-normalizer==2.1.0;python_version>="3.7"
urllib3==1.26.11
charset-normalizer==2.1.1;python_version>="3.7"
urllib3==1.26.12
requests==2.27.1;python_version<"3.6"
requests==2.27.1;python_version>="3.6" and python_version<"3.7"
requests==2.28.1;python_version>="3.7"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.0.0"
__version__ = "4.0.1"
2 changes: 2 additions & 0 deletions seleniumbase/behave/behave_sb.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def get_configured_sb(context):
sb.browser = "chrome"
sb.is_behave = True
sb.headless = False
sb.headless_active = False
sb.headed = False
sb.xvfb = False
sb.start_page = None
Expand Down Expand Up @@ -758,6 +759,7 @@ def get_configured_sb(context):
# Set sb_config
sb_config.browser = sb.browser
sb_config.headless = sb.headless
sb_config.headless_active = False
sb_config.headed = sb.headed
sb_config.window_size = sb.window_size
sb_config.maximize_option = sb.maximize_option
Expand Down
32 changes: 26 additions & 6 deletions seleniumbase/console_scripts/sb_caseplans.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,37 @@ def view_summary_of_existing_case_plans(root, tests):
file.close()

if num_ready_cases < 10:
msg_ready_cases = " %s" % msg_ready_cases
msg_ready_cases = " %s" % msg_ready_cases
if num_ready_cases < 100:
msg_ready_cases = " %s" % msg_ready_cases
msg_ready_cases = " %s" % msg_ready_cases
if num_boilerplate < 10:
msg_boilerplate = " %s" % msg_boilerplate
msg_boilerplate = " %s" % msg_boilerplate
if num_boilerplate < 100:
msg_boilerplate = " %s" % msg_boilerplate
msg_boilerplate = " %s" % msg_boilerplate
if num_in_progress < 10:
msg_in_progress = " %s" % msg_in_progress
msg_in_progress = " %s" % msg_in_progress
if num_in_progress < 100:
msg_in_progress = " %s" % msg_in_progress
msg_in_progress = " %s" % msg_in_progress
gen_message = (
'🗂️ Summary generated at "case_summary.md":'
'\n🔵 %s'
'\n⭕ %s'
'\n🚧 %s'
% (msg_ready_cases, msg_boilerplate, msg_in_progress)
)
print(gen_message)
if num_ready_cases < 10:
msg_ready_cases = " %s" % msg_ready_cases
if num_ready_cases < 100:
msg_ready_cases = " %s" % msg_ready_cases
if num_boilerplate < 10:
msg_boilerplate = " %s" % msg_boilerplate
if num_boilerplate < 100:
msg_boilerplate = " %s" % msg_boilerplate
if num_in_progress < 10:
msg_in_progress = " %s" % msg_in_progress
if num_in_progress < 100:
msg_in_progress = " %s" % msg_in_progress
messagebox.showinfo(
"Case Plans Summary generated!",
'\nSummary generated at "case_summary.md"'
Expand Down
4 changes: 3 additions & 1 deletion seleniumbase/core/log_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ def get_test_id(test):


def get_test_name(test):
if test.is_pytest:
if "PYTEST_CURRENT_TEST" in os.environ:
test_name = os.environ["PYTEST_CURRENT_TEST"].split(" ")[0]
elif test.is_pytest:
test_name = "%s.py::%s::%s" % (
test.__class__.__module__.split(".")[-1],
test.__class__.__name__,
Expand Down
5 changes: 4 additions & 1 deletion seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ def open(self, url):
try:
self.driver.get(url)
except Exception as e:
if "ERR_CONNECTION_TIMED_OUT" in e.msg:
if (
"ERR_CONNECTION_TIMED_OUT" in e.msg
or "ERR_CONNECTION_CLOSED" in e.msg
):
time.sleep(0.5)
self.driver.get(url)
elif (
Expand Down
4 changes: 2 additions & 2 deletions seleniumbase/fixtures/js_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def wait_for_css_query_selector(
)


def highlight_with_js(driver, selector, loops, o_bs):
def highlight_with_js(driver, selector, loops=4, o_bs=""):
try:
# This closes any pop-up alerts
driver.execute_script("")
Expand Down Expand Up @@ -374,7 +374,7 @@ def highlight_with_js(driver, selector, loops, o_bs):
return


def highlight_with_jquery(driver, selector, loops, o_bs):
def highlight_with_jquery(driver, selector, loops=4, o_bs=""):
try:
# This closes any pop-up alerts
driver.execute_script("")
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
'packaging>=21.3;python_version>="3.6"',
'setuptools>=44.1.1;python_version<"3.6"',
'setuptools>=59.6.0;python_version>="3.6" and python_version<"3.7"',
'setuptools>=65.1.0;python_version>="3.7"',
'setuptools>=65.2.0;python_version>="3.7"',
'tomli>=1.2.3;python_version>="3.6" and python_version<"3.7"',
'tomli>=2.0.1;python_version>="3.7"',
"wheel>=0.37.1",
Expand Down Expand Up @@ -164,8 +164,8 @@
'chardet==4.0.0;python_version>="3.6" and python_version<"3.7"',
'chardet==5.0.0;python_version>="3.7"', # Stay in sync with "requests"
'charset-normalizer==2.0.12;python_version>="3.6" and python_version<"3.7"', # noqa: E501
'charset-normalizer==2.1.0;python_version>="3.7"', # Sync "requests"
'urllib3==1.26.11', # Stay in sync with "requests"
'charset-normalizer==2.1.1;python_version>="3.7"', # Sync "requests"
'urllib3==1.26.12', # Stay in sync with "requests"
'requests==2.27.1;python_version<"3.7"',
'requests==2.28.1;python_version>="3.7"',
"nose==1.3.7",
Expand Down