Skip to content

Commit a719eeb

Browse files
committed
Update examples
1 parent ac28e5a commit a719eeb

File tree

13 files changed

+60
-31
lines changed

13 files changed

+60
-31
lines changed

examples/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="300" />
22

3-
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Running Example Tests:</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Running Example Tests:</h2>
44

55
<p align="left"><a align="center" href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img align="center" src="https://seleniumbase.io/cdn/img/sb_demo_page.png" alt="SeleniumBase" width="420" /></a></p>
66

@@ -12,7 +12,7 @@
1212

1313
(NOTE: Some example tests fail on purpose to demonstrate [logging features](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).)
1414

15-
<h3><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="32" /> Example run commands to help you get started:</h3>
15+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Example run commands to help you get started:</h3>
1616

1717
Run an example test in Chrome: (Default: ``--browser=chrome``)
1818

examples/chart_maker/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="290" /></h3>
1+
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="360" /></h3>
22

33
<h3> 📊 ChartMaker 📈 </h3>
44

examples/chart_maker/test_area_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class MyChartMakerClass(BaseCase):
55

6-
def test_chart_maker(self):
6+
def test_area_chart(self):
77
self.create_presentation(theme="moon")
88
self.create_area_chart(
99
title="Time Outside", subtitle="Last Week", unit="Minutes")

examples/chart_maker/test_line_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class MyChartMakerClass(BaseCase):
55

6-
def test_chart_maker(self):
6+
def test_line_chart(self):
77
self.create_presentation()
88
self.create_line_chart(
99
title="Time Outside", subtitle="Last Week", unit="Minutes")

examples/chart_maker/test_multi_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class MyChartMakerClass(BaseCase):
55

6-
def test_multi_series_chart(self):
6+
def test_multi_series(self):
77
self.create_presentation(theme="league")
88

99
self.create_line_chart(

examples/decryption_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class MyTestClass(BaseCase):
1111

12-
def test_rate_limited_printing(self):
12+
def test_decrypt_password(self):
1313
self.open("https://www.saucedemo.com/")
1414
self.type("#user-name", "standard_user")
1515

examples/example_logs/ReadMe.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<a align="center" href="https://github.com/seleniumbase/SeleniumBase/"><img align="center" src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="290" /></a>
1+
<a align="center" href="https://github.com/seleniumbase/SeleniumBase/"><img align="center" src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="320" /></a>
22

3-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Logging, Screenshots, and Reports:
3+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logging, Dashboards, and Reports:</h3>
44

5-
Log files in [SeleniumBase/examples/example_logs](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/example_logs) were generated when [test_fail.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py) ran and failed. During test failures, logs and screenshots get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is set, test logs will get archived to the ``archived_logs/`` folder.
5+
Log files in [SeleniumBase/examples/example_logs](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/example_logs) were generated when [test_fail.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py) ran and failed. During test failures, logs and screenshots from the latest run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is set, test logs will get archived to the ``archived_logs/`` folder (otherwise they will be cleaned out when the next test run begins).
66

77
```bash
88
pytest test_fail.py --browser=chrome
@@ -17,28 +17,56 @@ nosetests test_fail.py --browser=firefox
1717
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/screenshot.png">screenshot.png</a></li>
1818
</ul>
1919

20+
<b>In addition to log files, you can also generate a dashboard and test reports.</b>
21+
2022
--------
2123

22-
<b>In addition to logging, you can also generate test reports:</b>
24+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>
25+
26+
The ``--dashboard`` option for pytest generates a SeleniumBase Dashboard located at ``dashboard.html``, which updates automatically as tests run and produce results.
27+
28+
<img src="https://seleniumbase.io/cdn/img/dashboard_1.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="360" />
29+
30+
Additionally, you can host your own SeleniumBase Dashboard Server on a port of your choice. Here's an example of that using Python 3's ``http.server``:
31+
32+
```bash
33+
python -m http.server 1948
34+
```
35+
36+
Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the served dashboard from a web browser. (Be sure to run that command in the same directory where you ran your tests.)
2337

24-
Reports are most useful when running large test suites. Pytest and Nosetest reports are handled differently.
38+
Here's a full example of what the SeleniumBase Dashboard may look like:
2539

26-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Pytest Reports:
40+
```bash
41+
pytest test_suite.py --dashboard --rs --headless
42+
```
43+
44+
<img src="https://seleniumbase.io/cdn/img/dashboard_2.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="480" />
45+
46+
--------
47+
48+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Pytest Reports:</h3>
2749

2850
Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
2951

3052
```bash
3153
pytest test_suite.py --html=report.html
3254
```
55+
3356
<img src="https://seleniumbase.io/cdn/img/html_report.png" alt="Example Pytest Report" title="Example Pytest Report" width="520" />
3457

35-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Nosetest Reports:
58+
If viewing pytest html reports in [Jenkins](https://www.jenkins.io/), you may need to [configure Jenkins settings](https://stackoverflow.com/a/46197356) for the html to render correctly. This is due to [Jenkins CSP changes](https://www.jenkins.io/doc/book/system-administration/security/configuring-content-security-policy/).
59+
60+
--------
61+
62+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Nosetest Reports:</h3>
3663

3764
The ``--report`` option gives you a fancy report after your test suite completes.
3865

3966
```bash
4067
nosetests test_suite.py --report --browser=chrome
4168
```
69+
4270
<img src="https://seleniumbase.io/cdn/img/nose_report.png" alt="Example Nosetest Report" title="Example Nosetest Report" width="320" />
4371

4472
(NOTE: You can add ``--show-report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show-report`` when running tests locally because it pauses the test run.)

examples/github_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ def test_github(self):
1414
if self.headless and (
1515
self.browser == "chrome" or self.browser == "edge"):
1616
self.get_new_driver(
17-
agent="""Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) """
17+
agent="""Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) """
1818
"""AppleWebKit/537.36 (KHTML, like Gecko) """
19-
"""Chrome/75.0.3770.100 Safari/537.36""")
20-
self.open("https://github.com/")
21-
self.type("input.header-search-input", "SeleniumBase\n")
19+
"""Chrome/86.0.4240.198 Safari/537.36""")
20+
self.open("https://github.com/search?q=SeleniumBase")
2221
self.slow_click('a[href="/seleniumbase/SeleniumBase"]')
2322
self.click_if_visible('[data-action="click:signup-prompt#dismiss"]')
2423
self.assert_element("div.repository-content")

examples/presenter/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="290" /></h3>
1+
<h3 align="left"><img src="https://seleniumbase.io/cdn/img/sb_logo_b.png" alt="SeleniumBase" width="360" /></h3>
22

33
<h1> 📰 Presenter 📑 </h1>
44

examples/presenter/py_virtual_envs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def test_py_virtual_envs(self):
110110
code=(
111111
'# Create a virtual environment:\n'
112112
'mkvirtualenv ENV_NAME\n\n'
113-
'# Leave your virtual environment:\n'
113+
'# Exit your virtual environment:\n'
114114
'deactivate\n\n'
115-
'# Return to a virtual environment:\n'
115+
'# Re-enter a virtual environment:\n'
116116
'workon ENV_NAME\n\n'
117117
'# List all virtual environments:\n'
118118
'workon\n\n'
@@ -158,11 +158,11 @@ def test_py_virtual_envs(self):
158158
'<h3>Where to find me:</h3>'
159159
'<ul>'
160160
'<li><a href="https://github.com/mdmintz">'
161-
'https://github.com/mdmintz</a></li>'
161+
'github.com/mdmintz</a></li>'
162162
'<li><a href="https://github.com/seleniumbase/SeleniumBase">'
163-
'https://github.com/seleniumbase/SeleniumBase</a></li>'
163+
'github.com/seleniumbase/SeleniumBase</a></li>'
164164
'<li><a href="https://seleniumbase.io/">'
165-
'https://seleniumbase.io/</a></li>'
165+
'seleniumbase.io</a></li>'
166166
'</ul>')
167167
self.begin_presentation(
168168
filename="py_virtual_envs.html", show_notes=False, interval=0)

0 commit comments

Comments
 (0)