Skip to content
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

#5361 Fix locators Date month pickers #5478

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading