4935 test refactoring element sidenav#5375
4935 test refactoring element sidenav#5375EvgStep wants to merge 4 commits intoangular_rework_developmentfrom
Conversation
4935_Test-refactoring-element-Sidenav
pnatashap
left a comment
There was a problem hiding this comment.
не поверю, что с описанием самих классов все хорошо и ничего менять не надо
| @@ -28,11 +57,12 @@ public class SideNavTests extends TestsInit { | |||
|
|
|||
| @BeforeMethod(alwaysRun = true) | |||
There was a problem hiding this comment.
| @BeforeMethod(alwaysRun = true) | |
| @BeforeClass(alwaysRun = true) |
| public static Button toggleFixedSideNav; | ||
|
|
||
| @UI("#fixed-position .mat-sidenav-content mat-form-field input[formcontrolname='top']") | ||
| public static UIElement topGap; |
There was a problem hiding this comment.
не должно быть UIElement на странице
|
|
||
| backDropToggle.click(); | ||
| sidenavBackdropDrawer.is().displayed(); | ||
| sidenavBackdropDrawer.has().cssClass("mat-drawer-end"); |
There was a problem hiding this comment.
не нужно проверять наличие css классов, этот функционал прекрасно работает
если класс что-то значит - должен быть в описании класса
|
почему прогон автотестов не запустился, тоже не понятно |
e3e77f3 to
ac9d151
Compare
| } | ||
|
|
||
| @JDIAction("Get '{name}' side nav") | ||
| public UIElement getSideNav() { |
There was a problem hiding this comment.
не понятно: в классе SideNav у нас есть метод, который просит SideNav по какому-то индексу и получает UIElement.
явно нужно переделать
|
|
||
| toggleFixedSideNav.click(); | ||
| fixedPosition.base().timer().wait(() -> fixedPosition.visualValidation(".mat-sidenav-content")); | ||
| fixedPosition.getSideNav().has().attr(STYLE, "top: 100px; bottom: 100px; box-shadow: none; visibility: " + |
There was a problem hiding this comment.
не надо проверять style, это не стабильно и базовый функционал, который проверяется в html пакете
| "100px;"); | ||
|
|
||
| toggleFixedSideNav.click(); | ||
| fixedPosition.base().timer().wait(() -> fixedPosition.visualValidation(".mat-sidenav-content")); |
There was a problem hiding this comment.
очень плохо, что нам нужно использовать классы в тестах, значит, что не сделан метод
| toggleExtraText.click(); | ||
| autoSizeSideNav.getMatDrawer().has().text(containsString("Toggle extra text")); | ||
| autoSizeSideNav.getMatDrawerContent().has().attr(STYLE, "margin-left: 294px;"); | ||
| autoSizeSideNav.getMatDrawerContent().has().attr(STYLE, "margin-left: 303px;"); |
There was a problem hiding this comment.
не надо вообще это проверять, оно еще и на разных разрешениях экранов может поехать
pnatashap
left a comment
There was a problem hiding this comment.
Full component review is required.
Only components from the documentation should be described
| @JDIAction("Get '{name}' side nav by '{0}' position value") | ||
| public SideNav getSideNav(String position) { | ||
| UIElement element = null; | ||
| for (UIElement e : getSideNavItems()) { |
There was a problem hiding this comment.
it is good to know how to implement it via streams
|
|
||
| @JDIAction("Get '{name}' side nav content") | ||
| public UIElement getEvents() { | ||
| return getContent().find(".example-events"); |
There was a problem hiding this comment.
it is obvious that this is a part of example site only.
| } | ||
|
|
||
| @JDIAction("Get '{name}' side nav content") | ||
| public WebList getResponsiveResults() { |
There was a problem hiding this comment.
This method is not generic, there is no p description in component description
There was a problem hiding this comment.
а что именно исправлено?
элемент p не входит в описание sidenav, это просто какое-то содержимое, которое может быть другим, поэтому тут его быть не может
|
|
||
| @JDIAction("Get '{name}' side nav items") | ||
| private WebList getSideNavItems() { | ||
| return this.finds(".mat-sidenav"); |
There was a problem hiding this comment.
How it is possible to have sidenav inside sidenav?
pnatashap
left a comment
There was a problem hiding this comment.
почему так много изменений отмечено исправлеными и никаких изменений нет?
|
|
||
| public String getMode() { | ||
| return mode; | ||
| } |
There was a problem hiding this comment.
обычно еще делают метод получения Enum по строковому значению
| } | ||
|
|
||
| @JDIAction("Get '{name}' side nav content") | ||
| public WebList getResponsiveResults() { |
There was a problem hiding this comment.
а что именно исправлено?
элемент p не входит в описание sidenav, это просто какое-то содержимое, которое может быть другим, поэтому тут его быть не может
| } | ||
|
|
||
| @JDIAction("Get '{name}' side nav content") | ||
| public UIElement getContent() { |
There was a problem hiding this comment.
в интро к проекту есть часть про наименования - там написано, что мы минимизируем количество методов с get***, т.е. пишем их в случае крайней необходимости
|
|
||
| @JDIAction("Get '{name}' side nav by '{0}' position value") | ||
| public SideNav getSideNav(String position) { | ||
| String notFoundMessage = String.format(ATTRIBUTE_NOT_FOUND_MESSAGE, POSITION, position); |
There was a problem hiding this comment.
а зачем собирать строку, которая может и не понадобится?
| private static final String POSITION = "position"; | ||
| private static final String ATTRIBUTE_NOT_FOUND_MESSAGE = "Element with attribute %s %s not found"; | ||
|
|
||
| private Predicate<UIElement> attributeMatches(String attributeName, String attributeValue) { |
There was a problem hiding this comment.
используется в итоге в одном месте, зачем он тут?
| import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; | ||
| import static java.lang.String.format; | ||
|
|
||
| public class SideNaveAssert extends UIAssert<SideNaveAssert, SideNav> implements ITextAssert<SideNaveAssert> { |
There was a problem hiding this comment.
| public class SideNaveAssert extends UIAssert<SideNaveAssert, SideNav> implements ITextAssert<SideNaveAssert> { | |
| public class SideNavAssert extends UIAssert<SideNaveAssert, SideNav> implements ITextAssert<SideNaveAssert> { |
| private static final String LOCATION_ERROR_MESSAGE = "SideNavSection with location %s isn't on the right side"; | ||
|
|
||
| @JDIAction(value = "Assert that '{name}' has section with location '{0}' on the right side", isAssert = true) | ||
| public SideNavContainerAssert sideNavSectionOnTheRight(Point locationOfSection) { |
There was a problem hiding this comment.
зачем нам проверять, что-то по координатам?
|
|
||
| toggleFixedSideNav.click(); | ||
| fixedPosition.base().timer().wait(() -> fixedPosition.visualValidation(".mat-sidenav-content")); | ||
| fixedPosition.getSideNav().has().attr(STYLE, "top: 100px; bottom: 100px; box-shadow: none; visibility: " + |
No description provided.