Skip to content

Update examples and dependencies #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pip-delete-this-directory.txt
pip-selfcheck.json
ipython.1.gz
nosetests.1
.noseids

# Installer logs
pip-log.txt
Expand Down
4 changes: 2 additions & 2 deletions examples/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def test_basics(self):
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce\n")
self.assert_element("div.inventory_list")
self.assert_exact_text("PRODUCTS", "span.title")
self.assert_exact_text("Products", "span.title")
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
self.assert_exact_text("YOUR CART", "span.title")
self.assert_exact_text("Your Cart", "span.title")
self.assert_text("Backpack", "div.cart_item")
self.click('button:contains("Remove")') # HTML innerText
self.assert_text_not_visible("Backpack", "div.cart_item")
Expand Down
2 changes: 1 addition & 1 deletion examples/behave_bdd/features/steps/swag_labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def click_finish(context):
@step("Verify order complete")
def verify_order_complete(context):
sb = context.sb
sb.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
sb.assert_exact_text("Thank you for your order!", "h2")
sb.assert_element('img[alt="Pony Express"]')


Expand Down
4 changes: 2 additions & 2 deletions examples/hack_the_planet.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def test_all_your_base_are_belong_to_us(self):
self.open("https://azure.microsoft.com/en-us/services/playfab/")
self.remove_elements('div[role="dialog"]')
self.set_text_content("h1", aybabtu)
self.set_text_content('a[aria-label*="Try PlayF"]', ayb)
self.set_text_content('a[aria-label*="Try Azure"]', ayb)
self.set_text_content('a[aria-label*="Sign in to"]', abtu)
self.highlight("h1", loops=6, scroll=False)
self.highlight('a[aria-label*="Try PlayF"]', loops=4, scroll=False)
self.highlight('a[aria-label*="Try Azure"]', loops=4, scroll=False)
self.highlight('a[aria-label*="Sign in to"]', loops=6, scroll=False)

self.open("https://store.steampowered.com/")
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/raw_selenium/flaky_messy_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def test_add_item_to_cart(self):
element.submit()
self.driver.find_element(by_css, "div.inventory_list")
element = self.driver.find_element(by_css, "span.title")
self.assertEqual(element.text, "PRODUCTS")
self.assertEqual(element.text, "Products")
self.driver.find_element(by_css, 'button[name*="backpack"]').click()
self.driver.find_element(by_css, "#shopping_cart_container a").click()
element = self.driver.find_element(by_css, "span.title")
self.assertEqual(element.text, "YOUR CART")
self.assertEqual(element.text, "Your Cart")
element = self.driver.find_element(by_css, "div.cart_item")
self.assertIn("Backpack", element.text)
self.driver.find_element(by_css, "#remove-sauce-labs-backpack").click()
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/raw_selenium/long_messy_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_add_item_to_cart(self):
element = WebDriverWait(self.driver, 10).until(
EC.visibility_of_element_located((by_css, "span.title"))
)
self.assertEqual(element.text, "PRODUCTS")
self.assertEqual(element.text, "Products")
element = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((by_css, 'button[name*="backpack"]'))
)
Expand All @@ -64,7 +64,7 @@ def test_add_item_to_cart(self):
element = WebDriverWait(self.driver, 10).until(
EC.visibility_of_element_located((by_css, "span.title"))
)
self.assertEqual(element.text, "YOUR CART")
self.assertEqual(element.text, "Your Cart")
element = WebDriverWait(self.driver, 10).until(
EC.visibility_of_element_located((by_css, "div.cart_item"))
)
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/raw_selenium/messy_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def test_add_item_to_cart(self):
element.submit()
self.wait_for_element_visible("div.inventory_list")
element = self.wait_for_element_visible("span.title")
self.assertEqual(element.text, "PRODUCTS")
self.assertEqual(element.text, "Products")
self.wait_for_element_clickable('button[name*="backpack"]').click()
self.wait_for_element_clickable("#shopping_cart_container a").click()
element = self.wait_for_element_visible("span.title")
self.assertEqual(element.text, "YOUR CART")
self.assertEqual(element.text, "Your Cart")
element = self.wait_for_element_visible("div.cart_item")
self.assertIn("Backpack", element.text)
self.wait_for_element_clickable("#remove-sauce-labs-backpack").click()
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/raw_selenium/refined_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def test_add_item_to_cart(self):
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce\n")
self.assert_element("div.inventory_list")
self.assert_text("PRODUCTS", "span.title")
self.assert_text("Products", "span.title")
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
self.assert_exact_text("YOUR CART", "span.title")
self.assert_exact_text("Your Cart", "span.title")
self.assert_text("Backpack", "div.cart_item")
self.click("#remove-sauce-labs-backpack")
self.assert_element_not_visible("div.cart_item")
Expand Down
4 changes: 2 additions & 2 deletions examples/migration/raw_selenium/simple_sbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def test_add_item_to_cart(self):
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce\n")
self.assert_element("div.inventory_list")
self.assert_text("PRODUCTS", "span.title")
self.assert_text("Products", "span.title")
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
self.assert_exact_text("YOUR CART", "span.title")
self.assert_exact_text("Your Cart", "span.title")
self.assert_text("Backpack", "div.cart_item")
self.click("#remove-sauce-labs-backpack")
self.assert_element_not_visible("div.cart_item")
Expand Down
2 changes: 1 addition & 1 deletion examples/performance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def login_to_swag_labs(self):
def test_performance_of_swag_labs(self):
self.login_to_swag_labs()
self.assert_element("div.inventory_list")
self.assert_exact_text("PRODUCTS", "span.title")
self.assert_exact_text("Products", "span.title")
with decorators.print_runtime("Add backpack and see cart"):
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
Expand Down
9 changes: 4 additions & 5 deletions examples/swag_labs_user_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def login_to_swag_labs(self, username="standard_user"):
url = "https://www.saucedemo.com"
self.open(url)
self.wait_for_element("div.login_logo")
self.wait_for_element("div.bot_column")
if username not in self.get_text("#login_credentials"):
self.fail("Invalid user for login: %s" % username)
self.type("#user-name", username)
Expand Down Expand Up @@ -41,18 +40,18 @@ def test_swag_labs_user_flows(self, username):
self.fail('Sort Failed! Expecting "%s" on top!' % item_name)

