Skip to content

Commit 8b89f01

Browse files
committed
Update the docs
1 parent 0a0a34b commit 8b89f01

File tree

5 files changed

+236
-3
lines changed

5 files changed

+236
-3
lines changed

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
livereload==2.6.2;python_version>="3.6"
22
mkdocs==1.1.2
3-
mkdocs-material==5.4.0
3+
mkdocs-material==5.5.0
44
mkdocs-simple-hooks==0.1.1
55
mkdocs-material-extensions==1.0
66
mkdocs-minify-plugin==0.3.0

examples/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><a align="center" href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img align="center" src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb8.png" alt="SeleniumBase" width="290" /></a></p>
1+
<p align="center"><a align="center" href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img align="center" src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" alt="SeleniumBase" width="290" /></a></p>
22

33
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Running Example Tests:</h2>
44

@@ -131,7 +131,7 @@ python gui_test_runner.py
131131

132132
--------
133133

134-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" width="290" />
134+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb8.png" title="SeleniumBase" width="290" />
135135

136136
<a href="https://github.com/seleniumbase/SeleniumBase">
137137
<img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a>

examples/chart_maker/ReadMe.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<h3 align="left"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb23.png" alt="SeleniumBase" width="290" /></h3>
2+
3+
# 📊 Chart Maker 📊
4+
5+
SeleniumBase Chart Maker allows you to create HTML charts with Python.<br />
6+
The HighCharts library is used for creating charts.
7+
(Currently only <b>pie charts</b> are supported.)
8+
9+
**Here's a sample chart:**
10+
11+
<a href="https://seleniumbase.io/other/chart_presentation.html"><img width="500" src="https://seleniumbase.io/other/sample_pie_chart.png" title="Screenshot"></a><br>
12+
13+
([Click on the image for the actual chart](https://seleniumbase.io/other/chart_presentation.html))
14+
15+
Here's how to run the example (a chart in a presentation):
16+
```
17+
cd examples/chart_maker
18+
pytest my_chart.py
19+
```
20+
21+
22+
### Creating a new chart:
23+
24+
```python
25+
self.create_pie_chart(chart_name=None, title="My Chart")
26+
""" Creates a JavaScript pie chart using "HighCharts". """
27+
```
28+
29+
If creating multiple charts at the same time, you can pass the ``chart_name`` parameter to distinguish between different charts.
30+
31+
32+
### Adding a data point to a chart:
33+
34+
```python
35+
self.add_data_point(label, value, color=None, chart_name=None):
36+
""" Add a data point to a SeleniumBase-generated chart.
37+
@Params
38+
label - The label name for the data point.
39+
value - The numeric value of the data point.
40+
color - The HTML color of the data point.
41+
Can be an RGB color. Eg: "#55ACDC".
42+
Can also be a named color. Eg: "Teal".
43+
chart_name - If creating multiple charts,
44+
use this to select which one.
45+
"""
46+
```
47+
48+
49+
### Saving a chart to a file:
50+
51+
```python
52+
self.save_chart(chart_name=None, filename=None):
53+
""" Saves a SeleniumBase-generated chart to a file for later use.
54+
@Params
55+
chart_name - If creating multiple charts at the same time,
56+
use this to select the one you wish to use.
57+
filename - The name of the HTML file that you wish to
58+
save the chart to. (filename must end in ".html")
59+
"""
60+
```
61+
62+
The full HTML of the chart is saved to the ``saved_charts/`` folder.
63+
64+
65+
### Extracting the HTML of a chart:
66+
67+
```python
68+
self.extract_chart(chart_name=None):
69+
""" Extracts the HTML from a SeleniumBase-generated chart.
70+
@Params
71+
chart_name - If creating multiple charts at the same time,
72+
use this to select the one you wish to use.
73+
"""
74+
```
75+
76+
77+
### Displaying a chart in the browser window:
78+
79+
```python
80+
self.display_chart(chart_name=None, filename=None):
81+
""" Displays a SeleniumBase-generated chart in the browser window.
82+
@Params
83+
chart_name - If creating multiple charts at the same time,
84+
use this to select the one you wish to use.
85+
filename - The name of the HTML file that you wish to
86+
save the chart to. (filename must end in ".html")
87+
"""
88+
```
89+
90+
All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at once.
91+
92+
93+
### Here's an example of using SeleniumBase Chart Maker:
94+
95+
```python
96+
from seleniumbase import BaseCase
97+
98+
99+
class MyChartMakerClass(BaseCase):
100+
101+
def test_chart_maker(self):
102+
self.create_pie_chart(title="Automated Tests")
103+
self.add_data_point("Passed", 7, color="#95d96f")
104+
self.add_data_point("Untested", 2, color="#eaeaea")
105+
self.add_data_point("Failed", 1, color="#f1888f")
106+
self.create_presentation()
107+
self.add_slide(self.extract_chart())
108+
self.begin_presentation()
109+
110+
```
111+
112+
#### This example is from [my_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/my_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
113+
114+
```bash
115+
pytest my_chart.py
116+
```

help_docs/chart_maker.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<h3 align="left"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb23.png" alt="SeleniumBase" width="290" /></h3>
2+
3+
# 📊 Chart Maker 📊
4+
5+
SeleniumBase Chart Maker allows you to create HTML charts with Python.<br />
6+
The HighCharts library is used for creating charts.
7+
(Currently only <b>pie charts</b> are supported.)
8+
9+
**Here's a sample chart:**
10+
11+
<a href="https://seleniumbase.io/other/chart_presentation.html"><img width="500" src="https://seleniumbase.io/other/sample_pie_chart.png" title="Screenshot"></a><br>
12+
13+
([Click on the image for the actual chart](https://seleniumbase.io/other/chart_presentation.html))
14+
15+
Here's how to run the example (a chart in a presentation):
16+
```
17+
cd examples/chart_maker
18+
pytest my_chart.py
19+
```
20+
21+
22+
### Creating a new chart:
23+
24+
```python
25+
self.create_pie_chart(chart_name=None, title="My Chart")
26+
""" Creates a JavaScript pie chart using "HighCharts". """
27+
```
28+
29+
If creating multiple charts at the same time, you can pass the ``chart_name`` parameter to distinguish between different charts.
30+
31+
32+
### Adding a data point to a chart:
33+
34+
```python
35+
self.add_data_point(label, value, color=None, chart_name=None):
36+
""" Add a data point to a SeleniumBase-generated chart.
37+
@Params
38+
label - The label name for the data point.
39+
value - The numeric value of the data point.
40+
color - The HTML color of the data point.
41+
Can be an RGB color. Eg: "#55ACDC".
42+
Can also be a named color. Eg: "Teal".
43+
chart_name - If creating multiple charts,
44+
use this to select which one.
45+
"""
46+
```
47+
48+
49+
### Saving a chart to a file:
50+
51+
```python
52+
self.save_chart(chart_name=None, filename=None):
53+
""" Saves a SeleniumBase-generated chart to a file for later use.
54+
@Params
55+
chart_name - If creating multiple charts at the same time,
56+
use this to select the one you wish to use.
57+
filename - The name of the HTML file that you wish to
58+
save the chart to. (filename must end in ".html")
59+
"""
60+
```
61+
62+
The full HTML of the chart is saved to the ``saved_charts/`` folder.
63+
64+
65+
### Extracting the HTML of a chart:
66+
67+
```python
68+
self.extract_chart(chart_name=None):
69+
""" Extracts the HTML from a SeleniumBase-generated chart.
70+
@Params
71+
chart_name - If creating multiple charts at the same time,
72+
use this to select the one you wish to use.
73+
"""
74+
```
75+
76+
77+
### Displaying a chart in the browser window:
78+
79+
```python
80+
self.display_chart(chart_name=None, filename=None):
81+
""" Displays a SeleniumBase-generated chart in the browser window.
82+
@Params
83+
chart_name - If creating multiple charts at the same time,
84+
use this to select the one you wish to use.
85+
filename - The name of the HTML file that you wish to
86+
save the chart to. (filename must end in ".html")
87+
"""
88+
```
89+
90+
All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at once.
91+
92+
93+
### Here's an example of using SeleniumBase Chart Maker:
94+
95+
```python
96+
from seleniumbase import BaseCase
97+
98+
99+
class MyChartMakerClass(BaseCase):
100+
101+
def test_chart_maker(self):
102+
self.create_pie_chart(title="Automated Tests")
103+
self.add_data_point("Passed", 7, color="#95d96f")
104+
self.add_data_point("Untested", 2, color="#eaeaea")
105+
self.add_data_point("Failed", 1, color="#f1888f")
106+
self.create_presentation()
107+
self.add_slide(self.extract_chart())
108+
self.begin_presentation()
109+
110+
```
111+
112+
#### This example is from [my_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/my_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command:
113+
114+
```bash
115+
pytest my_chart.py
116+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ nav:
7474
- JS Package Manager: help_docs/js_package_manager.md
7575
- Site Tours: examples/tour_examples/ReadMe.md
7676
- Presenter: examples/presenter/ReadMe.md
77+
- Chart Maker: help_docs/chart_maker.md
7778
- Visual Testing: examples/visual_testing/ReadMe.md
7879
- Integrations:
7980
- Logging and Reports: examples/example_logs/ReadMe.md

0 commit comments

Comments
 (0)