Skip to content

Commit 3b7607f

Browse files
authored
Merge pull request #714 from seleniumbase/improve-messenger-compatibility
Improve Messenger compatibility
2 parents fa63c55 + 8a9d143 commit 3b7607f

File tree

7 files changed

+64
-42
lines changed

7 files changed

+64
-42
lines changed

README.md

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<meta property="og:site_name" content="SeleniumBase | Docs">
22
<meta property="og:title" content="SeleniumBase | Python Web Testing" />
33
<meta property="og:description" content="Build fast, reliable, end-to-end tests." />
4+
<meta property="og:keywords" content="Python, pytest, selenium, webdriver, test automation, framework">
45
<meta property="og:image" content="https://seleniumbase.io/cdn/img/sb_logo_dh.png" />
56
<link rel="icon" href="https://seleniumbase.io/img/logo3a.png" />
67

78
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/">
8-
<img src="https://seleniumbase.io/img/sb_logo_10.png" alt="SeleniumBase" width="284" /></a><a href="https://github.com/seleniumbase/SeleniumBase/">
9-
<img src="https://seleniumbase.io/cdn/img/sb_demo_site.png" alt="SeleniumBase" width="284" />
9+
<img src="https://seleniumbase.io/img/sb_logo_10.png" alt="SeleniumBase" width="272" /></a><a href="https://github.com/seleniumbase/SeleniumBase/">
10+
<img src="https://seleniumbase.io/cdn/img/sb_demo_site.png" alt="SeleniumBase" width="244" />
1011
</a></p>
1112
<p align="center"><b>A complete end-to-end testing experience.</b></p>
1213
<p align="center">Extends <a href="https://www.w3.org/TR/webdriver/">Selenium/WebDriver</a> and <a href="https://docs.pytest.org/en/latest/index.html">pytest</a>.</p>
1314
<!-- View on GitHub -->
1415
<p align="center">
1516
<a href="https://github.com/seleniumbase/SeleniumBase/releases">
1617
<img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=2277EE" alt="Latest Release on GitHub" /></a> <a href="https://pypi.python.org/pypi/seleniumbase">
17-
<img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=22AAEE" alt="Latest Release on PyPI" /></a> <a href="https://seleniumbase.io">
18-
<img src="https://img.shields.io/badge/docs-%20seleniumbase.io-11BBDD.svg" alt="SeleniumBase.io Docs" /></a> <a href="https://travis-ci.org/seleniumbase/SeleniumBase">
18+
<img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=22AAEE" alt="Latest Release on PyPI" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase">
19+
<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="SeleniumBase" /></a> <a href="https://travis-ci.org/seleniumbase/SeleniumBase">
1920
<img src="https://img.shields.io/travis/seleniumbase/SeleniumBase/master.svg" alt="SeleniumBase on TravisCI" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/actions">
20-
<img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase">
21-
<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="SeleniumBase" /></a>
21+
<img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://seleniumbase.io">
22+
<img src="https://img.shields.io/badge/docs-%20seleniumbase.io-FACE48.svg" alt="SeleniumBase.io Docs" /></a>
2223
</p>
2324

2425
<p>
@@ -55,27 +56,25 @@ Tests are run with <b>pytest</b>. Browsers are controlled by <b>WebDriver</b>.
5556
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🛂 MasterQA</a>
5657
</p>
5758

58-
<p align="center"><img src="https://cdn2.hubspot.net/hubfs/100006/images/swag_labs_gif.gif" alt="SeleniumBase" title="SeleniumBase" /></p>
59+
<p align="center"><img src="https://cdn2.hubspot.net/hubfs/100006/images/swag_mobile.gif" alt="SeleniumBase Testing" title="SeleniumBase Testing" /></p>
5960

6061
<a id="python_installation"></a>
6162
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Start: 🚀</h2>
6263

6364
* Add **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)** to your System PATH.
6465

