Created
September 29, 2020 20:21
-
-
Save boatcoder/663e9abeca74dca7d6f1b8fa663b10a1 to your computer and use it in GitHub Desktop.
A simple test using the PageElements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium.webdriver.support.ui import WebDriverWait | |
import pages | |
def test_login_with_invalid_credentials(login_url): | |
try: | |
driver = get_browser() | |
driver.get(login_url) | |
login_page = pages.LoginPage(driver) | |
# Can't use this method here since we want to actually test the various aspects of | |
# logging in and failing to log in | |
# login_page.login() - Use this in other tests where you just need to login to do the | |
# test | |
login_page.username = XXXXXXXX | |
login_page.password = XXXXXXXX | |
login_page.click_login_button() | |
assert(login_page.error_message.text == 'Invalid email or password. Please try again.') | |
assert(driver.current_url == login_url) | |
finally: | |
logger.info('Quitting browser') | |
driver.quit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment