Skip to content

Commit

Permalink
Merge pull request #5478 from jdi-testing/5361
Browse files Browse the repository at this point in the history
#5361 Fix locators Date month pickers
  • Loading branch information
pnatashap authored Apr 21, 2024
2 parents c109bb3 + a53a2d8 commit ee02db7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<String> CHECKED_MULTIPLE_MONTHS = Arrays.asList("Jan", "Apr", "Aug", "Oct", "Dec");
private static final List<String> THAI_SHORT_MONTHS = Arrays.asList("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.",
private static final List<String> CHECKED_MULTIPLE_MONTHS =
Arrays.asList("Jan", "Apr", "Aug", "Oct", "Dec");
private static final List<String> THAI_SHORT_MONTHS =
Arrays.asList("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.",
"พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
private static final List<String> THAI_FULL_MONTHS = Arrays.asList("มกราคม", "กุมภาพันธ์", "มีนาคม",
private static final List<String> THAI_FULL_MONTHS =
Arrays.asList("มกราคม", "กุมภาพันธ์", "มีนาคม",
"เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
private static final List<String> SWEDISH_SHORT_MONTHS = Arrays.asList("Jan.", "Feb.", "Mars", "Apr.",
private static final List<String> SWEDISH_SHORT_MONTHS =
Arrays.asList("Jan.", "Feb.", "Mars", "Apr.",
"Maj", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dec.");
private static final List<String> SWEDISH_FULL_MONTHS = Arrays.asList("januari", "februari", "mars",
private static final List<String> 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DatePickerMonthAssert> implements ISetup, HasMeasurement, HasColor,
HasTheme, HasElevation {
private String root;
Expand Down

0 comments on commit ee02db7

Please sign in to comment.