65-
* Upgrade <b>[pip](https://pypi.org/project/pip/)</b> and create a [Python virtual env](https://seleniumbase.io/help_docs/virtualenv_instructions/):
66+
* Create a [Python virtual environment](https://seleniumbase.io/help_docs/virtualenv_instructions/):
6667

6768
> macOS/Linux (terminal):
6869
6970
```bash
70-
python3 -m pip install -U pip
7171
python3 -m venv sbase_env
7272
source sbase_env/bin/activate
7373
```
7474

7575
> Windows (CMD prompt):
7676
7777
```bash
78-
py -m pip install -U pip
7978
py -m venv sbase_env
8079
call sbase_env\\Scripts\\activate
8180
```
@@ -109,7 +108,7 @@ pip install -e . # Editable install
109108
\__ \/ _ \/ / _ \/ __ \/ / / / / __ `__ \/ /_) / __ \/ ___/ _ \
110109
___/ / __/ / __/ / / / / /_/ / / / / / / /_) / (_/ /__ / __/
111110
/____/\___/_/\___/_/ /_/_/\__,_/_/ /_/ /_/_____/\__,_/____/\___/
112-
111+
-----------------------------------------------------------------
113112
[seleniumbase <VERSION> (<PATH>)]
114113
115114
* USAGE: "seleniumbase [COMMAND] [PARAMETERS]"
@@ -160,24 +159,36 @@ sbase install chromedriver latest
160159
161160
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Create and run tests:</h3>
162161
163-
* Use ``sbase mkdir DIR`` to create a folder with sample tests:
162+
* ``sbase mkdir DIR`` creates a folder with sample tests:
164163
165164
```bash
166165
sbase mkdir ui_tests
167166
cd ui_tests/
168167
```
169168
170-
> This folder contains the following files:
169+
> That folder will have the following files:
171170
172171
```
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
181192
```
182193
183194
* <b>Run a sample test with ``pytest``:</b>
@@ -186,8 +197,8 @@ test_demo_site.py
186197
pytest test_demo_site.py
187198
```
188199
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``.)
191202
192203
<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>
193204
@@ -242,7 +253,7 @@ self.assert_text(TEXT) # Assert text is visible (has optional SELECTOR arg)
242253
self.assert_title(PAGE_TITLE) # Assert page title
243254
self.assert_no_404_errors() # Assert no 404 errors from files on the page
244255
self.assert_no_js_errors() # Assert no JavaScript errors on the page (Chrome-ONLY)
245-
self.execute_script(JAVASCRIPT) # Execute javascript code
256+
self.execute_script(JAVASCRIPT) # Execute JavaScript code
246257
self.go_back() # Navigate to the previous URL
247258
self.get_text(SELECTOR) # Get text from a selector
248259
self.get_attribute(SELECTOR, ATTRIBUTE) # Get a specific attribute from a selector
@@ -296,8 +307,8 @@ nosetests test_suite.py --browser=firefox
296307
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>)
297308
298309
```bash
299-
pytest [FILE_NAME].py::[CLASS_NAME]::[METHOD_NAME]
300-
nosetests [FILE_NAME].py:[CLASS_NAME].[METHOD_NAME]
310+
pytest [FILE_NAME.py]::[CLASS_NAME]::[METHOD_NAME]
311+
nosetests [FILE_NAME.py]:[CLASS_NAME].[METHOD_NAME]
301312
```
302313
303314
<h4>No more flaky tests:</h4>
@@ -441,7 +452,7 @@ Inside your tests, you can use ``self.data`` to access that.
441452
442453
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Test Directory Customization:</h3>
443454
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]``)
445456
446457
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.
447458

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
regex>=2020.9.27
2-
tqdm>=4.50.0
2+
tqdm>=4.50.2
33
livereload==2.6.3;python_version>="3.6"
4+
Markdown==3.3
45
pymdown-extensions==8.0.1
56
mkdocs==1.1.2
67
mkdocs-material==6.0.2