# Add the "Test.allTheThings() T-Shirt" to the cart
self.assert_exact_text("ADD TO CART", "button.btn_inventory")
self.assert_exact_text("Add to cart", "button.btn_inventory")
item_price = self.get_text("div.inventory_item_price")
self.click("button.btn_inventory")
self.assert_exact_text("REMOVE", "button.btn_inventory")
self.assert_exact_text("Remove", "button.btn_inventory")
self.assert_exact_text("1", "span.shopping_cart_badge")

# Verify your cart
self.click("#shopping_cart_container a")
self.assert_element('span:contains("Your Cart")')
self.assert_text(item_name, "div.inventory_item_name")
self.assert_exact_text("1", "div.cart_quantity")
self.assert_exact_text("REMOVE", "button.cart_button")
self.assert_exact_text("Remove", "button.cart_button")
self.assert_element("button#continue-shopping")

# Checkout - Add info
Expand All @@ -73,7 +72,7 @@ def test_swag_labs_user_flows(self, username):

# Finish Checkout and verify that the cart is now empty
self.click("button#finish")
self.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
self.assert_exact_text("Thank you for your order!", "h2")
self.assert_element("img.pony_express")
self.click("#shopping_cart_container a")
self.assert_element_absent("div.inventory_item_name")
Expand Down
6 changes: 3 additions & 3 deletions examples/test_download_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class DownloadImages(BaseCase):
def test_download_images_directly(self):
self.open("seleniumbase.io/examples/chart_maker/ReadMe")
self.open("seleniumbase.github.io/examples/chart_maker/ReadMe")
img_elements_with_src = self.find_elements("img[src]")
unique_src_values = []
for img in img_elements_with_src:
Expand All @@ -29,7 +29,7 @@ def test_download_images_via_screenshot(self):
self.open("about:blank")
print("Skipping test in Recorder Mode.")
self.skip("Skipping test in Recorder Mode.")
self.open("seleniumbase.io/error_page/")
self.open("seleniumbase.github.io/error_page/")
img_elements_with_src = self.find_elements("img[src]")
unique_src_values = []
for img in img_elements_with_src:
Expand All @@ -41,7 +41,7 @@ def test_download_images_via_screenshot(self):
for src in unique_src_values:
self.open(src)
if not self.headless and not self.headless2:
self.highlight("img", loops=1)
self.sleep(0.3)
image = self.find_element("img")
if src.startswith("data:") or ";base64" in src:
# Special Cases: SVGs, etc. Convert to PNG.
Expand Down
1 change: 0 additions & 1 deletion examples/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class SwagLabsLoginTests(BaseCase):
def login_to_swag_labs(self):
self.open("https://www.saucedemo.com")
self.wait_for_element("div.login_logo")
self.wait_for_element("div.bot_column")
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce")
self.click('input[type="submit"]')
Expand Down
4 changes: 2 additions & 2 deletions examples/test_pytest_parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"value", ["List of Features", "Command Line Options"]
)
def test_sb_fixture_with_no_class(sb, value):
sb.open("https://seleniumbase.io/help_docs/install/")
sb.open("seleniumbase.github.io/help_docs/install/")
sb.type('input[aria-label="Search"]', value)
sb.click("nav h1 mark")
sb.assert_title_contains(value)
Expand All @@ -17,7 +17,7 @@ class Test_SB_Fixture:
"value", ["Console Scripts", "API Reference"]
)
def test_sb_fixture_inside_class(self, sb, value):
sb.open("https://seleniumbase.io/help_docs/install/")
sb.open("seleniumbase.github.io/help_docs/install/")
sb.type('input[aria-label="Search"]', value)
sb.click("nav h1 mark")
sb.assert_title_contains(value)
Expand Down
6 changes: 3 additions & 3 deletions examples/test_repeat_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class RepeatTests(BaseCase):
@parameterized.expand([[]] * 2)
def test_repeat_this_test_with_parameterized(self):
self.page_load_strategy = "none"
self.open("https://seleniumbase.io")
self.open("seleniumbase.github.io")
self.click('a[href="help_docs/method_summary/"]')
self.assert_text("API Reference", "h1")


