@@ -757,8 +757,8 @@ def create_tour(self, name=None, theme=None):
757
757
""" Creates a tour for a website. By default, the Shepherd Javascript
758
758
Library is used with the Shepherd "Light" / "Arrows" theme.
759
759
@Params
760
- name - If creating multiple tours, use this to select the
761
- tour you wish to add steps to.
760
+ name - If creating multiple tours at the same time,
761
+ use this to select the tour you wish to add steps to.
762
762
theme - Sets the default theme for the tour.
763
763
Choose from "light"/"arrows", "dark", "default", "square",
764
764
and "square-dark". ("arrows" is used if None is selected.)
@@ -793,8 +793,8 @@ def create_tour(self, name=None, theme=None):
793
793
def create_shepherd_tour (self , name = None , theme = None ):
794
794
""" Creates a Shepherd JS website tour.
795
795
@Params
796
- name - If creating multiple tours, use this to select the
797
- tour you wish to add steps to.
796
+ name - If creating multiple tours at the same time,
797
+ use this to select the tour you wish to add steps to.
798
798
theme - Sets the default theme for the tour.
799
799
Choose from "light"/"arrows", "dark", "default", "square",
800
800
and "square-dark". ("light" is used if None is selected.)
@@ -826,16 +826,36 @@ def create_shepherd_tour(self, name=None, theme=None):
826
826
classes: '%s',
827
827
scrollTo: true
828
828
}
829
- });""" % shepherd_theme )
829
+ });
830
+ var allButtons = {
831
+ skip: {
832
+ text: "Skip",
833
+ action: tour.cancel,
834
+ classes: 'shepherd-button-secondary tour-button-left'
835
+ },
836
+ back: {
837
+ text: "Back",
838
+ action: tour.back,
839
+ classes: 'shepherd-button-secondary'
840
+ },
841
+ next: {
842
+ text: "Next",
843
+ action: tour.next,
844
+ classes: 'shepherd-button-primary tour-button-right'
845
+ },
846
+ };
847
+ var firstStepButtons = [allButtons.skip, allButtons.next];
848
+ var midTourButtons = [allButtons.back, allButtons.next];
849
+ """ % shepherd_theme )
830
850
831
851
self ._tour_steps [name ] = []
832
852
self ._tour_steps [name ].append (new_tour )
833
853
834
854
def create_bootstrap_tour (self , name = None ):
835
855
""" Creates a Bootstrap tour for a website.
836
856
@Params
837
- name - If creating multiple tours, use this to select the
838
- tour you wish to add steps to.
857
+ name - If creating multiple tours at the same time,
858
+ use this to select the tour you wish to add steps to.
839
859
"""
840
860
if not name :
841
861
name = "default"
@@ -854,8 +874,8 @@ def create_bootstrap_tour(self, name=None):
854
874
def create_hopscotch_tour (self , name = None ):
855
875
""" Creates an Hopscotch tour for a website.
856
876
@Params
857
- name - If creating multiple tours, use this to select the
858
- tour you wish to add steps to.
877
+ name - If creating multiple tours at the same time,
878
+ use this to select the tour you wish to add steps to.
859
879
"""
860
880
if not name :
861
881
name = "default"
@@ -874,8 +894,8 @@ def create_hopscotch_tour(self, name=None):
874
894
def create_introjs_tour (self , name = None ):
875
895
""" Creates an IntroJS tour for a website.
876
896
@Params
877
- name - If creating multiple tours, use this to select the
878
- tour you wish to add steps to.
897
+ name - If creating multiple tours at the same time,
898
+ use this to select the tour you wish to add steps to.
879
899
"""
880
900
if not name :
881
901
name = "default"
@@ -898,8 +918,8 @@ def add_tour_step(self, message, selector=None, name=None,
898
918
@Params
899
919
message - The message to display.
900
920
selector - The CSS Selector of the Element to attach to.
901
- name - If creating multiple tours, use this to select the
902
- tour you wish to add steps to.
921
+ name - If creating multiple tours at the same time,
922
+ use this to select the tour you wish to add steps to.
903
923
title - Additional header text that appears above the message.
904
924
theme - (NON-Bootstrap Tours ONLY) The styling of the tour step.
905
925
Choose from "light"/"arrows", "dark", "default", "square",
@@ -960,8 +980,8 @@ def __add_shepherd_tour_step(self, message, selector=None, name=None,
960
980
@Params
961
981
message - The message to display.
962
982
selector - The CSS Selector of the Element to attach to.
963
- name - If creating multiple tours, use this to select the
964
- tour you wish to add steps to.
983
+ name - If creating multiple tours at the same time,
984
+ use this to select the tour you wish to add steps to.
965
985
title - Additional header text that appears above the message.
966
986
theme - (NON-Bootstrap Tours ONLY) The styling of the tour step.
967
987
Choose from "light"/"arrows", "dark", "default", "square",
@@ -990,15 +1010,21 @@ def __add_shepherd_tour_step(self, message, selector=None, name=None,
990
1010
shepherd_classes = shepherd_theme
991
1011
if selector == "html" :
992
1012
shepherd_classes += " shepherd-orphan"
1013
+ buttons = "firstStepButtons"
1014
+ if len (self ._tour_steps [name ]) > 1 :
1015
+ buttons = "midTourButtons"
1016
+
993
1017
step = ("""
994
1018
tour.addStep('%s', {
995
1019
title: '%s',
996
1020
classes: '%s',
997
1021
text: '%s',
998
1022
attachTo: {element: '%s', on: '%s'},
1023
+ buttons: %s,
999
1024
advanceOn: '.docs-link click'
1000
1025
});""" % (
1001
- name , title , shepherd_classes , message , selector , alignment ))
1026
+ name , title , shepherd_classes , message , selector , alignment ,
1027
+ buttons ))
1002
1028
1003
1029
self ._tour_steps [name ].append (step )
1004
1030
@@ -1008,8 +1034,8 @@ def __add_bootstrap_tour_step(self, message, selector=None, name=None,
1008
1034
@Params
1009
1035
message - The message to display.
1010
1036
selector - The CSS Selector of the Element to attach to.
1011
- name - If creating multiple tours, use this to select the
1012
- tour you wish to add steps to.
1037
+ name - If creating multiple tours at the same time,
1038
+ use this to select the tour you wish to add steps to.
1013
1039
title - Additional header text that appears above the message.
1014
1040
alignment - Choose from "top", "bottom", "left", and "right".
1015
1041
("top" is the default alignment).
@@ -1044,8 +1070,8 @@ def __add_hopscotch_tour_step(self, message, selector=None, name=None,
1044
1070
@Params
1045
1071
message - The message to display.
1046
1072
selector - The CSS Selector of the Element to attach to.
1047
- name - If creating multiple tours, use this to select the
1048
- tour you wish to add steps to.
1073
+ name - If creating multiple tours at the same time,
1074
+ use this to select the tour you wish to add steps to.
1049
1075
title - Additional header text that appears above the message.
1050
1076
alignment - Choose from "top", "bottom", "left", and "right".
1051
1077
("bottom" is the default alignment).
@@ -1076,8 +1102,8 @@ def __add_introjs_tour_step(self, message, selector=None, name=None,
1076
1102
@Params
1077
1103
message - The message to display.
1078
1104
selector - The CSS Selector of the Element to attach to.
1079
- name - If creating multiple tours, use this to select the
1080
- tour you wish to add steps to.
1105
+ name - If creating multiple tours at the same time,
1106
+ use this to select the tour you wish to add steps to.
1081
1107
title - Additional header text that appears above the message.
1082
1108
alignment - Choose from "top", "bottom", "left", and "right".
1083
1109
("top" is the default alignment).
@@ -1102,8 +1128,8 @@ def __add_introjs_tour_step(self, message, selector=None, name=None,
1102
1128
def play_tour (self , name = None , interval = 0 ):
1103
1129
""" Plays a tour on the current website.
1104
1130
@Params
1105
- name - If creating multiple tours, use this to select the
1106
- tour you wish to play .
1131
+ name - If creating multiple tours at the same time,
1132
+ use this to select the tour you wish to add steps to .
1107
1133
interval - The delay time between autoplaying tour steps.
1108
1134
If set to 0 (default), the tour is fully manual control.
1109
1135
"""
@@ -1141,8 +1167,8 @@ def export_tour(self, name=None, filename="my_tour.js"):
1141
1167
You'll be able to copy the tour directly into the Console of
1142
1168
any web browser to play the tour outside of SeleniumBase runs.
1143
1169
@Params
1144
- name - If creating multiple tours, use this to select the
1145
- tour you wish to play .
1170
+ name - If creating multiple tours at the same time,
1171
+ use this to select the tour you wish to add steps to .
1146
1172
filename - The name of the javascript file that you wish to
1147
1173
save the tour to. """
1148
1174
tour_helper .export_tour (self ._tour_steps , name = name , filename = filename )
0 commit comments