From a53a2d89a99df524fbd703bb223bc35fbe0720f0 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Fri, 19 Apr 2024 13:43:55 -0500 Subject: [PATCH] #5361 Fix locators --- .../com/pages/DatePickersMonthPage.java | 17 +++++----- .../tests/complex/DatePickersMonthTests.java | 32 +++++++++++-------- .../elements/complex/DatePickerMonth.java | 3 +- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/jdi-light-vuetify-tests/src/main/java/io/github/com/pages/DatePickersMonthPage.java b/jdi-light-vuetify-tests/src/main/java/io/github/com/pages/DatePickersMonthPage.java index f9e32d6848..95a13b16f2 100644 --- a/jdi-light-vuetify-tests/src/main/java/io/github/com/pages/DatePickersMonthPage.java +++ b/jdi-light-vuetify-tests/src/main/java/io/github/com/pages/DatePickersMonthPage.java @@ -8,29 +8,28 @@ public class DatePickersMonthPage extends VuetifyPage { - // @todo #5298 Locators should use .v-picker class for DatePickerMonth @JDatePickerMonth( - root = "#AllowedMonthPicker > div") + root = "#AllowedMonthPicker > .v-picker--date") public static DatePickerMonth allowedMonthPicker; @JDatePickerMonth( - root = "#ColorsMonthPicker > div:nth-child(1)") + root = "#ColorsMonthPicker > .v-picker--date") public static DatePickerMonth firstColorMonthPicker; @JDatePickerMonth( - root = "#IconsMonthPicker > div") + root = "#IconsMonthPicker > .v-picker--date") public static DatePickerMonth iconsMonthPicker; @JDatePickerMonth( - root = "#MultipleMonthPicker > div") + root = "#MultipleMonthPicker > .v-picker--date") public static DatePickerMonth multipleMonthPicker; @JDatePickerMonth( - root = "#ReadonlyMonthPicker > div") + root = "#ReadonlyMonthPicker > .v-picker--date") public static DatePickerMonth readonlyMonthPicker; @JDatePickerMonth( - root = "#WidthMonthPicker > div:nth-child(1)") + root = "#WidthMonthPicker > .v-picker--date") public static DatePickerMonth firstWidthMonthPicker; @JDatePickerMonth( @@ -44,7 +43,7 @@ public class DatePickersMonthPage extends VuetifyPage { public static DatePickerMonth pickerInDialogMonthPicker; @JDatePickerMonth( - root = "#InternationalizationMonthPicker > div:nth-child(1)") + root = "#InternationalizationMonthPicker > .v-picker--date") public static DatePickerMonth thaiMonthPicker; @JDatePickerMonth( @@ -55,7 +54,7 @@ public class DatePickersMonthPage extends VuetifyPage { root = "#OrientationMonthPicker > .v-picker") public static DatePickerMonth orientationMonthPicker; - @UI("#OrientationMonthPicker > .v-input") + @UI("#OrientationMonthPicker > .v-input--checkbox") public static VueCheckbox orientationSwitcher; @UI(".v-menu__content .v-picker__actions .v-btn:last-child") diff --git a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/DatePickersMonthTests.java b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/DatePickersMonthTests.java index 90d1094137..59dd5b4eee 100644 --- a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/DatePickersMonthTests.java +++ b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/DatePickersMonthTests.java @@ -38,8 +38,9 @@ import static org.hamcrest.Matchers.is; public class DatePickersMonthTests extends TestsInit { - private LocalDate date = LocalDate.now(); - private DateTimeFormatter formatterYearHyphenMonth = DateTimeFormatter.ofPattern("YYYY-MM"); + private final LocalDate date = LocalDate.now(); + private final DateTimeFormatter formatterYearHyphenMonth = + DateTimeFormatter.ofPattern("YYYY-MM"); private static final String NEXT_YEAR_ICON_CLASS = "mdi-skip-next"; private static final String PREVIOUS_YEAR_ICON_CLASS = "mdi-skip-previous"; @@ -49,26 +50,31 @@ public class DatePickersMonthTests extends TestsInit { private static final String SELECTION_TEXT = " selected"; private static final int WIDTH_OF_PREDEFINED_WIDTH_DP = 290; private static final int HEIGHT = 378; - private static final List CHECKED_MULTIPLE_MONTHS = Arrays.asList("Jan", "Apr", "Aug", "Oct", "Dec"); - private static final List THAI_SHORT_MONTHS = Arrays.asList("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", + private static final List CHECKED_MULTIPLE_MONTHS = + Arrays.asList("Jan", "Apr", "Aug", "Oct", "Dec"); + private static final List THAI_SHORT_MONTHS = + Arrays.asList("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."); - private static final List THAI_FULL_MONTHS = Arrays.asList("มกราคม", "กุมภาพันธ์", "มีนาคม", + private static final List THAI_FULL_MONTHS = + Arrays.asList("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"); - private static final List SWEDISH_SHORT_MONTHS = Arrays.asList("Jan.", "Feb.", "Mars", "Apr.", + private static final List SWEDISH_SHORT_MONTHS = + Arrays.asList("Jan.", "Feb.", "Mars", "Apr.", "Maj", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dec."); - private static final List SWEDISH_FULL_MONTHS = Arrays.asList("januari", "februari", "mars", + private static final List SWEDISH_FULL_MONTHS = + Arrays.asList("januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"); - private int currentYear = Year.now().getValue(); + private final int currentYear = Year.now().getValue(); - private String currentMonthFull = date.getMonth().toString().charAt(0) + private final String currentMonthFull = date.getMonth().toString().charAt(0) + date.getMonth().toString().substring(1).toLowerCase(); - private String chosenMonthFull = date.minusMonths(1).getMonth().toString().charAt(0) + private final String chosenMonthFull = date.minusMonths(1).getMonth().toString().charAt(0) + date.minusMonths(1).getMonth().toString().substring(1).toLowerCase(); - private String chosenMonthTwoFull = date.plusMonths(1).getMonth().toString().charAt(0) + private final String chosenMonthTwoFull = date.plusMonths(1).getMonth().toString().charAt(0) + date.plusMonths(1).getMonth().toString().substring(1).toLowerCase(); - private String chosenMonth = chosenMonthFull.substring(0, 3); - private String chosenMonthTwo = chosenMonthTwoFull.substring(0, 3); + private final String chosenMonth = chosenMonthFull.substring(0, 3); + private final String chosenMonthTwo = chosenMonthTwoFull.substring(0, 3); @BeforeClass public void beforeTest() { diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/complex/DatePickerMonth.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/complex/DatePickerMonth.java index b844bc7c11..1370c853e6 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/complex/DatePickerMonth.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/complex/DatePickerMonth.java @@ -23,7 +23,8 @@ /** * To see an example of Date pickers - month please visit https://v2.vuetifyjs.com/en/components/date-pickers-month/ */ - +// @todo #5361 expandedRootLocator should be removed from this class, +// input with date value is a different component, not this one public class DatePickerMonth extends UIBaseElement implements ISetup, HasMeasurement, HasColor, HasTheme, HasElevation { private String root;