-
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
092e42b
commit ac5569c
Showing
3 changed files
with
25 additions
and
33 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
|
||
class login: | ||
|
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 |
---|---|---|
@@ -1,11 +0,0 @@ | ||
import time | ||
import pytest | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.chrome.service import Service | ||
@pytest.fixture | ||
def driver(): | ||
driver = webdriver.Chrome() | ||
driver.get("https://cshr.gent01.dev.grid.tf") | ||
return driver | ||
|
||
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 |
---|---|---|
@@ -1,48 +1,52 @@ | ||
from pages.login import login | ||
from tests.contest import driver | ||
import utils | ||
import time | ||
|
||
def test_user_login(driver): | ||
from pages.login import login | ||
import pytest | ||
from selenium import webdriver | ||
@pytest.fixture | ||
def driver1(): | ||
driver = webdriver.Chrome() | ||
driver.get("https://cshr.gent01.dev.grid.tf") | ||
yield driver | ||
driver.quit() | ||
def test_user_login(driver1): | ||
login_instance = login() | ||
# Enter email | ||
email_input = driver.find_element(*login_instance.email) | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
# Enter password | ||
password_input = driver.find_element(*login_instance.password) | ||
password_input = driver1.find_element(*login_instance.password) | ||
password_input.send_keys("123456789") | ||
# Click on Login button | ||
Check failure on line 19 in tests/test_login.py GitHub Actions / Flake8tests/test_login.py#L19
|
||
login_button = driver.find_element(*login_instance.login_button) | ||
login_button = driver1.find_element(*login_instance.login_button) | ||
login_button.click() | ||
|
||
time.sleep(20) | ||
time.sleep(10) | ||
# Get the profile | ||
profile = driver.find_element(*login_instance.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(driver): | ||
def test_invalid_login(driver1): | ||
login_instance = login() | ||
# Enter email invalid email | ||
email_input = driver.find_element(*login_instance.email) | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
|
||
# Enter invalid password | ||
password_input = driver.find_element(*login_instance.password) | ||
password_input = driver1.find_element(*login_instance.password) | ||
password_input.send_keys("123456789") | ||
|
||
# Click on Login button | ||
login_button = driver.find_element(*login_instance.login_button) | ||
try: | ||
login_button.click() | ||
except Exception as e: | ||
assert "element not clickable" | ||
def test_email_validation(driver): | ||
login_button = driver1.find_element(*login_instance.login_button) | ||
try:login_button.click() | ||
Check failure on line 40 in tests/test_login.py GitHub Actions / Flake8tests/test_login.py#L40
|
||
except ImportError: | ||
assert True | ||
def test_email_validation(driver1): | ||
login_instance = login() | ||
# Enter email invalid email | ||
email_input = driver.find_element(*login_instance.email) | ||
email_input = driver1.find_element(*login_instance.email) | ||
email_input.send_keys("[email protected]") | ||
# get the error message | ||
undefined_message=driver.find_element(*login_instance.undefined_message) | ||
undefined_message=driver1.find_element(*login_instance.undefined_message) | ||
actual_text = undefined_message.text | ||
expected_text = "undefined" | ||
assert actual_text == expected_text | ||