From df4f204b0f5f369c5a61df62fd97fc87a0c6500c Mon Sep 17 00:00:00 2001 From: damyasoedov Date: Thu, 19 Dec 2024 19:24:41 +0300 Subject: [PATCH] feat: add tests for signin and signup happy path --- .gitignore | 2 + _secrets.py | 13 ++++ configs/__init__.py | 0 configs/config.py | 17 +++++ conftest.py | 35 ++++++++++ data/__init__.py | 0 data/person.py | 42 ++++++++++++ pages/__init__.py | 0 pages/base.py | 108 ++++++++++++++++++++++++++++++ pages/dashboard.py | 65 ++++++++++++++++++ pages/recovery.py | 15 +++++ pages/signin.py | 36 ++++++++++ pages/signup.py | 49 ++++++++++++++ pages/welcome_community.py | 33 +++++++++ pages/welcome_community_create.py | 29 ++++++++ pages/welcome_community_invite.py | 19 ++++++ pages/welcome_final.py | 24 +++++++ pages/welcome_user_info.py | 28 ++++++++ poetry.lock | 46 ++++++++++++- pyproject.toml | 3 + tests/__init__.py | 0 tests/base_test.py | 35 ++++++++++ tests/test_login_page.py | 57 ++++++++++++++++ 23 files changed, 655 insertions(+), 1 deletion(-) create mode 100644 _secrets.py create mode 100644 configs/__init__.py create mode 100644 configs/config.py create mode 100644 conftest.py create mode 100644 data/__init__.py create mode 100644 data/person.py create mode 100644 pages/__init__.py create mode 100644 pages/base.py create mode 100644 pages/dashboard.py create mode 100644 pages/recovery.py create mode 100644 pages/signin.py create mode 100644 pages/signup.py create mode 100644 pages/welcome_community.py create mode 100644 pages/welcome_community_create.py create mode 100644 pages/welcome_community_invite.py create mode 100644 pages/welcome_final.py create mode 100644 pages/welcome_user_info.py create mode 100644 tests/__init__.py create mode 100644 tests/base_test.py create mode 100644 tests/test_login_page.py diff --git a/.gitignore b/.gitignore index c1eeedc..139e22d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ env/ .mypy_cache/ .pytest_cache/ __pycache__/ +.env +allure/ diff --git a/_secrets.py b/_secrets.py new file mode 100644 index 0000000..e781bde --- /dev/null +++ b/_secrets.py @@ -0,0 +1,13 @@ +import os + +from dotenv import load_dotenv + +load_dotenv() + +try: + + LOGIN = os.environ["LOGIN"] + PASSWORD = os.environ["PASSWORD"] + USER_PASSWORD = os.environ["DEFAULT_USER_PASSWORD"] +except KeyError as e: + raise ValueError(f"Отсутствует необходимая переменная окружения: {e}") from None diff --git a/configs/__init__.py b/configs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/configs/config.py b/configs/config.py new file mode 100644 index 0000000..03b1341 --- /dev/null +++ b/configs/config.py @@ -0,0 +1,17 @@ +from dataclasses import dataclass + +from _secrets import LOGIN, PASSWORD, USER_PASSWORD + +base_url = "https://xieffect.ru/" + +app_base_url = "https://app.xieffect.ru" +signin_page = f"{app_base_url}/signin" +signup_page = f"{app_base_url}/signup" +recovery_page = f"{app_base_url}/reset-password" + + +@dataclass +class Credentials: + test_login: str = LOGIN + test_password: str = PASSWORD + user_password: str = USER_PASSWORD diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..568dc1c --- /dev/null +++ b/conftest.py @@ -0,0 +1,35 @@ +import logging + +import pytest +from _pytest.fixtures import SubRequest +from selenium import webdriver + + +def pytest_addoption(parser): + parser.addoption("--browser", action="store", default="chrome") + parser.addoption("--headed", action="store_true") + + +@pytest.fixture(scope="function", autouse=True) +def driver(request: SubRequest): + browser_name = request.config.getoption("--browser").lower() + headed_option = request.config.getoption("--headed") + logging.info(f"Options {request.config}") + + match browser_name: + case "chrome": + chrome_options = webdriver.ChromeOptions() + if not headed_option: + chrome_options.add_argument("--headless") + driver = webdriver.Chrome(options=chrome_options) + case "firefox": + firefox_options = webdriver.FirefoxOptions() + if not headed_option: + firefox_options.headless = True + driver = webdriver.Firefox() + case _: + raise ValueError(f"Unknown browser {browser_name}") + driver.maximize_window() + request.cls.driver = driver + yield driver + driver.quit() diff --git a/data/__init__.py b/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/data/person.py b/data/person.py new file mode 100644 index 0000000..d926e4b --- /dev/null +++ b/data/person.py @@ -0,0 +1,42 @@ +from dataclasses import dataclass, field + +from faker import Faker + +from configs.config import Credentials + +faker_en = Faker() + + +@dataclass +class Person: + """ + Represents a person with their basic information. + + Attributes: + display_name (str): Full name of the person. + username (str): Automatically generated username based on the display name. + community_name (str): Name of the person's community. + email (str): Email address of the person. + password (str): Password associated with the account. + """ + + display_name: str + username: str = field(init=False) + community_name: str = field(init=False) + email: str + password: str + + def __post_init__(self): + self.username = self.display_name.replace(" ", "_").lower() + self.community_name = self.display_name + " community" + + +class PersonCreateInfo: + + @staticmethod + def user_create_info() -> Person: + return Person( + display_name=faker_en.name(), + email=faker_en.email(), + password=Credentials().user_password, + ) diff --git a/pages/__init__.py b/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pages/base.py b/pages/base.py new file mode 100644 index 0000000..faaccb8 --- /dev/null +++ b/pages/base.py @@ -0,0 +1,108 @@ +from typing import Any + +from allure_commons.types import AttachmentType +from selenium.webdriver.common.by import By +from selenium.webdriver.remote.webdriver import WebDriver +from selenium.webdriver.remote.webelement import WebElement +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.ui import WebDriverWait + +import allure + + +class BasePage: + + def __init__(self, driver): + self.driver: WebDriver = driver + self.wait = WebDriverWait(driver, 20, poll_frequency=0.1) + + def go_to_page(self, url: str | None = None) -> None: + if url is None: + url = self.page_url + with allure.step(f"Go to {url=!s}"): + self.driver.get(url) + + def is_page_opened(self): + with allure.step(f"Page {self.page_url=!s} is opened"): + self.wait.until(EC.url_to_be(self.page_url)) + + def make_screenschot(self, screenshot_name): + allure.attach( + body=self.driver.get_screenshot_as_png(), + name=screenshot_name, + attachment_type=AttachmentType.PNG, + ) + + @allure.step("Get text from element") + def get_element_text(self, locator: str) -> str: + element = self.get_element_by(locator) + return element.text + + @staticmethod + def generate_locator(locator_value: str, find_by: str = "xpath") -> tuple[Any, str]: + """ + Generates a locator for finding an element on the web page. + + :param locator_value: The value of the locator (e.g., XPath expression). + :param find_by: The type of the locator. Defaults to 'xpath'. + :return: A tuple containing the By object and the locator value. + :raises ValueError: If the provided locator type is unknown. + """ + find_by = find_by.lower() + locating = { + "css": By.CSS_SELECTOR, + "xpath": By.XPATH, + "class_name": By.CLASS_NAME, + "id": By.ID, + "link_text": By.LINK_TEXT, + "name": By.NAME, + "partial_link_text": By.PARTIAL_LINK_TEXT, + "tag_name": By.TAG_NAME, + } + try: + by_type = locating[find_by] + + except KeyError: + raise ValueError(f"Unknown locator type: {find_by}") + result = by_type, locator_value + return result + + def get_element_by(self, locator: str, find_by: str = "xpath") -> WebElement: + """ + Finds an element on the web page using the specified locator + and returns it once it's visible. + + :param locator: The value of the locator (e.g., CSS selector + or XPath expression). + :param find_by: The type of the locator. Defaults to 'xpath'. + :return: The located WebElement. + :raises ValueError: If the provided locator type is unknown. + """ + find_by = find_by.lower() + locating = { + "css": By.CSS_SELECTOR, + "xpath": By.XPATH, + "class_name": By.CLASS_NAME, + "id": By.ID, + "link_text": By.LINK_TEXT, + "name": By.NAME, + "partial_link_text": By.PARTIAL_LINK_TEXT, + "tag_name": By.TAG_NAME, + } + + try: + by_type = locating[find_by] + except KeyError: + raise ValueError(f"Unknown locator type: {find_by}") + element = self.wait.until( + EC.visibility_of_element_located((by_type, locator)) + ) # to be visible + return element + + def send_keys(self, locator: str, value: str) -> None: + element = self.get_element_by(locator) + self.wait.until(EC.element_to_be_clickable(element)).send_keys(value) + + def click(self, locator: str) -> None: + element = self.get_element_by(locator) + self.wait.until(EC.element_to_be_clickable(element)).click() diff --git a/pages/dashboard.py b/pages/dashboard.py new file mode 100644 index 0000000..6d88a43 --- /dev/null +++ b/pages/dashboard.py @@ -0,0 +1,65 @@ +from dataclasses import dataclass, field + +from selenium.webdriver.support import expected_conditions as EC + +import allure +from pages.base import BasePage + + +@dataclass +class UserProfileMenu: + to_profile_btn: str = '//div[@id="user-profile-menu"]' # root + display_name: str = f"{to_profile_btn}//child::node()[2]/child::node()[1]" + user_name: str = f"{to_profile_btn}//child::node()[2]/child::node()[2]" + + +@dataclass +class CommunityProfileMenu: + root: str = '//div[@id="community-profile"]' + community_profile_btn: str = f'{root}/parent::div[@type="button"]' + community_profile_title: str = f"{root}/div[1]" + + +@dataclass +class Locators: + title: str = "//h2" + community_name: str = "//h2//following-sibling::node()/p" + user_role: str = "//header/p" + community_profile_menu: CommunityProfileMenu = field( + default_factory=CommunityProfileMenu + ) + user_profile_menu: UserProfileMenu = field(default_factory=UserProfileMenu) + to_onboarding_btn: str = ( + '//span[text()="Пройти обучение"]//parent::node()[@type="button"]' + ) + + +class DashboardPage(BasePage): + """Class for dashboard page""" + + locators: Locators = Locators() + + @allure.step("Check we at dashboard page") + def is_dashboard_page(self) -> bool: + title = self.generate_locator(self.locators.title) + return self.wait.until( + EC.text_to_be_present_in_element(title, "Добро пожаловать в сообщество") + ) + + def get_community_name(self) -> str: + return self.get_element_text(self.locators.community_name) + + def get_user_name(self) -> str: + return self.get_element_text(self.locators.user_profile_menu.user_name) + + def get_display_name(self) -> str: + return self.get_element_text(self.locators.user_profile_menu.display_name) + + def get_community_profile_title(self) -> str: + return self.get_element_text( + self.locators.community_profile_menu.community_profile_title + ) + + @allure.step('Verify that the user role displayed on the UI is "Administrator"') + def is_admin_user_role(self) -> bool: + return "администратор" in self.get_element_text(self.locators.user_role) diff --git a/pages/recovery.py b/pages/recovery.py new file mode 100644 index 0000000..d103bbb --- /dev/null +++ b/pages/recovery.py @@ -0,0 +1,15 @@ +from dataclasses import dataclass + +from pages.base import BasePage + + +@dataclass +class Locators: + recovery_form_title: str = '//h1[text()="Восстановление"]' + input_email: str = '//input[@name="email"]' + submit_btn: str = '//button[@type="submit"]' + signin_link: str = '//a[text()="Войти"]' + + +class Recovery(BasePage): + locators: Locators = Locators() diff --git a/pages/signin.py b/pages/signin.py new file mode 100644 index 0000000..dc762cb --- /dev/null +++ b/pages/signin.py @@ -0,0 +1,36 @@ +from dataclasses import dataclass + +from selenium.webdriver.support import expected_conditions as EC + +import allure +import configs.config +from pages.base import BasePage + + +@dataclass +class Locators: + signin_form_title: str = '//h1[text()="Вход в аккаунт"]' + input_email: str = '//input[@name="email"]' + input_password: str = '//input[@name="password"]' + reset_password: str = '//a[@href="/reset-password"]' + signup_link: str = '//a[@id="to-signup-link"]' + submit_btn: str = '//button[@type="submit"]' + + +class SigninPage(BasePage): + """Class for signin page""" + + page_url = configs.config.signin_page + locators = Locators() + + @allure.step("Enter login") + def enter_login(self, login: str) -> None: + self.send_keys(self.locators.input_email, login) + + @allure.step("Enter password") + def enter_password(self, password: str) -> None: + self.send_keys(self.locators.input_password, password) + + @allure.step("Click submit button") + def click_submit_button(self) -> None: + self.click(self.locators.submit_btn) diff --git a/pages/signup.py b/pages/signup.py new file mode 100644 index 0000000..4c5799c --- /dev/null +++ b/pages/signup.py @@ -0,0 +1,49 @@ +from dataclasses import dataclass + +from selenium.webdriver.support import expected_conditions as EC + +import allure +import configs.config +import data +from configs.config import signin_page +from data.person import Person, PersonCreateInfo +from pages.signin import SigninPage + + +@dataclass +class Locators: + signup_form_title = "//h1" + input_username: str = '//input[@name="username"]' + input_email: str = '//input[@name="email"]' + input_password: str = '//input[@name="password"]' + signin_link: str = '//a[@href="/signin"]' + submit_btn: str = '//button[@type="submit"]' + + +class SignupPage(SigninPage): + """Class for signup page""" + + page_url = configs.config.signup_page + locators = Locators() + + @allure.step("Enter username") + def enter_username(self, username: str) -> None: + self.send_keys(self.locators.input_username, username) + + @allure.step("Enter login") + def enter_email(self, email: str) -> None: + self.send_keys(self.locators.input_email, email) + + @allure.step("Enter password") + def enter_password(self, password: str) -> None: + self.send_keys(self.locators.input_password, password) + + @allure.step("Click submit button") + def click_submit_button(self) -> None: + self.click(self.locators.submit_btn) + + def go_to_signin_page(self) -> None: ... + + def is_signup_page(self) -> bool: + title = ("xpath", self.locators.signup_form_title) + return self.wait.until(EC.text_to_be_present_in_element(title, "Регистрация")) diff --git a/pages/welcome_community.py b/pages/welcome_community.py new file mode 100644 index 0000000..a01d02f --- /dev/null +++ b/pages/welcome_community.py @@ -0,0 +1,33 @@ +from dataclasses import dataclass + +import allure +from pages.base import BasePage + + +@dataclass +class Locators: + """Class for welcome community page locators""" + + title: str = '//*[@id="title"]' + create_btn: str = ( + '//span[normalize-space()="Создать"]//ancestor::node()[2][@type="button"]' + ) + join_btn: str = ( + '//span[normalize-space()="Присоединиться"]//ancestor::node()[2][@type="button"]' + ) + continue_btn: str = '//button[normalize-space()="Продолжить"]' + go_back_btn: str = '//button[normalize-space()="Назад"]' + + +class WelcomeCommunity(BasePage): + """Class for welcome community page elements""" + + locators: Locators = Locators() + + @allure.step("Click create button") + def click_create_button(self) -> None: + self.click(self.locators.create_btn) + + @allure.step("Click continue button") + def click_continue_button(self) -> None: + self.click(self.locators.continue_btn) diff --git a/pages/welcome_community_create.py b/pages/welcome_community_create.py new file mode 100644 index 0000000..5fe4488 --- /dev/null +++ b/pages/welcome_community_create.py @@ -0,0 +1,29 @@ +from dataclasses import dataclass + +import allure +from pages.base import BasePage + + +@dataclass +class Locators: + """Class for welcome community create page locators""" + + title: str = '//*[@id="title"]' # text Создайте сообщество + upload_file: str = '//input[@type="file"]' + community_name: str = '//input[@name="community"]' + continue_btn: str = '//button[normalize-space()="Продолжить"]' + go_back_btn: str = '//button[normalize-space()="Назад"]' + + +class WelcomeCommunityCreate(BasePage): + """Class for welcome community create page elements""" + + locators: Locators = Locators() + + @allure.step("Enter community name") + def enter_community_name(self, community_name: str) -> None: + self.send_keys(self.locators.community_name, community_name) + + @allure.step("Click create button") + def click_continue_button(self) -> None: + self.click(self.locators.continue_btn) diff --git a/pages/welcome_community_invite.py b/pages/welcome_community_invite.py new file mode 100644 index 0000000..abe5101 --- /dev/null +++ b/pages/welcome_community_invite.py @@ -0,0 +1,19 @@ +from dataclasses import dataclass + +import allure +from pages.base import BasePage + + +@dataclass +class Locators: + """Class for welcome community invite page locators""" + + invite_link: str = '//*[@class="relative"]/input' + continue_btn: str = '//button[@type="submit"]' + go_back_btn: str = '//button[normalize-space()="Назад"]' + + +class WelcomeCommunityInvite(BasePage): + """Class for welcome community page elements""" + + # move submit button to components diff --git a/pages/welcome_final.py b/pages/welcome_final.py new file mode 100644 index 0000000..34181dd --- /dev/null +++ b/pages/welcome_final.py @@ -0,0 +1,24 @@ +from dataclasses import dataclass + +import allure +from pages.base import BasePage + + +@dataclass +class Locators: + """Class for welcome community final page locators""" + + title: str = '//*[@id="title"]' # text Добро пожаловать! + show_tour_link: str = '//a[@href="/communities/1/home?show-tour=true"]' + about_link: str = '//a[@href="href="https://xieffect.ru/"' + start_button: str = '//button[normalize-space()="Начать работать"]' + + +class WelcomeFinal(BasePage): + """Class for welcome final page elements""" + + locators: Locators = Locators() + + @allure.step("Click start button") + def click_start_button(self): + self.click(self.locators.start_button) diff --git a/pages/welcome_user_info.py b/pages/welcome_user_info.py new file mode 100644 index 0000000..3114f88 --- /dev/null +++ b/pages/welcome_user_info.py @@ -0,0 +1,28 @@ +from dataclasses import dataclass + +import allure +from pages.base import BasePage + + +@dataclass +class Locators: + """Class for welcome user info page locators""" + + title: str = '//*[@id="title"]' + upload_file: str = '//input[@type="file"]' + display_name: str = '//input[@name="displayName"]' + email: str = ( + '//label[normalize-space()="Электронная почта"]//following-sibling::node()[1]' + ) + submit_btn: str = '//button[@type="submit"]' + + +class WelcomeUserInfo(BasePage): + """Class for welcome user info page elements""" + + locators: Locators = Locators() + + @allure.step("Check that we on the welcome user info page") + @allure.step("Enter display name") + def enter_display_name(self, display_name: str) -> None: + self.send_keys(self.locators.display_name, display_name) diff --git a/poetry.lock b/poetry.lock index 55736b2..a432da7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,35 @@ # This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +[[package]] +name = "allure-pytest" +version = "2.13.5" +description = "Allure pytest integration" +optional = false +python-versions = "*" +files = [ + {file = "allure-pytest-2.13.5.tar.gz", hash = "sha256:0ef8e1790c44a988db6b83c4d4f5e91451e2c4c8ea10601dfa88528d23afcf6e"}, + {file = "allure_pytest-2.13.5-py3-none-any.whl", hash = "sha256:94130bac32964b78058e62cf4b815ad97a5ac82a065e6dd2d43abac2be7640fc"}, +] + +[package.dependencies] +allure-python-commons = "2.13.5" +pytest = ">=4.5.0" + +[[package]] +name = "allure-python-commons" +version = "2.13.5" +description = "('Contains the API for end users as well as helper functions and classes to build Allure adapters for Python test frameworks',)" +optional = false +python-versions = ">=3.6" +files = [ + {file = "allure-python-commons-2.13.5.tar.gz", hash = "sha256:a232e7955811f988e49a4c1dd6c16cce7e9b81d0ea0422b1e5654d3254e2caf3"}, + {file = "allure_python_commons-2.13.5-py3-none-any.whl", hash = "sha256:8b0e837b6e32d810adec563f49e1d04127a5b6770e0232065b7cb09b9953980d"}, +] + +[package.dependencies] +attrs = ">=16.0.0" +pluggy = ">=0.4.0" + [[package]] name = "annotated-types" version = "0.7.0" @@ -1286,6 +1316,20 @@ pluggy = ">=0.12,<2.0" [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "pyyaml" version = "6.0.2" @@ -1502,4 +1546,4 @@ typing_extensions = ">=4.0,<5.0" [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "ef2b4761e6d08032597d959017cb449b8a6c26c213fa5bbd29c01f7e7e87207b" +content-hash = "1ab299b241bfa8c03212c513200164fa1d3103b80ea7950d0373c278ad7c23d0" diff --git a/pyproject.toml b/pyproject.toml index 7fd6c7e..a1f588a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,9 @@ python = "^3.12" pytest = "^7.2.2" httpx = "^0.27.2" pydantic-marshals = {extras = ["assert-contains"], version = "^0.3.14"} +allure-python-commons = "^2.13.5" +python-dotenv = "^1.0.1" +allure-pytest = "^2.13.5" [tool.poetry.group.dev.dependencies] flake8 = "7.0.0" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/base_test.py b/tests/base_test.py new file mode 100644 index 0000000..a236224 --- /dev/null +++ b/tests/base_test.py @@ -0,0 +1,35 @@ +import pytest +from selenium.webdriver.chrome.webdriver import WebDriver + +from pages.dashboard import DashboardPage +from pages.recovery import Recovery +from pages.signin import SigninPage +from pages.signup import SignupPage +from pages.welcome_community import WelcomeCommunity +from pages.welcome_community_create import WelcomeCommunityCreate +from pages.welcome_final import WelcomeFinal +from pages.welcome_user_info import WelcomeUserInfo + + +class BaseTest: + driver: WebDriver + signin: SigninPage + signup: SignupPage + recovery: Recovery + dashboard: DashboardPage + welcome_user_info: WelcomeUserInfo + welcome_community: WelcomeCommunity + welcome_community_create: WelcomeCommunityCreate + welcome_final: WelcomeFinal + + @pytest.fixture(autouse=True) + def setup(self, request, driver): + request.cls.driver = driver + request.cls.dashboard = DashboardPage(driver) + request.cls.recovery = Recovery(driver) + request.cls.signin = SigninPage(driver) + request.cls.signup = SignupPage(driver) + request.cls.welcome_user_info = WelcomeUserInfo(driver) + request.cls.welcome_community = WelcomeCommunity(driver) + request.cls.welcome_community_create = WelcomeCommunityCreate(driver) + request.cls.welcome_final = WelcomeFinal(driver) diff --git a/tests/test_login_page.py b/tests/test_login_page.py new file mode 100644 index 0000000..0c838a2 --- /dev/null +++ b/tests/test_login_page.py @@ -0,0 +1,57 @@ +import time + +import allure +from configs.config import Credentials +from data.person import Person, PersonCreateInfo +from tests.base_test import BaseTest + + +class TestLoginPage(BaseTest): + + @allure.title("Successfully signin") + def test_signin(self): + credentials = Credentials() + with allure.step("Go to signin page"): + self.signin.go_to_page() + self.signin.is_page_opened() + with allure.step("Fill form with test data"): + self.signin.enter_login(credentials.test_login) + self.signin.enter_password(credentials.test_password) + self.signin.click_submit_button() + assert self.dashboard.is_dashboard_page(), "We are not on dashboard page" + assert self.dashboard.get_user_name() == "test" + + @allure.title("Successful registration with community creation") + def test_signup_with_community_creation(self): + with allure.step("Create person"): + person: Person = PersonCreateInfo.user_create_info() + with allure.step("Go to signup page"): + self.signup.go_to_page() + self.signup.is_page_opened() + with allure.step("Fill form with person data"): + self.signup.enter_username(person.username) + self.signup.enter_login(person.email) + self.signup.enter_password(person.password) + self.signin.click_submit_button() + with allure.step("Enter display name and submit"): + self.welcome_user_info.enter_display_name(person.display_name) + self.signin.click_submit_button() + with allure.step("Create community"): + self.welcome_community.click_create_button() + self.welcome_community.click_continue_button() + self.welcome_community_create.enter_community_name(person.community_name) + self.welcome_community_create.click_continue_button() + self.welcome_final.click_start_button() + with allure.step("Check that we at community home page"): + self.dashboard.is_dashboard_page() + with allure.step("Verify community name"): + assert ( + person.community_name == self.dashboard.get_community_name() + ) # in welcome title, check it + assert person.community_name == self.dashboard.get_community_profile_title() + with allure.step("Verify user role"): + assert self.dashboard.is_admin_user_role() + with allure.step("Check user data in profile menu"): + assert person.display_name == self.dashboard.get_display_name() + assert person.username == self.dashboard.get_user_name() + time.sleep(10)