Skip to content

Standardize default starting widths across browsers #659

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 4 commits into from
Aug 18, 2020
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
6 changes: 3 additions & 3 deletions examples/swag_labs_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class SwagLabsTests(BaseCase):

def login(self, username="standard_user"):
def login_to_swag_labs(self, username="standard_user"):
""" Login to Swag Labs and verify that login was successful. """
self.open("https://www.saucedemo.com/")
if username not in self.get_text("#login_credentials"):
Expand All @@ -24,7 +24,7 @@ def login(self, username="standard_user"):
def test_swag_labs_basic_functional_flow(self, username):
""" This test checks functional flow of the Swag Labs store.
This test is parameterized, and receives the user for login. """
self.login(username=username)
self.login_to_swag_labs(username=username)

# Verify that the "Test.allTheThings() T-Shirt" appears on the page
item_name = "Test.allTheThings() T-Shirt"
Expand Down Expand Up @@ -87,5 +87,5 @@ def test_swag_labs_basic_functional_flow(self, username):
def test_swag_labs_products_page_resource_verification(self, username):
""" This test checks for 404 errors on the Swag Labs products page.
This test is parameterized, and receives the user for login. """
self.login(username=username)
self.login_to_swag_labs(username=username)
self.assert_no_404_errors()
17 changes: 17 additions & 0 deletions examples/test_login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from seleniumbase import BaseCase


class SwagLabsLoginTests(BaseCase):

def login_to_swag_labs(self):
""" Login to Swag Labs and verify that login was successful. """
self.open("https://www.saucedemo.com/")
self.type("#user-name", "standard_user")
self.type("#password", "secret_sauce")
self.click('input[type="submit"]')

def test_swag_labs_login(self):
""" This test checks standard login for the Swag Labs store. """
self.login_to_swag_labs()
self.assert_element("div.header_label div.app_logo")
self.assert_text("Products", "div.product_label")
4 changes: 2 additions & 2 deletions examples/test_swag_labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class SwagLabsTests(BaseCase):

def login(self, username="standard_user"):
def login_to_swag_labs(self, username="standard_user"):
""" Login to Swag Labs and verify that login was successful. """
self.open("https://www.saucedemo.com/")
if username not in self.get_text("#login_credentials"):
Expand All @@ -16,7 +16,7 @@ def login(self, username="standard_user"):

def test_swag_labs_basic_flow(self):
""" This test checks functional flow of the Swag Labs store. """
self.login(username="standard_user")
self.login_to_swag_labs(username="standard_user")

# Verify that the "Test.allTheThings() T-Shirt" appears on the page
item_name = "Test.allTheThings() T-Shirt"
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/console_scripts/sb_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
DEFAULT_CHROMEDRIVER_VERSION = "2.44"
DEFAULT_GECKODRIVER_VERSION = "v0.26.0"
DEFAULT_GECKODRIVER_VERSION = "v0.27.0"
DEFAULT_EDGEDRIVER_VERSION = "84.0.522.59"
DEFAULT_OPERADRIVER_VERSION = "v.84.0.4147.89"

Expand Down
16 changes: 13 additions & 3 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,8 +1856,17 @@ def get_new_driver(self, browser=None, headless=None,
except Exception:
pass # Keep existing browser resolution
elif self.browser == 'firefox':
pass # No changes
width = settings.CHROME_START_WIDTH
try:
if self.maximize_option:
self.driver.maximize_window()
else:
self.driver.set_window_size(width, 720)
self.wait_for_ready_state_complete()
except Exception:
pass # Keep existing browser resolution
elif self.browser == 'safari':
width = settings.CHROME_START_WIDTH
if self.maximize_option:
try:
self.driver.maximize_window()
Expand All @@ -1866,10 +1875,11 @@ def get_new_driver(self, browser=None, headless=None,
pass # Keep existing browser resolution
else:
try:
self.driver.set_window_rect(10, 30, 945, 630)
self.driver.set_window_rect(10, 30, width, 630)
except Exception:
pass
elif self.browser == 'opera':
width = settings.CHROME_START_WIDTH
if self.maximize_option:
try:
self.driver.maximize_window()
Expand All @@ -1878,7 +1888,7 @@ def get_new_driver(self, browser=None, headless=None,
pass # Keep existing browser resolution
else:
try:
self.driver.set_window_rect(10, 30, 1150, 700)
self.driver.set_window_rect(10, 30, width, 700)
except Exception:
pass
if self.start_page and len(self.start_page) >= 4:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

setup(
name='seleniumbase',
version='1.46.8',
version='1.46.9',
description='Web Automation and Test Framework - https://seleniumbase.io',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down