-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73d0da5
commit 63f82d5
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from selenium.webdriver.common.by import By | ||
|
||
|
||
class login: | ||
email = (By.XPATH, '//*[@type="email"]') | ||
password = (By.XPATH, '//*[@type="password"]') | ||
login_button = (By.XPATH, '//button[text()="Login"]') | ||
xpath_profile = '//span[@class="user-profile-image rounded-circle svelte-1' | ||
profile = (By.XPATH, xpath_profile + '8t1c4h" and contains(text(), "AW")]') | ||
undefined_message = (By.XPATH, '//*[@id="liveToast"]/div[2]') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import time | ||
from pages.login import login | ||
import pytest | ||
from selenium import webdriver | ||
|
||
|
||
@pytest.fixture | ||
def driver1(): | ||
driver = webdriver.Edge() | ||
driver.get("https://cshr.gent01.dev.grid.tf") | ||
yield driver | ||
driver.quit() | ||
|
||
|
||
def test_user_login(driver1): | ||
login_instance = login() | ||
# Enter email | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
# Enter password | ||
password_input = driver1.find_element(*login_instance.password) | ||
password_input.send_keys("123456789") | ||
# Click on Login button | ||
login_button = driver1.find_element(*login_instance.login_button) | ||
login_button.click() | ||
|
||
time.sleep(2) | ||
# Get the profile | ||
profile = driver1.find_element(*login_instance.profile) | ||
# Assert that the element includes the text "AW" | ||
assert "aw" in profile.text.lower() | ||
|
||
|
||
def test_invalid_login(driver1): | ||
login_instance = login() | ||
# Enter email invalid email | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
# Enter invalid password | ||
password_input = driver1.find_element(*login_instance.password) | ||
password_input.send_keys("123456789") | ||
# Click on Login button | ||
login_button = driver1.find_element(*login_instance.login_button) | ||
try: | ||
login_button.click() | ||
except ImportError: | ||
assert True | ||
|
||
|
||
def test_email_validation(driver1): | ||
login_instance = login() | ||
# Enter email invalid email | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
# get the error message | ||
undefined_message = driver1.find_element(*login_instance.undefined_message) | ||
actual_text = undefined_message.text | ||
expected_text = "undefined" | ||
assert actual_text == expected_text |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"""base URL""" | ||
BASEURL = "https://cshr.gent01.dev.grid.tf/" |