Refactoring tour styles

This commit is contained in:
Michael Mintz 2018-08-12 17:23:07 -04:00
parent 2f529d82a2
commit 8fd8c1a301
2 changed files with 50 additions and 48 deletions

View File

@ -96,3 +96,47 @@ style = title + '''<style type="text/css">
padding-left: 20px;
}
</style>'''
sh_style_test = (
'''
let test_tour = new Shepherd.Tour({
defaults: {
classes: 'shepherd-theme-dark',
scrollTo: true
}
});
''')
sh_backdrop_style = (
'''
body.shepherd-active .shepherd-target.shepherd-enabled {
box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.22);
pointer-events: none !important;
z-index: 9999;
}
body.shepherd-active .shepherd-orphan {
box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.16);
pointer-events: auto;
z-index: 9999;
}
body.shepherd-active
.shepherd-enabled.shepherd-element-attached-top {
position: relative;
}
body.shepherd-active
.shepherd-enabled.shepherd-element-attached-bottom {
position: relative;
}
body.shepherd-active .shepherd-step {
pointer-events: auto;
z-index: 9999;
}
body.shepherd-active {
pointer-events: none !important;
}
''')

View File

@ -42,6 +42,7 @@ from seleniumbase.core.testcase_manager import TestcaseDataPayload
from seleniumbase.core.testcase_manager import TestcaseManager
from seleniumbase.core import download_helper
from seleniumbase.core import log_helper
from seleniumbase.core import style_sheet
from seleniumbase.fixtures import constants
from seleniumbase.fixtures import page_actions
from seleniumbase.fixtures import page_utils
@ -860,46 +861,8 @@ class BaseCase(unittest.TestCase):
backbone_js = constants.Backbone.MIN_JS
spinner_css = constants.Messenger.SPINNER_CSS
backdrop_style = (
'''
body.shepherd-active .shepherd-target.shepherd-enabled {
box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.22);
pointer-events: none !important;
z-index: 9999;
}
body.shepherd-active .shepherd-orphan {
box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.16);
pointer-events: auto;
z-index: 9999;
}
body.shepherd-active
.shepherd-enabled.shepherd-element-attached-top {
position: relative;
}
body.shepherd-active
.shepherd-enabled.shepherd-element-attached-bottom {
position: relative;
}
body.shepherd-active .shepherd-step {
pointer-events: auto;
z-index: 9999;
}
body.shepherd-active {
pointer-events: none !important;
}
''')
sh_style = ("""let test_tour = new Shepherd.Tour({
defaults: {
classes: 'shepherd-theme-dark',
scrollTo: true
}
});""")
sh_style = style_sheet.sh_style_test
backdrop_style = style_sheet.sh_backdrop_style
self.__activate_bootstrap()
for x in range(4):
@ -922,7 +885,7 @@ class BaseCase(unittest.TestCase):
for x in range(int(settings.MINI_TIMEOUT * 2.0)):
# Shepherd needs a small amount of time to load & activate.
try:
self.execute_script(sh_style)
self.execute_script(sh_style) # Verify Shepherd has loaded
self.wait_for_ready_state_complete()
self.execute_script(sh_style) # Need it twice for ordering
time.sleep(0.05)
@ -936,14 +899,9 @@ class BaseCase(unittest.TestCase):
'''directive. ''' % self.driver.current_url)
def __is_shepherd_activated(self):
sh_style = ("""let test_tour = new Shepherd.Tour({
defaults: {
classes: 'shepherd-theme-dark',
scrollTo: true
}
});""")
sh_style = style_sheet.sh_style_test
try:
self.execute_script(sh_style)
self.execute_script(sh_style) # Verify Shepherd has loaded
return True
except Exception:
return False