Skip to content

Commit fcbbb73

Browse files
authored
Merge pull request #800 from seleniumbase/update-dashboard-and-dependencies
Update the dashboard and Python dependencies
2 parents 5ab6a66 + d44f543 commit fcbbb73

File tree

11 files changed

+89
-54
lines changed

11 files changed

+89
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/">
99
<img src="https://seleniumbase.io/img/sb_logo_10.png" alt="SeleniumBase" title="SeleniumBase" width="280" /></a></p>
1010
<p align="center">
11-
<b>Everything you need to test websites.</b>
11+
<b>Build fast, reliable, end-to-end tests.</b>
1212
</p>
1313

1414
<!-- View on GitHub -->

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ regex>=2020.11.13
22
tqdm>=4.56.0
33
livereload==2.6.3;python_version>="3.6"
44
Markdown==3.3.3
5+
Jinja2==2.11.3
56
readme-renderer==28.0
67
pymdown-extensions==8.1.1
78
mkdocs==1.1.2
8-
mkdocs-material==6.2.6
9+
mkdocs-material==6.2.7
910
mkdocs-simple-hooks==0.1.2
1011
mkdocs-material-extensions==1.0.1
1112
mkdocs-minify-plugin==0.4.0

examples/visual_testing/ReadMe.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/sb_logo_f6.png" alt="SeleniumBase" width="320" /></a></p>
22

3-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Automated Visual Regression Testing
3+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Automated Visual Regression Testing</h2>
44

55
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.
66

@@ -10,35 +10,42 @@ Automated Visual Regression Testing can help you detect when the layout of a web
1010

1111
To handle automated visual testing, SeleniumBase uses the ``self.check_window()`` method, which can set visual baselines for comparison and then compare the latest versions of web pages to the existing baseline.
1212

13-
The first time a test calls ``self.check_window()`` with a unique "name" parameter, the visual baseline is set, which means a folder is created with the following files:
14-
* page_url.txt -> The URL of the current window
15-
* screenshot.png -> A screenshot of the current window
16-
* tags_level1.txt -> HTML tags from the window
17-
* tags_level2.txt -> HTML tags + attribute names
18-
* tags_level3.txt -> HTML tags + attribute names+values
13+
The first time a test calls ``self.check_window()`` with a unique ``name`` parameter, the visual baseline is set, which means a folder is created with the following files:
14+
15+
<li><b>page_url.txt</b> -> The URL of the current window</li>
16+
<li><b>screenshot.png</b> -> A screenshot of the current window</li>
17+
<li><b>tags_level1.txt</b> -> HTML tags from the window</li>
18+
<li><b>tags_level2.txt</b> -> HTML tags + attribute names</li>
19+
<li><b>tags_level3.txt</b> -> HTML tags + attribute names+values</li>
1920

2021
After the first time ``self.check_window()`` is called, later calls will compare the HTML tags and attributes of the latest window to the ones from the first call (<i>or to the ones from the call when the baseline was last reset</i>).
2122

2223
Here's an example call:
23-
```
24+
25+
```python
2426
self.check_window(name="first_test)", level=3)
2527
```
28+
2629
On the first run (<i>or if the baseline is being set/reset</i>) the "level" doesn't matter because that's only used for comparing the current layout to the existing baseline.
2730

2831
Here's how the level system works:
29-
* level=0 ->
30-
DRY RUN ONLY - Will perform a comparison to the baseline, and print out any differences that are found, but won't fail the test even if differences exist.
31-
* level=1 ->
32-
HTML tags are compared to tags_level1.txt
33-
* level=2 ->
34-
HTML tags and attribute names are compared to tags_level2.txt
35-
* level=3 ->
36-
HTML tags and attribute names+values are compared to tags_level3.txt
32+
33+
<li><b>level=0</b> ->
34+
DRY RUN ONLY - Will perform a comparison to the baseline, and print out any differences that are found, but won't fail the test even if differences exist.</li>
35+
<li><b>level=1</b> ->
36+
HTML tags are compared to tags_level1.txt</li>
37+
<li><b>level=2</b> ->
38+
HTML tags and attribute names are compared to tags_level2.txt</li>
39+
<li><b>level=3</b> ->
40+
HTML tags and attribute names+values are compared to tags_level3.txt</li>
3741

3842
As shown, Level-3 is the most strict, Level-1 is the least strict. If the comparisons from the latest window to the existing baseline don't match, the current test will fail, except for Level-0 checks, which print Level-3 results without failing the test.
3943

4044
You can reset the visual baseline on the command line by adding the following parameter at runtime:
41-
``--visual_baseline``
45+
46+
```bash
47+
--visual_baseline
48+
```
4249

4350
As long as ``--visual_baseline`` is used on the command line while running tests, the ``self.check_window()`` method cannot fail because it will rebuild the visual baseline rather than comparing the html tags of the latest run to the existing baseline. If there are any expected layout changes to a website that you're testing, you'll need to reset the baseline to prevent unnecessary failures.
4451

@@ -49,6 +56,7 @@ If you want to use ``self.check_window()`` to compare a web page to a later vers
4956
Automated Visual Testing with ``self.check_window()`` is not very effective for websites that have dynamic content because that changes the layout and structure of web pages. For those pages, you're much better off using regular SeleniumBase functional testing, unless you can remove the dynamic content before performing the comparison, (such as by using ``self.ad_block()`` to remove dynamic ad content on a web page).
5057

5158
Example usage of ``self.check_window()`` with different levels:
59+
5260
```python
5361
self.check_window(name="testing", level=0)
5462
self.check_window(name="xkcd_home", level=1)
@@ -61,6 +69,7 @@ Example usage of ``self.check_window()`` with different levels:
6169
```
6270

6371
Here's an example where clicking a button makes a hidden element visible:
72+
6473
```python
6574
from seleniumbase import BaseCase
6675

