Skip to content

Commit

Permalink
#5446 fix locators
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Apr 30, 2024
1 parent 6a15de5 commit 7fb4b36
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,13 @@ public void expandableDatePicker() {
pickerInMenuDatePicker.changeMonth();
pickerInMenuDatePicker.selectMonth(CHOSEN_MONTH);
//pickerInMenuDatePicker.has().month(CHOSEN_MONTH);
pickerInMenuDatePicker.changeMonth();
waitCondition(() -> pickerDateDatePicker.getChangeYearButton().isVisible());
pickerInMenuDatePicker.has().visibleChangeYearButton();
pickerInMenuDatePicker.changeYear();
pickerInMenuDatePicker.selectYear(Integer.toString(currentYear + 99));
pickerInMenuDatePicker.has().year(Integer.toString(currentYear + 99));
pickerInMenuDatePicker.has().visibleChangeYearButton();
//pickerInMenuDatePicker.changeMonth();
// @todo #5446 Change logic to search existed button to change month and year
//pickerInMenuDatePicker.has().visibleChangeYearButton();
//pickerInMenuDatePicker.changeYear();
//pickerInMenuDatePicker.selectYear(Integer.toString(currentYear + 99));
//pickerInMenuDatePicker.has().year(Integer.toString(currentYear + 99));
//pickerInMenuDatePicker.has().visibleChangeYearButton();
buttonOkMenu.click();
pickerInMenuDatePicker.expand();
pickerInMenuDatePicker.has().mainDateFieldIsNotExist();
Expand Down Expand Up @@ -374,10 +374,11 @@ public void testSwedenDatePicker() {
swedishDatePicker.has().year(CHOSEN_YEAR);
swedishDatePicker.selectMonth(CHOSEN_MONTH_SWEDISH);
List<String> shownSwedishDaysOfWeek = new ArrayList<>();
Pattern swedishDayOfWeekPattern = Pattern.compile("^[a-zwåäöÅÄÖ]+");
for (int i = CHOSEN_DAY; i < (CHOSEN_DAY + 7); i++) {
swedishDatePicker.clickDay(Integer.toString(i));
swedishDatePicker.has().activeDate(Integer.toString(i));
//swedishDatePicker.has().dayOfMonth(Integer.toString(i), new Locale("sv", "SE"));
Pattern swedishDayOfWeekPattern = Pattern.compile("^[a-zwåäöÅÄÖ]+");
Matcher matcher = swedishDayOfWeekPattern.matcher(swedishDatePicker.getDate());
while (matcher.find()) {
shownSwedishDaysOfWeek.add(matcher.group());
Expand Down Expand Up @@ -407,15 +408,16 @@ public void testChineseDatePicker() {
chineseDatePicker.has().visibleChangeYearButton();
chineseDatePicker.changeYear();
chineseDatePicker.selectYear(CHOSEN_YEAR);
chineseDatePicker.has().year(CHOSEN_YEAR);
chineseDatePicker.has().year(Matchers.startsWith(CHOSEN_YEAR));
chineseDatePicker.selectMonth(CHOSEN_MONTH_CHINESE);
//chineseDatePicker.has().month(CHOSEN_MONTH_CHINESE, Locale.CHINESE);
List<String> shownChineseDaysOfWeek = new ArrayList<>();
Pattern chineseDayOfWeekPattern = Pattern.compile(
"([\\d]+)([\\u4E00-\\u9FA5]+)(\\d+)([\\u4E00-\\u9FA5]+)");
for (int i = CHOSEN_DAY; i < (CHOSEN_DAY + 7); i++) {
chineseDatePicker.clickDay(Integer.toString(i));
//chineseDatePicker.has().dayOfMonth(Integer.toString(i), Locale.CHINESE);
Pattern chineseDayOfWeekPattern = Pattern.compile(
"([\\d]+)([\\u4E00-\\u9FA5]+)(\\d+)([\\u4E00-\\u9FA5]+)");
chineseDatePicker.has().activeDate(Matchers.startsWith(Integer.toString(i)));
Matcher matcher = chineseDayOfWeekPattern.matcher(chineseDatePicker.getDate());
while (matcher.find()) {
shownChineseDaysOfWeek.add(matcher.group(4));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ public DatePickerAssert year(Matcher<String> matcher) {
return this;
}

@JDIAction(value = "Assert that '{name}' active day has value '{0}'", isAssert = true)
public DatePickerAssert activeDate(String date) {
jdiAssert(element().getActiveDayOfMonth(), Matchers.is(date));
return this;
}

@JDIAction(value = "Assert that '{name}' active day has value '{0}'", isAssert = true)
public DatePickerAssert activeDate(Matcher<String> matcher) {
jdiAssert(element().getActiveDayOfMonth(), matcher);
return this;
}

@JDIAction(value = "Assert that '{name}' field color is '{0}'", isAssert = true)
public DatePickerAssert color(String color) {
jdiAssert(element().color(), Matchers.is(color));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void toPreviousMonth() {
@JDIAction("Click on '{name}' day of month")
public void clickDay(final String date) {
getDay(date).click();
waitFor(1);
waitFor(2);
}

@JDIAction("Get '{name}' shown month and year")
Expand Down

0 comments on commit 7fb4b36

Please sign in to comment.