-
Notifications
You must be signed in to change notification settings - Fork 47
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
5378 Fix failing tests for Snackbar #5379
base: angular_rework_development
Are you sure you want to change the base?
Conversation
snackbarSection.durationInput.setValue(String.valueOf(DURATION)); | ||
snackbarSection.customSnackbarOpenButton.click(); | ||
snackBarPage.durationInput.setValue(String.valueOf(DURATION)); | ||
snackBarPage.customSnackbarOpenButton.click(); | ||
|
||
//duration(DURATION, 1000, action); |
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.
Сделано
@@ -11,7 +11,7 @@ | |||
|
|||
public class Snackbar extends UIBaseElement<SnackbarAssert> { | |||
protected UIElement message; | |||
protected String messageLocator = "./span"; | |||
protected String messageLocator = "//*[@matsnackbarlabel]"; | |||
|
|||
protected UIElement action; |
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.
это кнопка, а не UIElement
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.
Заменил protected UIElement action
на public Button action;
Модификатор доступа изменил на public
так как action
после правок используется в SnackbarTests
jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java
Outdated
Show resolved
Hide resolved
@@ -26,7 +26,7 @@ public Snackbar() { | |||
|
|||
@JDIAction("Get '{name}' message") | |||
public String getMessageText() { | |||
return message.getValue(); | |||
return message.getText(); | |||
} | |||
|
|||
@JDIAction("Get '{name}' action") |
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.
Переименовал getMessageText()
в messageText()
и getActionText()
в actionText()
...angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/SnackbarTests.java
Outdated
Show resolved
Hide resolved
|
||
snackbarSection.basicSnackbar.has().action(); | ||
snackBarPage.basicSnackbar.has().action(); |
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.
тест про NO ACTION TEST
но в валидации проверяем, что action есть - не логично
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.
Переименовал. Теперь эта строчка выглядит так snackBarPage.basicSnackbar.has().noAction();
…ments/complex/Snackbar.java Co-authored-by: Natalia Pozhidaeva <[email protected]>
…ests/elements/complex/SnackbarTests.java Co-authored-by: Natalia Pozhidaeva <[email protected]>
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.
ревью компонента еще раз нужно сделать
protected UIElement action; | ||
protected String actionLocator = ".//button"; | ||
public Button action; | ||
protected String actionLocator = "//button"; |
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.
Вернул назад
|
||
/** | ||
* To see an example of Snackbar web element please visit https://material.angular.io/components/snack-bar/overview. | ||
*/ | ||
|
||
public class Snackbar extends UIBaseElement<SnackbarAssert> { | ||
protected UIElement message; | ||
protected String messageLocator = "./span"; | ||
protected String messageLocator = "//*[@matsnackbarlabel]"; |
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.
стиль mdc-snackbar__label гораздо более понятнее смотрится
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.
Пофиксил. Теперь так protected String messageLocator = ".mdc-snackbar__label";
protected UIElement action; | ||
protected String actionLocator = ".//button"; | ||
public Button action; | ||
protected String actionLocator = "//button"; | ||
|
||
public Snackbar() { | ||
message = new UIElement(); |
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.
После введения проверок из элемента Button
кнопка action
теперь используется в тестах (сейчас кнопка переименована в actionButton
). Если я правильно понял вопрос.
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.
вопрос был зачем это делать в конструкторе, а не так же, как это сделано в остальных элементах
jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@JDIAction("Get '{name}' action") | ||
public String getActionText() { | ||
public String actionText() { |
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.
Выполнено. Теперь во всех тестах SnackbarTests
используются валидаторы из Button
@igor-korost если работа закончена, то надо перезапрашивать ревью, мысли еще никто читать не научился |
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.
а почему PR называется исправление падающих тестов?
protected UIElement action; | ||
protected String actionLocator = ".//button"; | ||
public Button action; | ||
protected String actionLocator = "//button"; | ||
|
||
public Snackbar() { | ||
message = new UIElement(); |
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.
вопрос был зачем это делать в конструкторе, а не так же, как это сделано в остальных элементах
protected String actionLocator = ".//button"; | ||
|
||
public Snackbar() { | ||
message = new UIElement(); | ||
message.core().setLocator(messageLocator); | ||
|
||
action = new UIElement(); | ||
action.core().setLocator(actionLocator); | ||
actionButton = new Button(); |
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.
У элементов snackbar
при нормальном проектировании может быть только 1 кнопка или не быть её вообще. Так как это исчезающий элемент и можно не успеть отреагировать. 💁 Вот тут подробнее написано https://stackoverflow.com/questions/67642607/reactmaterial-ui-multiple-snackbar
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.
Конструктор убрал из Snackbar.java
✅
@@ -4,44 +4,30 @@ | |||
import com.epam.jdi.light.common.JDIAction; | |||
import com.epam.jdi.light.elements.base.UIBaseElement; | |||
import com.epam.jdi.light.elements.common.UIElement; | |||
import com.epam.jdi.light.ui.html.elements.common.Button; | |||
|
|||
/** | |||
* To see an example of Snackbar web element please visit https://material.angular.io/components/snack-bar/overview. | |||
*/ | |||
|
|||
public class Snackbar extends UIBaseElement<SnackbarAssert> { | |||
protected UIElement 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.
если message это элемент с текстом, то это должен быть не UIElement
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.
Заменил на public String messageText()
, конструктор убрал вообще
@@ -11,19 +11,7 @@ public class SnackbarAssert extends UIAssert<SnackbarAssert, Snackbar> { | |||
|
|||
@JDIAction(value = "Assert that '{name}' has message '{0}'", isAssert = true) | |||
public SnackbarAssert message(String expected) { |
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.
Заменил на Matchers.containsString(expected)
… 5378_fix_snackbar_tests
Название не вполне верное. Скорее это рефакторинг и исправление. Цель этого PR сдать уже сделанную работу поскольку я ухожу с проекта. |
This reverts commit 3058d29.
No description provided.