@pytest.mark.parametrize("", [[]] * 2)
def test_repeat_this_test_with_pytest_parametrize(sb):
sb.page_load_strategy = "none"
sb.open("https://seleniumbase.io")
sb.open("seleniumbase.github.io")
sb.click('a[href="seleniumbase/console_scripts/ReadMe/"]')
sb.assert_text("Console Scripts", "h1")

Expand All @@ -28,6 +28,6 @@ class RepeatTestsWithPytest:
@pytest.mark.parametrize("", [[]] * 2)
def test_repeat_test_with_pytest_parametrize(self, sb):
sb.page_load_strategy = "none"
sb.open("https://seleniumbase.io")
sb.open("seleniumbase.github.io")
sb.click('a[href="help_docs/customizing_test_runs/"]')
sb.assert_text("Command Line Options", "h1")
8 changes: 4 additions & 4 deletions examples/test_swag_labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ def test_swag_labs_basic_flow(self):
self.fail('Sort Failed! Expecting "%s" on top!' % item_name)

# Add the "Test.allTheThings() T-Shirt" to the cart
self.assert_exact_text("ADD TO CART", "button.btn_inventory")
self.assert_exact_text("Add to cart", "button.btn_inventory")
item_price = self.get_text("div.inventory_item_price")
self.click("button.btn_inventory")
self.assert_exact_text("REMOVE", "button.btn_inventory")
self.assert_exact_text("Remove", "button.btn_inventory")
self.assert_exact_text("1", "span.shopping_cart_badge")

# Verify your cart
self.click("#shopping_cart_container a")
self.assert_element('span:contains("Your Cart")')
self.assert_text(item_name, "div.inventory_item_name")
self.assert_exact_text("1", "div.cart_quantity")
self.assert_exact_text("REMOVE", "button.cart_button")
self.assert_exact_text("Remove", "button.cart_button")
self.assert_element("button#continue-shopping")

# Checkout - Add info
Expand All @@ -60,7 +60,7 @@ def test_swag_labs_basic_flow(self):

