From a71d62b67426d0ecb54c2c02a61cefa98fa3a71d Mon Sep 17 00:00:00 2001 From: aliwaleed1 <138436398+aliwaleed1@users.noreply.github.com> Date: Thu, 24 Aug 2023 03:44:25 +0300 Subject: [PATCH] Add files via upload --- pages/birthday.py | 17 +++++++++++++++++ tests/test_birthday.py | 34 ++++++++++++++++++++++++++++++++++ utils/base.py | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 pages/birthday.py create mode 100644 tests/test_birthday.py create mode 100644 utils/base.py diff --git a/pages/birthday.py b/pages/birthday.py new file mode 100644 index 000000000..9b8ef410a --- /dev/null +++ b/pages/birthday.py @@ -0,0 +1,17 @@ +"""page objects.""" +from selenium.webdriver.common.by import By + + +class Login: + """login class.""" + email = (By.XPATH, '//*[@type="email"]') + password = (By.XPATH, '//*[@type="password"]') + login_button = (By.XPATH, '//button[text()="Login"]') + undefined_message = (By.XPATH, '//*[@id="liveToast"]/div[2]') + + +class Birthday: + """Birthday class.""" + text1 = "//section[@class='task task--primary svelte-11utwz3']" + text2 = '//button' + birthday_button = (By.XPATH, text1+text2) diff --git a/tests/test_birthday.py b/tests/test_birthday.py new file mode 100644 index 000000000..81b2f2999 --- /dev/null +++ b/tests/test_birthday.py @@ -0,0 +1,34 @@ +"""Module to test meeting page.""" +import time +from selenium import webdriver +import pytest +from pages.birthday import Login, Birthday +from utils.base import BASEURL + + +@pytest.fixture(name="driver1") +def driver1_fixture(): + """Function to save driver fixture.""" + driver = webdriver.Edge() + driver.get(BASEURL) + yield driver + driver.quit() + + +def to_login(driver1): + """Function to login in tests.""" + email_input = driver1.find_element(*Login.email) + email_input.send_keys("A@test.cs") + password_input = driver1.find_element(*Login.password) + password_input.send_keys("123456789") + login_button = driver1.find_element(*Login.login_button) + login_button.click() + time.sleep(3) + + +def test_display_of_birthday_icon(driver1): + """Function to test birthday.""" + to_login(driver1) + birthday_button = driver1.find_element(*Birthday.birthday_button) + button_text = birthday_button.text + assert "🎂 BIRTHDAY" == button_text diff --git a/utils/base.py b/utils/base.py new file mode 100644 index 000000000..3ae4ec420 --- /dev/null +++ b/utils/base.py @@ -0,0 +1,2 @@ +"""base URL""" +BASEURL = "https://cshr.gent01.dev.grid.tf/"