@@ -76,7 +85,9 @@ class VisualLayoutTest(BaseCase):
7685
self.click("button")
7786
self.check_window(name="helloworld", level=3)
7887
```
88+
7989
Here's the output of that: (<i>Text changes do not impact visual comparisons</i>)
90+
8091
```
8192
AssertionError:
8293
First differing element 39:
@@ -92,6 +103,7 @@ First differing element 39:
92103
```
93104

94105
Here's an example where a button is removed from a web page:
106+
95107
```python
96108
from seleniumbase import BaseCase
97109

@@ -105,7 +117,9 @@ class VisualLayoutTest(BaseCase):
105117
self.remove_element('a.donate-button')
106118
self.check_window(name="python_home", level=3)
107119
```
120+
108121
Here's the output of that:
122+
109123
```
110124
AssertionError:
111125
First differing element 33:
@@ -123,6 +137,7 @@ First differing element 33:
123137
```
124138

125139
Here's an example where a web site logo is resized:
140+
126141
```python
127142
from seleniumbase import BaseCase
128143

@@ -137,7 +152,9 @@ class VisualLayoutTest(BaseCase):
137152
self.set_attribute('[alt="xkcd.com logo"]', "width", "120")
138153
self.check_window(name="xkcd_554", level=3)
139154
```
155+
140156
Here's the output of that:
157+
141158
```
142159
AssertionError:
143160
First differing element 22:
@@ -158,9 +175,11 @@ First differing element 22:
158175
```
159176

160177
To run the example (from [examples/visual_testing/](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/)) with a pytest HTML Report, use:
161-
```
178+
179+
```bash
162180
pytest test_layout_fail.py --html=report.html
163181
```
182+
164183
Here's what the pytest HTML Report looks like:<br />
165184
[<img src="https://seleniumbase.io/cdn/img/visual_testing_report_2.png" title="Test Report">](https://seleniumbase.io/cdn/img/visual_testing_report_2.png)
166185

mkdocs.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
site_name: SeleniumBase
33
site_url: https://seleniumbase.io
44
site_author: Michael Mintz
5-
site_description: A fast & reliable web automation framework for end-to-end testing with Python, pytest and WebDriver. Includes tools for reporting, visual testing, RPA, and more.
5+
site_description: A complete framework for end-to-end testing with Python, pytest, and WebDriver.
66
# Repository information
77
repo_name: seleniumbase/SeleniumBase
88
repo_url: https://github.com/seleniumbase/SeleniumBase
99
edit_uri: ""
1010
site_dir: "site"
1111
docs_dir: "docs"
1212
# Copyright
13-
copyright: Copyright &copy; 2014 - 2021 Michael Mintz / SeleniumBase
13+
copyright: Copyright &copy; 2014 - 2021 Michael Mintz
1414
# Extensions
1515
markdown_extensions:
1616
- markdown.extensions.admonition
@@ -36,7 +36,7 @@ theme:
3636
features:
3737
- navigation.sections
3838
# - navigation.tabs
39-
# - navigation.instant
39+
- navigation.instant
4040
extra:
4141
search:
4242
language: en
@@ -77,7 +77,7 @@ nav:
7777
- How it Works: help_docs/how_it_works.md
7878
- Languages:
7979
- Translations: help_docs/translations.md
80-
- Chinese / 中文文件: help_docs/chinese.md
80+
- Chinese Docs: help_docs/chinese.md
8181
- Locale Codes: help_docs/locale_codes.md
8282
- JS Generators:
8383
- Tour Maker: examples/tour_examples/ReadMe.md
@@ -97,15 +97,14 @@ nav:
9797
- HighCharts: examples/chart_maker/ReadMe.md
9898
- Help Docs:
9999
- Table of Contents: help_docs/ReadMe.md
100-
- Master QA: seleniumbase/masterqa/ReadMe.md
101100
- JS Package Manager: help_docs/js_package_manager.md
101+
- Master QA Hybrid Mode: seleniumbase/masterqa/ReadMe.md
102102
- Decorators & Security: seleniumbase/common/ReadMe.md
103103
- Desired Capabilities: help_docs/desired_capabilities.md
104+
- Docker Start Guide: integrations/docker/ReadMe.md
104105
- Using Safari Driver: help_docs/using_safari_driver.md
105106
- macOS Hidden Files: help_docs/hidden_files_info.md
106-
- Docker Help: integrations/docker/ReadMe.md
107-
- MySQL Help: help_docs/mysql_installation.md
108-
- Case Studies: help_docs/happy_customers.md
107+
- MySQL Instructions: help_docs/mysql_installation.md
109108
- Demo Pages:
110109
- Demo Page / Demo Site: https://seleniumbase.io/demo_page
111110
- TinyMCE Demo Page: https://seleniumbase.io/other/tinymce
@@ -116,6 +115,9 @@ nav:
116115
- Core Presentation: https://seleniumbase.io/other/core_presentation.html
117116
- Chart Maker Demo: https://seleniumbase.io/other/chart_presentation.html
118117
- Virtual Env Tutorial: https://seleniumbase.io/other/py_virtual_envs.html
119-
- Thank You: help_docs/thank_you.md
118+
- Other:
119+
- YouTube Link: https://www.youtube.com/playlist?list=PLp9uKicxkBc5UIlGi2BuE3aWC7JyXpD3m
120+
- Case Studies: help_docs/happy_customers.md
121+
- Thank You: help_docs/thank_you.md
120122
# Google Analytics
121123
google_analytics: ['UA-167313767-1', 'seleniumbase.io']

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pip>=20.3.4;python_version<"3.6"
2-
pip>=21.0;python_version>="3.6"
2+
pip>=21.0.1;python_version>="3.6"
33
packaging>=20.9
44
setuptools>=44.1.1;python_version<"3.5"
55
setuptools>=50.3.2;python_version>="3.5" and python_version<"3.6"
@@ -66,7 +66,7 @@ ipython==7.19.0;python_version>="3.7"
6666
colorama==0.4.4
6767
pathlib2==2.3.5;python_version<"3.5"
6868
importlib-metadata==2.0.0;python_version<"3.6"
69-
virtualenv>=20.4.0
69+
virtualenv>=20.4.1
7070
pymysql==0.10.1;python_version<"3.6"
7171
pymysql==1.0.2;python_version>="3.6"
7272
coverage==5.4

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "1.54.1"
2+
__version__ = "1.54.2"

seleniumbase/fixtures/base_case.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6930,11 +6930,13 @@ def __process_dashboard(self, has_exception, init=False):
69306930
log_msg = "See latest logs for details"
69316931
if num_failed == 1:
69326932
status += (
6933-
' <b>1 test failed!</b> (<a href="%s">%s</a>)'
6933+
' <b>1 test failed!</b> --- '
6934+
'(<b><a href="%s">%s</a></b>)'
69346935
'' % (latest_logs_dir, log_msg))
69356936
else:
69366937
status += (
6937-
' <b>%s tests failed!</b> (<a href="%s">%s</a>)'
6938+
' <b>%s tests failed!</b> --- '
6939+
'(<b><a href="%s">%s</a></b>)'
69386940
'' % (num_failed, latest_logs_dir, log_msg))
69396941
status += "</div><p></p>"
69406942
add_more = add_more + status

seleniumbase/plugins/base_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def options(self, parser, env):
7575
'--log_path', '--log-path',
7676
dest='log_path',
7777
default='latest_logs/',
78-
help="""Log files are saved to the "latest_logs/" folder.
79-
(This field is NOT EDITABLE anymore!)""")
78+
help="""(DEPRECATED) - This field is NOT EDITABLE anymore.
79+
Log files are saved to the "latest_logs/" folder.""")
8080
parser.add_option(
8181
'--archive_logs', '--archive-logs',
8282
action="store_true",

seleniumbase/plugins/pytest_plugin.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def pytest_addoption(parser):
143143
constants.Environment.TEST
144144
),
145145
default=constants.Environment.TEST,
146-
help="The environment to run the tests in.")
146+
help="""This option is used for setting the test env.
147+
In tests, use "self.environment" to get the env.""")
147148
parser.addoption('--data',
148149
dest='data',
149150
default=None,
@@ -191,18 +192,19 @@ def pytest_addoption(parser):
191192
action="store_true",
192193
dest='with_testing_base',
193194
default=True,
194-
help="""Use to save logs and screenshots when tests fail.
195+
help="""(DEPRECATED) - This option is always enabled now.
196+
Use for saving logs & screenshots when tests fail.
195197
The following options are now active by default
196-
with --with-testing_base (which is on by default):
198+
with --with-testing_base (which is always on now):
197199
--with-screen_shots ,
198200
--with-basic_test_info ,
199201
--with-page_source
200202
""")
201203
parser.addoption('--log_path', '--log-path',
202204
dest='log_path',
203205
default='latest_logs/',
204-
help="""Log files are saved to the "latest_logs/" folder.
205-
(This field is NOT EDITABLE anymore!)""")
206+
help="""(DEPRECATED) - This value is NOT EDITABLE anymore.
207+
Log files are saved to the "latest_logs/" folder.""")
206208
parser.addoption('--archive_logs', '--archive-logs',
207209
action="store_true",
208210
dest='archive_logs',
@@ -213,7 +215,7 @@ def pytest_addoption(parser):
213215
dest='with_db_reporting',
214216
default=False,
215217
help="Use to record test data in the MySQL database.")
216-
parser.addoption('--database_env', '--database-env',
218+
parser.addoption('--database_env',
217219
action='store',
218220
dest='database_env',
219221
choices=(
@@ -236,19 +238,24 @@ def pytest_addoption(parser):
236238
action="store_true",
237239
dest='with_screen_shots',
238240
default=False,
239-
help="""Use to save screenshots on test failure.
241+
help="""(DEPRECATED) - Screenshots are always saved now.
242+
This option saves screenshots during test failures.
243+
Screenshots are saved in the "latest_logs/" folder.
240244
(Automatically on when using --with-testing_base)""")
241245
parser.addoption('--with-basic_test_info', '--with-basic-test-info',
242246
action="store_true",
243247
dest='with_basic_test_info',
244248
default=False,
245-
help="""Use to save basic test info on test failure.
249+
help="""(DEPRECATED) - Info files are always saved now.
250+
This option saves basic test info on test failures.
251+
These files are saved in the "latest_logs/" folder.
246252
(Automatically on when using --with-testing_base)""")
247253
parser.addoption('--with-page_source', '--with-page-source',
248254
action="store_true",
249255
dest='with_page_source',
250256
default=False,
251-
help="""Use to save page source on test failure.
257+
help="""(DEPRECATED) - Page source is saved by default.
258+
This option saves page source files on test failures.
252259
(Automatically on when using --with-testing_base)""")
253260
parser.addoption('--server',
254261
action='store',
@@ -447,14 +454,16 @@ def pytest_addoption(parser):
447454
action="store_true",
448455
dest='no_sandbox',
449456
default=False,
450-
help="""Using this enables the "No Sandbox" feature.
457+
help="""(DEPRECATED) - "--no-sandbox" is always used now.
458+
Using this enables the "No Sandbox" feature.
451459
(This setting is now always enabled by default.)""")
452460
parser.addoption('--disable_gpu', '--disable-gpu',
453461
action="store_true",
454462
dest='disable_gpu',
455463
default=False,
456-
help="""Using this enables the "Disable GPU" feature.
457-
(This setting is now always enabled by default.)""")
464+
help="""(DEPRECATED) - GPU is disabled if no swiftshader.
465+
Using this enables the "Disable GPU" feature.
466+
(GPU is disabled by default if swiftshader off.)""")
458467
parser.addoption('--remote_debug', '--remote-debug',
459468
action="store_true",
460469
dest='remote_debug',
@@ -892,9 +901,10 @@ def pytest_unconfigure():
892901
'href="https://seleniumbase.io/img/dash_pie_2.png">')
893902
if sb_config._dash_final_summary:
894903
the_html_d += sb_config._dash_final_summary
904+
time.sleep(0.1) # Add time for "livejs" to detect changes
895905
with open(dashboard_path, "w", encoding='utf-8') as f:
896906
f.write(the_html_d) # Finalize the dashboard
897-
time.sleep(0.5) # Add time for "livejs" to detect changes
907+
time.sleep(0.1) # Add time for "livejs" to detect changes
898908
the_html_d = the_html_d.replace(
899909
"</head>", "</head><!-- Dashboard Report Done -->")
900910
with open(dashboard_path, "w", encoding='utf-8') as f:

seleniumbase/plugins/selenium_plugin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ def options(self, parser, env):
370370
action="store_true",
371371
dest='save_screenshot',
372372
default=False,
373-
help="""Take a screenshot on last page after the last step
374-
of the test. (Added to the "latest_logs" folder.)""")
373+
help="""(DEPRECATED) - Screenshots are enabled by default now.
374+
This option saves screenshots during test failures.
375+
(Added to the "latest_logs/" folder.)""")
375376
parser.add_option(
376377
'--visual_baseline', '--visual-baseline',
377378
action='store_true',

0 commit comments

Comments
 (0)