Skip to content

Sprint 6#2

Open
Airflp wants to merge 10 commits into
masterfrom
sprint_6
Open

Sprint 6#2
Airflp wants to merge 10 commits into
masterfrom
sprint_6

Conversation

@Airflp

@Airflp Airflp commented Mar 5, 2026

Copy link
Copy Markdown
Owner

No description provided.

Comment thread .pytest_cache/v/cache/nodeids Outdated
@@ -0,0 +1,15 @@
[

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить: эта директория лишняя в проекте. Необходимо убрать её из ветки и добавить в .gitignore в корне проекта

Comment thread locators/locators_main_page_locators.py Outdated
Comment on lines +4 to +5
ORDER_BUTTON_TOP = (By.XPATH, "//button[contains(text(), 'Заказать')]")
ORDER_BUTTON_BOTTOM = (By.XPATH, "//button[contains(text(), 'Заказать')]")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить: эти локаторы идентичны. Стоит привязаться к уникальным атрибутам этих элементов или их родителей

Comment thread pages/base_page.py Outdated


class BasePage:
BASE_URL = "https://qa-scooter.praktikum-services.ru/"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно лучше здесь и далее: адреса лучше вынести во внешний модуль(например, urls). Они могут измениться, что затруднит поддержку тестов

Comment thread pages/base_page.py Outdated
def __init__(self, driver):
self.driver = driver

def find_element(self, locator, time=10):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить здесь и далее: не хватает аннотации allure для шага - allure.step

Comment thread pages/main_page.py Outdated

# Локаторы для кнопок заказа
ORDER_BUTTON_TOP = (By.XPATH, "//button[@class='Button_Button__ra12g']")
ORDER_BUTTON_BOTTOM = (By.XPATH, "(//button[text()='Заказать'])[2]")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить здесь и далее: не стоит использовать в локаторах путь от рута, абсолютный путь или индексы элемента. Это делает локатор очень хрупким

Comment thread locators/locators_main_page_locators.py Outdated
@@ -0,0 +1,9 @@
from locators.main_page_locators import MainPageLocators

class MainPageLocators:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить: классы этого пакета нигде не используются

Comment thread pages/main_page.py Outdated
Comment on lines +101 to +104
for domain in ['dzen.ru', 'yandex.ru', 'ya.ru']:
if self.wait_for_url_contains(domain, timeout=5):
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить: проверка для теста получилась не атомарной. Стоит проверять редирект на конкретный адрес

Comment thread tests/test_order.py Outdated
Comment on lines +47 to +50
if order_button == "top":
main_page.click_order_button_top()
else:
main_page.click_order_button_bottom()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно исправить: использование условных блоков в теле теста лишает их атомарности. Можно попробовать, например, расширить количество параметров или их переработать дабы избежать этой ситуации. Если не получается объединить их все, то отдельные можно разместить отдельно исключив из параметризации

Comment thread tests/test_order.py Outdated
assert main_page.check_yandex_redirect_url(), "Не открылась страница Яндекса/Дзена"

# Закрываем новое окно и возвращаемся к основному
main_page.close_current_window_and_switch_to(main_window) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread pages/base_page.py
def __init__(self, driver):
self.driver = driver

def find_element(self, locator, timeout=10):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить здесь и далее: не хватает аннотации allure для шага - allure.step

Comment thread pages/main_page.py Outdated
Comment on lines +60 to +67
WebDriverWait(self.driver, 10).until(
EC.number_of_windows_to_be(2)
)

for window in self.driver.window_handles:
if window != main_window:
self.driver.switch_to.window(window)
break No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить здесь и далее: все вызовы к driver/WebDriverWait должны быть описаны в методах BasePage, а затем вызываться через эти методы в *Page-классах через наследование. Стоит посмотреть в сторону EC.new_window_is_opened

Comment thread tests/test_order.py Outdated
Comment on lines +41 to +44
if button == "top":
main_page.click_order_button_top()
else:
main_page.click_order_button_bottom()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно исправить: использование условных блоков в теле теста лишает их атомарности. Можно попробовать описать метод который будет принимать нужный локатор кнопки заказа, а сам локатор передавать из параметров теста

Comment thread tests/test_order.py Outdated
main_page.click_order_button_top()
main_page.click_scooter_logo()

assert "scooter" in driver.current_url

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно исправить: здесь и далее, все вызовы к driver/WebDriverWait напрямую из теста или фикстуры не допустимы (кроме get). Необходимо реализовать соответствующий метод в BasePage и вызывать его

Comment thread tests/test_order.py Outdated
Comment on lines +69 to +73
main_window = driver.current_window_handle

main_page.click_yandex_logo_and_wait_for_new_window(main_window)

assert "dzen" in driver.current_url No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужно исправить: здесь и далее, все вызовы к driver/WebDriverWait напрямую из теста или фикстуры не допустимы (кроме get). Необходимо реализовать соответствующий метод в BasePage и вызывать его

Comment thread conftest.py
from selenium import webdriver


@pytest.fixture(scope="class")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Необходимо исправить: такой скоуп создает зависимые тесты. Стоит использовать скоуп function

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не исправлено

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