Skip to content

Add tests#1

Open
EvaV21 wants to merge 2 commits intomainfrom
develop
Open

Add tests#1
EvaV21 wants to merge 2 commits intomainfrom
develop

Conversation

@EvaV21
Copy link
Owner

@EvaV21 EvaV21 commented Feb 21, 2026

No description provided.

from locators import Locators

BASE_URL = "https://stellarburgers.education-services.ru/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: все тесты должны быть разделены на тестовые классы

conftest.py Outdated

# Фикстура с реальным email
@pytest.fixture
def test_email():
Copy link

@Ayantea1 Ayantea1 Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: фикстуры нужно использовать для хранения логики, а не просто возврата значений. Для хранения значений используй константы. Они у тебя и так есть, а фикстуры их дублируют

conftest.py Outdated

@pytest.fixture
def random_email():
return generate_email()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: фикстура ничего не добавляет к коду метода. Можно сразу реализовать всю логику в фикстуре, а передача метода в метод не имеет смысла

from selenium.webdriver.support import expected_conditions as EC
from locators import Locators

BASE_URL = "https://stellarburgers.education-services.ru/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: эта константа уже есть в config

from selenium.webdriver.common.by import By
from locators import Locators

TEST_EMAIL = "EvaWunder@yandex.ru"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно улучшить: тестовые данне лучше вынести в отдельный модуль

TEST_PASSWORD = "parol123"


def login(driver, wait):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: метод логина дублируется в разных модулях. действия для логина можно вынести в фикстуру целиком

login_btn = wait.until(EC.element_to_be_clickable(Locators.LOGIN_BUTTON))
login_btn.click()

@pytest.mark.parametrize("driver_name", ["chrome", "firefox"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: браузер не должен передаваться в качестве параметра. У нас должна быть возможность опционально выбрать окружение. Параметры - для тестовых данных

"Оформить заказ"
)
)
assert order_button, "Пользователь не авторизован после логина: кнопка не изменилась" No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: логин должен быть проверен с разных точек входа

from locators import Locators
from config import BASE_URL

OVERLAY = (By.CSS_SELECTOR, "div.Modal_modal_overlay__x2ZCr")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: локаторы должны быть вынесены

login_btn.click()

wait.until(EC.url_to_be(BASE_URL))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: не проверен переход по лого


def test_switch_to_buns(driver, wait):
driver.get(BASE_URL)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: этот таб активен по умолчанию Для проверки тебе нужно сначала переключится на другой


class TestLogin:

def login(self, driver, wait):
Copy link

@Ayantea1 Ayantea1 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно улучшить: большая часть дублирует фикстуру authorized_user. Возможно стоит убрать из фикстуры точку входа в форму логина, тогда не понадобится отдельный метод для тестирования разных точек входа. В идеале - передавать данные для входа в метод, тогда оя регистрации нового пользователя тоже не придется писать отдельный код

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants