Update example tests

This commit is contained in:
Michael Mintz 2021-04-21 22:54:42 -04:00
parent 6524a9f61e
commit 46529b61bf
8 changed files with 14 additions and 29 deletions

View File

@ -12,19 +12,19 @@ class ChartMakerPresentation(BaseCase):
self.add_data_point("Failed", 1, color="#f1888f")
self.add_slide("<p>Pie Chart</p>" + self.extract_chart())
self.create_bar_chart(title="Language", libs=False, legend=False)
self.create_bar_chart(title="Language", legend=False)
self.add_data_point("Python", 33, color="Orange")
self.add_data_point("JavaScript", 27, color="Teal")
self.add_data_point("HTML + CSS", 21, color="Purple")
self.add_slide("<p>Bar Chart</p>" + self.extract_chart())
self.create_column_chart(title="Colors", libs=False, legend=False)
self.create_column_chart(title="Colors", legend=False)
self.add_data_point("Red", 10, color="Red")
self.add_data_point("Green", 25, color="Green")
self.add_data_point("Blue", 15, color="Blue")
self.add_slide("<p>Column Chart</p>" + self.extract_chart())
self.create_line_chart(title="Last Week's Data", libs=False)
self.create_line_chart(title="Last Week's Data")
self.add_data_point("Sun", 5)
self.add_data_point("Mon", 10)
self.add_data_point("Tue", 20)

View File

@ -10,19 +10,19 @@ class MyChartMakerClass(BaseCase):
self.add_data_point("Failed", 1, color="#f1888f")
self.save_chart(filename="pie_chart.html")
self.create_bar_chart(title="Bar Chart", libs=False)
self.create_bar_chart(title="Bar Chart")
self.add_data_point("Python", 33, color="Orange")
self.add_data_point("JavaScript", 27, color="Teal")
self.add_data_point("HTML + CSS", 21, color="Purple")
self.save_chart(filename="bar_chart.html")
self.create_column_chart(title="Column Chart", libs=False)
self.create_column_chart(title="Column Chart")
self.add_data_point("Red", 10, color="Red")
self.add_data_point("Green", 25, color="Green")
self.add_data_point("Blue", 15, color="Blue")
self.save_chart(filename="column_chart.html")
self.create_line_chart(title="Line Chart", libs=False)
self.create_line_chart(title="Line Chart")
self.add_data_point("Sun", 5)
self.add_data_point("Mon", 10)
self.add_data_point("Tue", 20)

0
examples/migration/__init__.py Executable file
View File

View File

View File

@ -6,7 +6,7 @@ class AngularJSHomePageTests(BaseCase):
def test_greet_user(self):
self.open("http://www.angularjs.org")
self.type('[ng-model="yourName"]', "Julie")
self.assert_text("Hello Julie!", "h1.ng-binding")
self.assert_exact_text("Hello Julie!", "h1.ng-binding")
def test_todo_list(self):
self.open("http://www.angularjs.org")

View File

@ -8,11 +8,11 @@ class AngularMaterialPaginatorTests(BaseCase):
self.assert_element(".mat-button-wrapper > .mat-icon")
# Verify navigation to the next page
self.click('button[aria-label="Next page"]')
self.assert_text("11 20 of 100", ".mat-paginator-range-label")
self.assert_exact_text("11 20 of 100", ".mat-paginator-range-label")
# Verify navigation to the previous page
self.click('button[aria-label="Previous page"]')
self.assert_text("1 10 of 100", ".mat-paginator-range-label")
self.assert_exact_text("1 10 of 100", ".mat-paginator-range-label")
# Verify changed list length to 5 items per page
self.click("mat-select > div")
self.click("mat-option > .mat-option-text")
self.assert_text("1 5 of 100", ".mat-paginator-range-label")
self.assert_exact_text("1 5 of 100", ".mat-paginator-range-label")

View File

@ -15,6 +15,7 @@
specific needs, you may need to call SeleniumBase commands without
using Pytest, and this example shows you how. """
pure_python = False
try:
# Running with Pytest / (Finds test methods to run using autodiscovery)
# Example run command: "pytest raw_parameter_script.py"
@ -23,8 +24,10 @@ try:
except (ImportError, ValueError):
# Running with pure Python OR from a Python interactive interpreter
# Example run command: "python raw_parameter_script.py"
from my_first_test import MyTestClass # (relative imports DON'T work)
from my_first_test import MyTestClass # (relative imports do not work)
pure_python = True
if pure_python:
sb = MyTestClass("test_basics")
sb.browser = "chrome"
sb.headless = False

View File

@ -76,24 +76,6 @@ class SwagLabsTests(BaseCase):
self.click("button#continue-shopping")
self.assert_element_absent("span.shopping_cart_badge")
@parameterized.expand([
["standard_user"],
["problem_user"],
])
def test_swag_labs_visual_regressions(self, username):
""" This test checks for visual regressions on the Swag Labs page.
This test is parameterized on the login user. """
self.login_to_swag_labs(username="standard_user")
self.js_click("a#reset_sidebar_link")
self.js_click("a#logout_sidebar_link")
self.login_to_swag_labs(username="standard_user")
self.check_window(baseline=True)
self.js_click("a#logout_sidebar_link")
if username == "problem_user":
print("\n(This test should fail)")
self.login_to_swag_labs(username=username)
self.check_window(level=3)
def tearDown(self):
self.save_teardown_screenshot()
# Reset App State and Logout if the controls are present