@@ -42,6 +42,7 @@ def test_anything(self):
42
42
from seleniumbase .core .testcase_manager import TestcaseManager
43
43
from seleniumbase .core import download_helper
44
44
from seleniumbase .core import log_helper
45
+ from seleniumbase .core import style_sheet
45
46
from seleniumbase .fixtures import constants
46
47
from seleniumbase .fixtures import page_actions
47
48
from seleniumbase .fixtures import page_utils
@@ -732,7 +733,7 @@ def add_js_link(self, js_link):
732
733
script.src = "%s";
733
734
script.defer;
734
735
script.crossorigin = "anonymous";
735
- script.onload = function() {$("html") };
736
+ script.onload = function() { null };
736
737
head.appendChild(script);
737
738
}
738
739
injectJS();""" )
@@ -755,7 +756,7 @@ def add_js_code_from_link(self, js_link):
755
756
'''var h = document.getElementsByTagName('head').item(0);'''
756
757
'''var s = document.createElement("script");'''
757
758
'''s.type = "text/javascript";'''
758
- '''s.onload = function() {$("html") };'''
759
+ '''s.onload = function() { null };'''
759
760
'''s.appendChild(document.createTextNode("%s"));'''
760
761
'''h.appendChild(s);''' )
761
762
self .execute_script (add_js_code_script % re .escape (js_code ))
@@ -860,46 +861,8 @@ def __activate_shepherd(self):
860
861
backbone_js = constants .Backbone .MIN_JS
861
862
spinner_css = constants .Messenger .SPINNER_CSS
862
863
863
- backdrop_style = (
864
- '''
865
- body.shepherd-active .shepherd-target.shepherd-enabled {
866
- box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.22);
867
- pointer-events: none !important;
868
- z-index: 9999;
869
- }
870
-
871
- body.shepherd-active .shepherd-orphan {
872
- box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.16);
873
- pointer-events: auto;
874
- z-index: 9999;
875
- }
876
-
877
- body.shepherd-active
878
- .shepherd-enabled.shepherd-element-attached-top {
879
- position: relative;
880
- }
881
-
882
- body.shepherd-active
883
- .shepherd-enabled.shepherd-element-attached-bottom {
884
- position: relative;
885
- }
886
-
887
- body.shepherd-active .shepherd-step {
888
- pointer-events: auto;
889
- z-index: 9999;
890
- }
891
-
892
- body.shepherd-active {
893
- pointer-events: none !important;
894
- }
895
- ''' )
896
-
897
- sh_style = ("""let test_tour = new Shepherd.Tour({
898
- defaults: {
899
- classes: 'shepherd-theme-dark',
900
- scrollTo: true
901
- }
902
- });""" )
864
+ sh_style = style_sheet .sh_style_test
865
+ backdrop_style = style_sheet .sh_backdrop_style
903
866
904
867
self .__activate_bootstrap ()
905
868
for x in range (4 ):
@@ -922,7 +885,7 @@ def __activate_shepherd(self):
922
885
for x in range (int (settings .MINI_TIMEOUT * 2.0 )):
923
886
# Shepherd needs a small amount of time to load & activate.
924
887
try :
925
- self .execute_script (sh_style )
888
+ self .execute_script (sh_style ) # Verify Shepherd has loaded
926
889
self .wait_for_ready_state_complete ()
927
890
self .execute_script (sh_style ) # Need it twice for ordering
928
891
time .sleep (0.05 )
@@ -936,14 +899,9 @@ def __activate_shepherd(self):
936
899
'''directive. ''' % self .driver .current_url )
937
900
938
901
def __is_shepherd_activated (self ):
939
- sh_style = ("""let test_tour = new Shepherd.Tour({
940
- defaults: {
941
- classes: 'shepherd-theme-dark',
942
- scrollTo: true
943
- }
944
- });""" )
902
+ sh_style = style_sheet .sh_style_test
945
903
try :
946
- self .execute_script (sh_style )
904
+ self .execute_script (sh_style ) # Verify Shepherd has loaded
947
905
return True
948
906
except Exception :
949
907
return False
@@ -1086,7 +1044,8 @@ def play_tour(self, name=None, interval=0):
1086
1044
selector = re .search (
1087
1045
"[\S\s]+{element: '([\S\s]+)', on: [\S\s]+" ,
1088
1046
self ._tour_steps [name ][1 ]).group (1 )
1089
- self .__wait_for_css_query_selector (selector )
1047
+ self .__wait_for_css_query_selector (
1048
+ selector , timeout = (settings .SMALL_TIMEOUT ))
1090
1049
except Exception :
1091
1050
self .__post_messenger_error_message (
1092
1051
"Tour Error: {'%s'} was not found!"
@@ -1149,7 +1108,7 @@ def play_tour(self, name=None, interval=0):
1149
1108
".currentStep.options.attachTo.element" )
1150
1109
try :
1151
1110
self .__wait_for_css_query_selector (
1152
- selector , timeout = (settings .MINI_TIMEOUT * 2 ))
1111
+ selector , timeout = (settings .MINI_TIMEOUT ))
1153
1112
except Exception :
1154
1113
self .remove_elements ("div.shepherd-content" )
1155
1114
self .__post_messenger_error_message (
0 commit comments