Skip to content

Commit 4ea954d

Browse files
committed
Update tour examples
1 parent 0c29769 commit 4ea954d

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

examples/tour_examples/ReadMe.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Here's how you play a tour:
3030

3131
``self.play_tour(interval)``
3232

33-
With the ``create_tour()`` method, you can pass a default theme to change the look & feel of the tour steps. Valid themes are ``dark``, ``default``, ``arrows``, ``square``, and ``square-dark``.
33+
With the ``create_tour()`` method, you can pass a default theme to change the look & feel of the tour steps. Valid themes for Shepherd Tours are ``dark``, ``light`` / ``arrows``, ``default``, ``square``, and ``square-dark``.
3434

3535
With the ``self.add_tour_step()`` method, you must first pass a message to display. You can then specify a web element to attach to (by using [CSS selectors](https://www.w3schools.com/cssref/css_selectors.asp)). If no element is specified, the tour step will tether to the top of the screen by default. You can also add an optional title above the message to display with the tour step, as well as change the theme for that step, and even specify the alignment (which is the side of the element that you want the tour message to tether to).
3636

@@ -50,12 +50,20 @@ class MyTourClass(BaseCase):
5050
self.wait_for_element('input[title="Search"]')
5151

5252
self.create_tour(theme="dark")
53-
self.add_tour_step("Click to begin the Google Tour!", title="SeleniumBase Tours")
54-
self.add_tour_step("Type in your search query here.", 'input[title="Search"]')
55-
self.add_tour_step("Then click here to search!", 'input[value="Google Search"]',
56-
alignment="bottom", theme="arrows")
57-
self.add_tour_step("Or click here to see the top result.",
58-
'''[value="I'm Feeling Lucky"]''', alignment="bottom", theme="arrows")
53+
self.add_tour_step(
54+
"Click to begin the Google Tour!", title="SeleniumBase Tours")
55+
self.add_tour_step(
56+
"Type in your search query here.", 'input[title="Search"]')
57+
self.play_tour()
58+
59+
self.highlight_update_text('input[title="Search"]', "Google")
60+
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
61+
62+
self.create_tour(theme="light")
63+
self.add_tour_step(
64+
"Then click here to search.", 'input[value="Google Search"]')
65+
self.add_tour_step(
66+
"Or press [ENTER] after typing.", '[title="Search"]', theme="dark")
5967
self.play_tour()
6068
```
6169

examples/tour_examples/bootstrap_google_tour.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,14 @@ def test_google_tour(self):
1212
"Click to begin the Google Tour!", title="SeleniumBase Tours")
1313
self.add_tour_step(
1414
"Type in your search query here.", 'input[title="Search"]')
15-
self.add_tour_step(
16-
"Then click here to search!", 'input[value="Google Search"]',
17-
alignment="bottom")
18-
self.add_tour_step(
19-
"Or click here to see the top result.",
20-
'''[value="I'm Feeling Lucky"]''',
21-
alignment="bottom")
22-
self.add_tour_step("Here's an example Google search:")
15+
self.add_tour_step('Then click "Google Search" or press [ENTER].')
2316
self.play_tour()
2417

2518
self.highlight_update_text('input[title="Search"]', "GitHub")
19+
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
2620
self.highlight_click('input[value="Google Search"]')
2721

28-
self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
22+
self.create_bootstrap_tour()
2923
self.add_tour_step(
3024
"Search results appear here!", title="(5-second autoplay on)")
3125
self.add_tour_step("Let's take another tour:")
@@ -34,7 +28,7 @@ def test_google_tour(self):
3428
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
3529
self.wait_for_element('input#searchboxinput')
3630

37-
self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
31+
self.create_bootstrap_tour()
3832
self.add_tour_step("Welcome to Google Maps!")
3933
self.add_tour_step(
4034
"Type in a location here.", "#searchboxinput", title="Search Box")

examples/tour_examples/google_tour.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@ def test_google_tour(self):
1212
"Click to begin the Google Tour!", title="SeleniumBase Tours")
1313
self.add_tour_step(
1414
"Type in your search query here.", 'input[title="Search"]')
15+
self.play_tour()
16+
17+
self.highlight_update_text('input[title="Search"]', "Google")
18+
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
19+
20+
self.create_tour(theme="light")
1521
self.add_tour_step(
16-
"Then click here to search!", 'input[value="Google Search"]',
17-
alignment="bottom", theme="arrows")
22+
"Then click here to search.", 'input[value="Google Search"]')
1823
self.add_tour_step(
19-
"Or click here to see the top result.",
20-
'''[value="I'm Feeling Lucky"]''',
21-
alignment="bottom", theme="arrows")
22-
self.add_tour_step("Here's an example Google search:", theme="arrows")
23-
self.play_tour(interval=0) # If interval is 0, tour is fully manual
24+
"Or press [ENTER] after typing.", '[title="Search"]', theme="dark")
25+
self.play_tour()
2426

25-
self.highlight_update_text('input[title="Search"]', "GitHub")
26-
self.highlight_click('input[value="Google Search"]')
27+
self.highlight_update_text('input[title="Search"]', "GitHub\n")
2728

2829
self.create_tour(theme="dark")
2930
self.add_tour_step(
3031
"Search results appear here!", title="(5-second autoplay on)")
31-
self.add_tour_step("Let's take another tour:", theme="arrows")
32+
self.add_tour_step("Let's take another tour:", theme="light")
3233
self.play_tour(interval=5) # tour automatically continues after 5 sec
3334

3435
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
@@ -61,5 +62,5 @@ def test_google_tour(self):
6162
alignment="left")
6263
self.add_tour_step(
6364
"Thanks for trying out SeleniumBase Tours!",
64-
title="End of Guided Tour", theme="arrows")
65+
title="End of Guided Tour", theme="light")
6566
self.play_tour() # If interval isn't set, tour is fully manual

0 commit comments

Comments
 (0)