-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hw 3.1 #16
base: main
Are you sure you want to change the base?
Hw 3.1 #16
Conversation
# Conflicts: # niffler-e-2-e-tests/src/test/java/guru/qa/niffler/jupiter/extension/SpendingExtension.java # niffler-e-2-e-tests/src/test/java/guru/qa/niffler/test/web/SpendingWebTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Добрый день
Работу принял. В комментах подсветил пару моментов
private final SelenideElement statisticsHeader = $(".css-giaux5"); | ||
private final SelenideElement historyHeader = $(".css-uxhuts"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Подобные классы .css-giaux5 лучше не использовать в качестве локаторов - выглядит очень ненадежно (+ скорее всего они формируются динамически, рандомно)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
private final SelenideElement archiveButtonSubmit = $x("//button[text()='Archive']"); | ||
private final SelenideElement unarchiveButtonSubmit = $x("//button[text()='Unarchive']"); | ||
private final ElementsCollection categoryList = $$(".MuiChip-root"); | ||
private final SelenideElement successArchiveMessage = $x("//div[@class='MuiAlert-message css-1xsto0d']"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опять же класс css-1xsto0d лучше не использовать
Можно просто $("div.MuiAlert-message")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил
nameInput.clear(); | ||
nameInput.setValue(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перед setValue() clear() делать не обязательно
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил
for (int i = 0; i < categoryList.size(); i++) { | ||
// Проверяем, содержит ли элемент текст категории | ||
if (categoryList.get(i).text().equals(categoryName)) { | ||
// Находим кнопку "Архивировать" внутри той же строки с названием категории | ||
SelenideElement archiveButtonInRow = categoryList.get(i).parent().$(".MuiIconButton-sizeMedium[aria-label='Archive category']"); | ||
// Кликаем по кнопке архивирования | ||
archiveButtonInRow.click(); | ||
break; | ||
} | ||
} | ||
return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как правило, писать собственные циклы в page-object классах нам не нужно
За нас все давно уже реализовано. Например, здесь можно воспользоваться filter от Selenide
categoryList.findBy(text(categoryName)) - далее находим кнопку и тыкаем
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил
// Проходим по списку категорий | ||
for (int i = 0; i < categoryList.size(); i++) { | ||
// Проверяем, содержит ли элемент текст имени категории | ||
if (categoryList.get(i).text().equals(categoryName)) { | ||
// Находим кнопку "Разархивировать" внутри той же строки с названием категории | ||
SelenideElement unarchiveButtonInRow = categoryList.get(i).parent().$("[data-testid='UnarchiveOutlinedIcon']"); | ||
// Кликаем по кнопке разархивирования | ||
unarchiveButtonInRow.click(); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил
fix got hw3.1