# Finish Checkout and verify that the cart is now empty
self.click("button#finish")
self.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
self.assert_exact_text("Thank you for your order!", "h2")
self.click("#shopping_cart_container a")
self.assert_element_absent("div.inventory_item_name")
self.click("button#continue-shopping")
Expand Down
4 changes: 2 additions & 2 deletions examples/translations/english_test_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def test_example_1(self):
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce\n")
self.assert_element("#inventory_container")
self.assert_exact_text("PRODUCTS", "span.title")
self.assert_exact_text("Products", "span.title")
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
self.assert_exact_text("YOUR CART", "span.title")
self.assert_exact_text("Your Cart", "span.title")
self.assert_text("Backpack", "div.cart_item")
self.click('button:contains("Remove")') # HTML innerText
self.assert_text_not_visible("Backpack", "div.cart_item")
Expand Down
2 changes: 1 addition & 1 deletion integrations/behave/features/steps/swag_labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def click_finish(context):
@step("Verify order complete")
def verify_order_complete(context):
sb = context.sb
sb.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
sb.assert_exact_text("Thank you for your order!", "h2")
sb.assert_element('img[alt="Pony Express"]')


Expand Down
8 changes: 4 additions & 4 deletions integrations/node_js/my_first_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ def test_swag_labs(self):
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce\n")
self.assert_element("#inventory_container")
self.assert_text("PRODUCTS", "span.title")
self.assert_text("Products", "span.title")
self.click('button[name*="backpack"]')
self.click("#shopping_cart_container a")
self.assert_text("YOUR CART", "span.title")
self.assert_text("Your Cart", "span.title")
self.assert_text("Backpack", "div.cart_item")
self.click("button#checkout")
self.type("#first-name", "SeleniumBase")
self.type("#last-name", "Automation")
self.type("#postal-code", "77123")
self.click("input#continue")
self.assert_text("CHECKOUT: OVERVIEW")
self.assert_text("Checkout: Overview")
self.assert_text("Backpack", "div.cart_item")
self.click("button#finish")
self.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
self.assert_exact_text("Thank you for your order!", "h2")
self.assert_element('img[alt="Pony Express"]')
self.js_click("a#logout_sidebar_link")
4 changes: 2 additions & 2 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ bleach==6.0.0
lunr==0.6.2
nltk==3.8.1
tornado==6.2
watchdog==2.3.0
watchdog==2.3.1
cairocffi==1.4.0
cairosvg==2.6.0
cssselect2==0.7.0
tinycss2==1.2.1
defusedxml==0.7.1
mkdocs==1.4.2
mkdocs-material==9.0.14
mkdocs-material==9.0.15
mkdocs-exclude-search==0.6.5
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.1.1
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ platformdirs>=2.4.0;python_version<"3.7"
platformdirs>=3.0.0;python_version>="3.7"
pyparsing>=3.0.7;python_version<"3.7"
zipp==3.6.0;python_version<"3.7"
zipp>=3.14.0;python_version>="3.7"
zipp>=3.15.0;python_version>="3.7"
more-itertools==8.14.0;python_version<"3.7"
more-itertools>=9.1.0;python_version>="3.7"
six==1.16.0
idna==3.4
chardet==4.0.0;python_version<"3.7"
Expand All @@ -33,7 +35,7 @@ urllib3==1.26.14;python_version>="3.7"
requests==2.27.1;python_version<"3.7"
requests==2.28.2;python_version>="3.7"
requests-toolbelt==0.10.1
nose==1.3.7
pynose==1.4.1
sniffio==1.3.0;python_version>="3.7"
h11==0.14.0;python_version>="3.7"
outcome==1.2.0;python_version>="3.7"
Expand All @@ -45,8 +47,6 @@ wsproto==1.2.0;python_version>="3.7"
selenium==3.141.0;python_version<"3.7"
selenium==4.8.2;python_version>="3.7"
msedge-selenium-tools==3.141.3;python_version<"3.7"
more-itertools==8.14.0;python_version<"3.7"
more-itertools==9.0.0;python_version>="3.7"
cssselect==1.1.0;python_version<"3.7"
cssselect==1.2.0;python_version>="3.7"
sortedcontainers==2.4.0
Expand Down Expand Up @@ -101,7 +101,7 @@ rich==13.3.1;python_version>="3.7"
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)

coverage==6.2;python_version<"3.7"
coverage==7.2.0;python_version>="3.7"
coverage==7.2.1;python_version>="3.7"
pytest-cov==4.0.0
flake8==5.0.4;python_version<"3.9"
flake8==6.0.0;python_version>="3.9"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.13.4"
__version__ = "4.13.5"
Loading