Skip to content

Commit 11be5c1

Browse files
committed
Refactoring javascript and css resources
1 parent 7d73ac1 commit 11be5c1

File tree

1 file changed

+28
-60
lines changed

1 file changed

+28
-60
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def activate_jquery(self):
757757
except Exception:
758758
# jQuery is not currently defined. Let's proceed by defining it.
759759
pass
760-
jquery_js = "https://code.jquery.com/jquery-3.2.1.min.js"
760+
jquery_js = constants.JQuery.MIN_JS
761761
self.add_js_link(jquery_js)
762762
for x in range(int(settings.MINI_TIMEOUT * 10.0)):
763763
# jQuery needs a small amount of time to activate.
@@ -777,12 +777,8 @@ def __activate_bootstrap(self):
777777
http://bootstraptour.com/
778778
(Currently, SeleniumBase methods only use Shepherd Tours.)
779779
"""
780-
bootstrap_tour_css = ("https://cdnjs.cloudflare.com/ajax/libs"
781-
"/bootstrap-tour/0.11.0/css"
782-
"/bootstrap-tour-standalone.min.css")
783-
bootstrap_tour_js = ("https://cdnjs.cloudflare.com/ajax/libs"
784-
"/bootstrap-tour/0.11.0/js"
785-
"/bootstrap-tour-standalone.min.js")
780+
bootstrap_tour_css = constants.BootstrapTour.MIN_CSS
781+
bootstrap_tour_js = constants.BootstrapTour.MIN_JS
786782

787783
verify_script = ("""// Instance the tour
788784
var tour = new Tour({
@@ -822,31 +818,17 @@ def __activate_shepherd(self):
822818
""" Allows you to use Shepherd Tours with SeleniumBase
823819
http://github.hubspot.com/shepherd/docs/welcome/
824820
"""
825-
sh_theme_arrows_css = ("https://cdnjs.cloudflare.com/ajax/libs"
826-
"/shepherd/1.8.1/css/shepherd-theme-arrows.css")
827-
sh_theme_arrows_fix_css = ("https://cdnjs.cloudflare.com/ajax/libs"
828-
"/shepherd/1.8.1/css"
829-
"/shepherd-theme-arrows-fix.css")
830-
sh_theme_default_css = ("https://cdnjs.cloudflare.com/ajax/libs"
831-
"/shepherd/1.8.1/css"
832-
"/shepherd-theme-default.css")
833-
sh_theme_dark_css = ("https://cdnjs.cloudflare.com/ajax/libs"
834-
"/shepherd/1.8.1/css/shepherd-theme-dark.css")
835-
sh_theme_sq_css = ("https://cdnjs.cloudflare.com/ajax/libs/"
836-
"shepherd/1.8.1/css/shepherd-theme-square.css")
837-
sh_theme_sq_dark_css = ("https://cdnjs.cloudflare.com/ajax/libs"
838-
"/shepherd/1.8.1/css/"
839-
"shepherd-theme-square-dark.css")
840-
tether_js = ("https://cdnjs.cloudflare.com/ajax/libs"
841-
"/tether/1.4.4/js/tether.min.js")
842-
shepherd_js = ("https://cdnjs.cloudflare.com/ajax/libs"
843-
"/shepherd/1.8.1/js/shepherd.min.js")
844-
underscore_js = ("https://cdnjs.cloudflare.com/ajax/libs"
845-
"/underscore.js/1.4.3/underscore-min.js")
846-
backbone_js = ("https://cdnjs.cloudflare.com/ajax/libs"
847-
"/backbone.js/0.9.10/backbone-min.js")
848-
spinner_css = ("https://cdnjs.cloudflare.com/ajax/libs"
849-
"/messenger/1.5.0/css/messenger-spinner.css")
821+
shepherd_js = constants.Shepherd.MIN_JS
822+
sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS
823+
sh_theme_arrows_fix_css = constants.Shepherd.THEME_ARR_FIX_CSS
824+
sh_theme_default_css = constants.Shepherd.THEME_DEFAULT_CSS
825+
sh_theme_dark_css = constants.Shepherd.THEME_DARK_CSS
826+
sh_theme_sq_css = constants.Shepherd.THEME_SQ_CSS
827+
sh_theme_sq_dark_css = constants.Shepherd.THEME_SQ_DK_CSS
828+
tether_js = constants.Tether.MIN_JS
829+
underscore_js = constants.Underscore.MIN_JS
830+
backbone_js = constants.Backbone.MIN_JS
831+
spinner_css = constants.Messenger.SPINNER_CSS
850832

851833
backdrop_style = (
852834
'''
@@ -1179,33 +1161,19 @@ def __wait_for_css_query_selector(
11791161
selector, timeout))
11801162

11811163
def activate_messenger(self):
1182-
jquery_js = "https://code.jquery.com/jquery-3.2.1.min.js"
1183-
messenger_js = ("https://cdnjs.cloudflare.com/ajax/libs"
1184-
"/messenger/1.5.0/js/messenger.min.js")
1185-
msgr_theme_flat_js = ("https://cdnjs.cloudflare.com/ajax/libs"
1186-
"/messenger/1.5.0/js/messenger-theme-flat.js")
1187-
msg_theme_future_js = ("https://cdnjs.cloudflare.com/ajax/libs"
1188-
"/messenger/1.5.0/js/messenger-theme-future.js")
1189-
underscore_js = ("https://cdnjs.cloudflare.com/ajax/libs"
1190-
"/underscore.js/1.4.3/underscore-min.js")
1191-
backbone_js = ("https://cdnjs.cloudflare.com/ajax/libs"
1192-
"/backbone.js/0.9.10/backbone-min.js")
1193-
spinner_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1194-
"/messenger/1.5.0/css/messenger-spinner.css")
1195-
messenger_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1196-
"/messenger/1.5.0/css/messenger.css")
1197-
msgr_theme_flat_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1198-
"/messenger/1.5.0/css/messenger-theme-flat.css")
1199-
msgr_theme_future_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1200-
"/messenger/1.5.0/css/"
1201-
"messenger-theme-future.css")
1202-
msgr_theme_block_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1203-
"/messenger/1.5.0/css/"
1204-
"messenger-theme-block.css")
1205-
msgr_theme_air_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1206-
"/messenger/1.5.0/css/messenger-theme-air.css")
1207-
msgr_theme_ice_css = ("https://cdnjs.cloudflare.com/ajax/libs"
1208-
"/messenger/1.5.0/css/messenger-theme-ice.css")
1164+
jquery_js = constants.JQuery.MIN_JS
1165+
messenger_css = constants.Messenger.MIN_CSS
1166+
messenger_js = constants.Messenger.MIN_JS
1167+
msgr_theme_flat_js = constants.Messenger.THEME_FLAT_JS
1168+
msgr_theme_future_js = constants.Messenger.THEME_FUTURE_JS
1169+
msgr_theme_flat_css = constants.Messenger.THEME_FLAT_CSS
1170+
msgr_theme_future_css = constants.Messenger.THEME_FUTURE_CSS
1171+
msgr_theme_block_css = constants.Messenger.THEME_BLOCK_CSS
1172+
msgr_theme_air_css = constants.Messenger.THEME_AIR_CSS
1173+
msgr_theme_ice_css = constants.Messenger.THEME_ICE_CSS
1174+
spinner_css = constants.Messenger.SPINNER_CSS
1175+
underscore_js = constants.Underscore.MIN_JS
1176+
backbone_js = constants.Backbone.MIN_JS
12091177

12101178
msg_style = ("Messenger.options = {'maxMessages': 8, "
12111179
"extraClasses: 'messenger-fixed "
@@ -1224,7 +1192,7 @@ def activate_messenger(self):
12241192
self.add_css_link(spinner_css)
12251193
self.add_js_link(messenger_js)
12261194
self.add_js_link(msgr_theme_flat_js)
1227-
self.add_js_link(msg_theme_future_js)
1195+
self.add_js_link(msgr_theme_future_js)
12281196

12291197
for x in range(int(settings.MINI_TIMEOUT * 10.0)):
12301198
# Messenger needs a small amount of time to load & activate.

0 commit comments

Comments
 (0)