Skip to content

Commit 0c515b8

Browse files
committed
Update the examples
1 parent 092ed36 commit 0c515b8

14 files changed

+52
-25
lines changed

examples/chart_maker/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ SeleniumBase Chart Maker allows you to create HTML charts with Python. (HighChar
1010

1111
([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html))
1212

13-
Here's how to run the example presentation with a pie chart from [github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
13+
Here's how to run the example presentation with a pie chart from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker):
1414

1515
```bash
1616
cd examples/chart_maker
1717
pytest my_chart.py
1818
```
1919

20-
Here's the code for that pie chart presentation ([github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/my_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/my_chart.py)):
20+
Here's the code for that pie chart presentation ([GitHub => seleniumbase/SeleniumBase/examples/chart_maker/my_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/my_chart.py)):
2121

2222
```python
2323
from seleniumbase import BaseCase

examples/chart_maker/chart_presentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class MyChartMakerClass(BaseCase):
55

66
def test_chart_maker_presentation(self):
7-
self.create_presentation(theme="sky")
7+
self.create_presentation(theme="sky", transition="zoom")
88

99
self.create_pie_chart(title="Automated Tests")
1010
self.add_data_point("Passed", 7, color="#95d96f")

examples/presenter/ReadMe.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pytest my_presentation.py
2323
### Creating a new presentation:
2424

2525
```python
26-
self.create_presentation(name=None, theme="serif")
26+
self.create_presentation(name=None, theme="serif", transition="default")
2727
""" Creates a Reveal-JS presentation that you can add slides to.
2828
@Params
2929
name - If creating multiple presentations at the same time,
@@ -32,6 +32,9 @@ self.create_presentation(name=None, theme="serif")
3232
Valid themes: "serif" (default), "sky", "white", "black",
3333
"simple", "league", "moon", "night",
3434
"beige", "blood", and "solarized".
35+
transition - Set a transition between slides.
36+
Valid transitions: "none" (default), "slide", "fade",
37+
"zoom", "convex", and "concave".
3538
"""
3639
```
3740

@@ -44,7 +47,7 @@ Notes are disabled by default. You can enable notes by specifying:
4447

4548
```python
4649
self.add_slide(content=None, image=None, code=None, iframe=None,
47-
content2=None, notes=None, name=None)
50+
content2=None, notes=None, transition=None, name=None)
4851
""" Allows the user to add slides to a presentation.
4952
@Params
5053
content - The HTML content to display on the presentation slide.
@@ -55,6 +58,9 @@ self.add_slide(content=None, image=None, code=None, iframe=None,
5558
content2 - HTML content to display after adding an image or code.
5659
notes - Additional notes to include with the slide.
5760
ONLY SEEN if show_notes is set for the presentation.
61+
transition - Set a transition between slides. (overrides previous)
62+
Valid transitions: "none" (default), "slide", "fade",
63+
"zoom", "convex", and "concave".
5864
name - If creating multiple presentations at the same time,
5965
use this to select the presentation to add slides to.
6066
"""

examples/presenter/my_presentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class MyPresenterClass(BaseCase):
55

66
def test_presenter(self):
7-
self.create_presentation(theme="serif")
7+
self.create_presentation(theme="serif", transition="none")
88
self.add_slide(
99
'<h1>Welcome</h1><br />\n'
1010
'<h3>Press the <b>Right Arrow</b></h3>')

examples/test_deferred_asserts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class MyTestClass(BaseCase):
1313
def test_deferred_asserts(self):
1414
self.open('https://xkcd.com/993/')
1515
self.wait_for_element('#comic')
16+
print("\n(This test fails on purpose)")
1617
self.deferred_assert_element('img[alt="Brand Identity"]')
1718
self.deferred_assert_element('img[alt="Rocket Ship"]') # Will Fail
1819
self.deferred_assert_element('#comicmap')

examples/test_xfail.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
""" Testing the @pytest.mark.xfail marker.
2+
https://docs.pytest.org/en/latest/skipping.html
3+
(The test is expected to fail, but don't fail the entire build for it.)
4+
"""
5+
6+
import pytest
7+
from seleniumbase import BaseCase
8+
9+
10+
class MyTestClass(BaseCase):
11+
12+
@pytest.mark.xfail
13+
def test_xfail(self):
14+
self.open("https://xkcd.com/376/")
15+
self.sleep(1) # Time to read the comic
16+
self.fail("There is a known bug here!")

examples/timeout_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ class MyTestClass(BaseCase):
1515
def test_time_limit_feature(self):
1616
self.set_time_limit(5) # Fail test if time exceeds 5 seconds
1717
self.open("https://xkcd.com/1658/")
18+
print("\n(This test fails on purpose)")
1819
self.sleep(7)

examples/tour_examples/ReadMe.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ SeleniumBase Tours utilize 5 JavaScript libraries for creating interactive walkt
77
**Example tour:**
88

99
<img src="https://cdn2.hubspot.net/hubfs/100006/google_tour_3.gif" title="SeleniumBase Tour of Google"><br>
10-
```
10+
11+
```bash
1112
cd examples/tour_examples
1213
pytest google_tour.py
1314
```
1415

16+
(From [GitHub => SeleniumBase/examples/tour_examples](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples))
17+
1518

1619
### Creating a new tour:
1720

examples/tour_examples/bootstrap_google_tour.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def test_google_tour(self):
2929
self.play_tour(interval=5) # Tour automatically continues after 5 sec
3030

3131
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
32-
self.wait_for_element("#searchboxinput")
33-
self.wait_for_element("#minimap")
34-
self.wait_for_element("#zoom")
32+
self.wait_for_element("#searchboxinput", timeout=20)
33+
self.wait_for_element("#minimap", timeout=20)
34+
self.wait_for_element("#zoom", timeout=20)
3535

3636
self.create_bootstrap_tour()
3737
self.add_tour_step("Welcome to Google Maps!")

examples/tour_examples/driverjs_maps_tour.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class MyTestClass(BaseCase):
55

66
def test_create_tour(self):
77
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
8-
self.wait_for_element("#searchboxinput")
9-
self.wait_for_element("#minimap")
10-
self.wait_for_element("#zoom")
8+
self.wait_for_element("#searchboxinput", timeout=20)
9+
self.wait_for_element("#minimap", timeout=20)
10+
self.wait_for_element("#zoom", timeout=20)
1111

1212
# Create a website tour using the DriverJS library
1313
# Same as: self.create_driverjs_tour()

0 commit comments

Comments
 (0)