seleniumbase/config/proxy_list.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
"""
2121

2222
PROXY_LIST = {
23-
"example1": "45.133.182.18:18080", # (Example) - set your own proxy here
24-
"example2": "95.174.67.50:18080", # (Example) - set your own proxy here
25-
"example3": "83.97.23.90:18080", # (Example) - set your own proxy here
26-
"example4": "82.200.233.4:3128", # (Example) - set your own proxy here
23+
"example1": "212.87.220.2:3128", # (Example) - set your own proxy here
24+
"example2": "51.75.147.44:3128", # (Example) - set your own proxy here
25+
"example3": "82.200.233.4:3128", # (Example) - set your own proxy here
2726
"proxy1": None,
2827
"proxy2": None,
2928
"proxy3": None,
3 Bytes
Binary file not shown.

seleniumbase/fixtures/base_case.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4837,13 +4837,17 @@ def post_message(self, message, duration=None, pause=True, style="info"):
48374837
You can also post messages by using =>
48384838
self.execute_script('Messenger().post("My Message")')
48394839
"""
4840+
if style not in ["info", "success", "error"]:
4841+
style = "info"
48404842
if not duration:
48414843
if not self.message_duration:
48424844
duration = settings.DEFAULT_MESSAGE_DURATION
48434845
else:
48444846
duration = self.message_duration
4845-
js_utils.post_message(
4846-
self.driver, message, duration, style=style)
4847+
try:
4848+
js_utils.post_message(self.driver, message, duration, style=style)
4849+
except Exception:
4850+
print(" * %s message: %s" % (style.upper(), message))
48474851
if pause:
48484852
duration = float(duration) + 0.15
48494853
time.sleep(float(duration))
@@ -4870,8 +4874,11 @@ def post_success_message(self, message, duration=None, pause=True):
48704874
duration = settings.DEFAULT_MESSAGE_DURATION
48714875
else:
48724876
duration = self.message_duration
4873-
js_utils.post_message(
4874-
self.driver, message, duration, style="success")
4877+
try:
4878+
js_utils.post_message(
4879+
self.driver, message, duration, style="success")
4880+
except Exception:
4881+
print(" * SUCCESS message: %s" % message)
48754882
if pause:
48764883
duration = float(duration) + 0.15
48774884
time.sleep(float(duration))
@@ -4888,8 +4895,11 @@ def post_error_message(self, message, duration=None, pause=True):
48884895
duration = settings.DEFAULT_MESSAGE_DURATION
48894896
else:
48904897
duration = self.message_duration
4891-
js_utils.post_message(
4892-
self.driver, message, duration, style="error")
4898+
try:
4899+
js_utils.post_message(
4900+
self.driver, message, duration, style="error")
4901+
except Exception:
4902+
print(" * ERROR message: %s" % message)
48934903
if pause:
48944904
duration = float(duration) + 0.15
48954905
time.sleep(float(duration))

seleniumbase/fixtures/js_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,9 @@ def activate_messenger(driver):
477477
"messenger-on-bottom messenger-on-right', "
478478
"theme: 'flat'}")
479479

480-
add_js_link(driver, jquery_js)
481-
wait_for_jquery_active(driver, timeout=0.2)
480+
if not is_jquery_activated(driver):
481+
add_js_link(driver, jquery_js)
482+
wait_for_jquery_active(driver, timeout=0.9)
482483
add_css_link(driver, messenger_css)
483484
add_css_link(driver, msgr_theme_flat_css)
484485
add_css_link(driver, msgr_theme_future_css)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
4545
os.system("python -m pip install --upgrade 'twine>=1.15.0'")
4646
print("\n*** Installing tqdm: *** (Required for PyPI uploads)\n")
47-
os.system("python -m pip install --upgrade 'tqdm>=4.50.0'")
47+
os.system("python -m pip install --upgrade 'tqdm>=4.50.2'")
4848
print("\n*** Publishing The Release to PyPI: ***\n")
4949
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
5050
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
@@ -54,7 +54,7 @@
5454

5555
setup(
5656
name='seleniumbase',
57-
version='1.49.25',
57+
version='1.49.26',
5858
description='A complete framework for Web-UI testing | seleniumbase.io',
5959
long_description=long_description,
6060
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)