Update examples
This commit is contained in:
parent
9d98cf19b8
commit
2d09587968
|
@ -22,9 +22,10 @@ class DemoSiteTests(BaseCase):
|
|||
# Verify that a hover dropdown link changes page text
|
||||
self.assert_text("Automation Practice", "h3")
|
||||
try:
|
||||
self.hover_and_click("#myDropdown", "#dropOption2")
|
||||
self.hover_and_click(
|
||||
"#myDropdown", "#dropOption2", timeout=2)
|
||||
except Exception:
|
||||
# If the user moves the mouse while the test runs
|
||||
# If a human moves the mouse while the test runs
|
||||
self.js_click("#dropOption2")
|
||||
self.assert_text("Link Two Selected", "h3")
|
||||
|
||||
|
@ -107,6 +108,11 @@ class DemoSiteTests(BaseCase):
|
|||
# Highlight a page element (Also asserts visibility)
|
||||
self.highlight("h2")
|
||||
|
||||
# Actions with Demo Mode enabled
|
||||
self.demo_mode = True
|
||||
self.type("input", "Have a Nice Day!")
|
||||
self.assert_text("SeleniumBase", "h2")
|
||||
|
||||
# Assert no broken links (Can be slow if many links)
|
||||
# self.assert_no_404_errors()
|
||||
|
||||
|
|
|
@ -337,7 +337,12 @@ def main():
|
|||
data.append(' self.type("textarea.area1", "Testing Time!\\n")')
|
||||
data.append(' self.type(\'[name="preText2"]\', "Typing Text!")')
|
||||
data.append(' self.assert_text("Automation Practice", "h3")')
|
||||
data.append(' self.hover_and_click("#myDropdown", "#dropOption2")')
|
||||
data.append(" try:")
|
||||
data.append(" self.hover_and_click(")
|
||||
data.append(' "#myDropdown", "#dropOption2", timeout=2)')
|
||||
data.append(" except Exception:")
|
||||
data.append(" # If a human moves the mouse while the test runs")
|
||||
data.append(' self.js_click("#dropOption2")')
|
||||
data.append(' self.assert_text("Link Two Selected", "h3")')
|
||||
data.append(' self.assert_text("This Text is Green", "#pText")')
|
||||
data.append(' self.click("#myButton")')
|
||||
|
@ -393,6 +398,9 @@ def main():
|
|||
data.append(' self.click_link("SeleniumBase Demo Page")')
|
||||
data.append(' self.assert_exact_text("Demo Page", "h1")')
|
||||
data.append(' self.highlight("h2")')
|
||||
data.append(" self.demo_mode = True")
|
||||
data.append(' self.type("input", "Have a Nice Day!")')
|
||||
data.append(' self.assert_text("SeleniumBase", "h2")')
|
||||
data.append("")
|
||||
file_path = "%s/%s" % (dir_name, "test_demo_site.py")
|
||||
file = codecs.open(file_path, "w+", "utf-8")
|
||||
|
|
Loading…
Reference in New Issue