List of usage examples for org.openqa.selenium Keys ENTER
Keys ENTER
To view the source code for org.openqa.selenium Keys ENTER.
Click Source Link
From source file:org.richfaces.showcase.functions.ITestFunctions.java
License:Open Source License
@Test public void testFunctionFindComponentCall() { String testString = "test string"; waitModel().until().element(page.getInput()).is().visible(); page.getInput().sendKeys(testString); page.getInput().sendKeys(Keys.ENTER); waitModel().until("The output should be test string").element(page.getOutput()).text().equalTo(testString); }
From source file:org.richfaces.tests.metamer.ftest.abstractions.DataTableFilteringTest.java
License:Open Source License
public void testFilterNameBuiltInAppliesAfterEnterPressed() { for (String filterName : FILTER_NAMES) { getTable().getHeader().getNameBuiltInInput().clear().sendKeys(filterName); Graphene.guardAjax(keyboard).pressKey(Keys.ENTER); getFilteredEmployeeModel().setName(filterName); verifyFiltering();/*from w ww .ja va 2s . com*/ } }
From source file:org.richfaces.tests.metamer.ftest.richAutocomplete.TestAutocompleteJSApi.java
License:Open Source License
@Test public void testFocus() { focus.click();/*from w ww .j a v a2s . c o m*/ Graphene.guardAjax(keyboard).sendKeys("ala"); autocomplete.advanced().waitForSuggestionsToBeVisible().perform(); keyboard.sendKeys(Keys.ARROW_DOWN); Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); checkOutput("Alabama"); blur(WaitRequestType.XHR);// prevent ViewExpiredException }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testClean() { // set some date, so we can clean it setReferenceDate_openPopup_check();/* w ww.j a v a2s . co m*/ assertCalendarInputEqualsTo("Jan 1, 2012 12:00"); // invoke clean key keyboard.sendKeys(CLEAN_KEY); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); // the input should be empty assertCalendarInputEqualsTo(""); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testScrollingDaysAndWeeks() { PopupCalendar calendarPopup = setReferenceDate_openPopup_check(); // verify days scrolling keyboard.sendKeys(PREVIOUS_DAY_KEY); assertHighlightedDay(calendarPopup, 31); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusDays(1)); keyboard.sendKeys(PREVIOUS_DAY_KEY); assertHighlightedDay(calendarPopup, 30); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusDays(2)); keyboard.sendKeys(NEXT_DAY_KEY);//from ww w . jav a 2 s . c om assertHighlightedDay(calendarPopup, 31); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusDays(1)); keyboard.sendKeys(NEXT_DAY_KEY); assertHighlightedDay(calendarPopup, 1); assertYearAndMonth(calendarPopup, firstOfJanuary2012); keyboard.sendKeys(NEXT_DAY_KEY); assertHighlightedDay(calendarPopup, 2); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusDays(1)); // verify weeks scrolling keyboard.sendKeys(NEXT_WEEK_KEY); assertHighlightedDay(calendarPopup, 9); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(1)); keyboard.sendKeys(NEXT_WEEK_KEY); assertHighlightedDay(calendarPopup, 16); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(2)); keyboard.sendKeys(NEXT_WEEK_KEY); assertHighlightedDay(calendarPopup, 23); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(3)); keyboard.sendKeys(NEXT_WEEK_KEY); assertHighlightedDay(calendarPopup, 30); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(4)); keyboard.sendKeys(NEXT_WEEK_KEY); assertHighlightedDay(calendarPopup, 6); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(5)); keyboard.sendKeys(PREVIOUS_WEEK_KEY); assertHighlightedDay(calendarPopup, 30); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(4)); keyboard.sendKeys(PREVIOUS_WEEK_KEY); assertHighlightedDay(calendarPopup, 23); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusWeeks(3)); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); assertCalendarInputEqualsTo("Jan 23, 2012 12:00"); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testScrollingMonths() { PopupCalendar calendarPopup = setReferenceDate_openPopup_check(); // verify months scrolling keyboard.sendKeys(PREVIOUS_MONTH_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusMonths(1)); keyboard.sendKeys(PREVIOUS_MONTH_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusMonths(2)); keyboard.sendKeys(NEXT_MONTH_KEY);//from w w w . j a v a2s . c o m assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusMonths(1)); keyboard.sendKeys(NEXT_MONTH_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012); keyboard.sendKeys(NEXT_MONTH_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusMonths(1)); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); assertCalendarInputEqualsTo("Feb 1, 2012 12:00"); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testScrollingYears() { PopupCalendar calendarPopup = setReferenceDate_openPopup_check(); // verify years scrolling keyboard.sendKeys(NEXT_YEAR_KEY);//w w w . j a va 2 s . co m assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusYears(1)); keyboard.sendKeys(NEXT_YEAR_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusYears(2)); keyboard.sendKeys(PREVIOUS_YEAR_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.plusYears(1)); keyboard.sendKeys(PREVIOUS_YEAR_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012); keyboard.sendKeys(PREVIOUS_YEAR_KEY); assertYearAndMonth(calendarPopup, firstOfJanuary2012.minusYears(1)); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); assertCalendarInputEqualsTo("Jan 1, 2011 12:00"); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testTimeEditor() { String datePattern = "dd/M/yy hh:mm:ss a"; calendarAttributes.set(CalendarAttributes.datePattern, datePattern); PopupCalendar calendarPopup = setReferenceDate_openPopup_check(); assertCalendarInputEqualsTo("01/1/12 12:00:00 PM"); keyboard.sendKeys(OPEN_TIME_EDITOR_KEY); TimeEditor timeEditor = calendarPopup.getFooterControls().getTimeEditor(); timeEditor.waitUntilIsVisible().perform(); // increase hours by 2 keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); // switch to minutes keyboard.sendKeys(Keys.TAB);/*from ww w . j a v a 2 s.c o m*/ // decrease minutes by 3 keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY); keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY); keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY); // switch to seconds keyboard.sendKeys(Keys.TAB); // increase seconds by 1 keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); // switch to time sign keyboard.sendKeys(Keys.TAB); // change time sign keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); // switch to hours again keyboard.sendKeys(Keys.TAB); // increase hours by 1 keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); // switch to minutes again keyboard.sendKeys(Keys.TAB); // switch to seconds again keyboard.sendKeys(Keys.TAB); // increase seconds by 1 keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY); // confirm keyboard.sendKeys(Keys.ENTER); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); assertCalendarInputEqualsTo("01/1/12 03:57:02 AM"); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java
License:Open Source License
@Test public void testToday() { setReferenceDate_openPopup_check();//from ww w . ja v a 2 s . co m keyboard.sendKeys(TODAY_KEY); assertHighlightedDay(popupCalendar.openPopup(), todayMidday.getDayOfMonth()); // apply Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER); assertCalendarInputEqualsTo(todayMidday .toString(DateTimeFormat.forPattern(calendarAttributes.get(CalendarAttributes.datePattern)))); }
From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarModel.java
License:Open Source License
@Test @IssueTracking("https://issues.jboss.org/browse/RF-14199") public void testDisabledDayCannotBePickedByKeyboard() { DateTime referenceDate = new DateTime().withYear(2015).withMonthOfYear(11).withDayOfMonth(2) .withHourOfDay(12).withMinuteOfHour(0); // set reference date Graphene.guardAjax(popupCalendar).setDateTime(referenceDate); performStabilizationWorkaround();/*w ww.j a v a 2 s.c o m*/ popupCalendar.openPopup(); checkSelectedDate(referenceDate); // try to select tuesday (disabled) keyboard.sendKeys(Keys.ARROW_RIGHT); keyboard.sendKeys(Keys.ENTER); assertTrue(popupCalendar.getPopup().isVisible()); // check date is still the same (no move through enabled and already not selected days) checkSelectedDate(referenceDate); // try to select sunday (disabled) keyboard.sendKeys(Keys.ARROW_LEFT); keyboard.sendKeys(Keys.ARROW_LEFT); keyboard.sendKeys(Keys.ENTER); assertTrue(popupCalendar.getPopup().isVisible()); // check date is still the same (no move through enabled and already not selected days) checkSelectedDate(referenceDate); // try to select saturday from previous month (disabled) Graphene.guardAjax(keyboard).sendKeys(Keys.ARROW_LEFT);// move to previous month will trigger an ajax request keyboard.sendKeys(Keys.ENTER); assertTrue(popupCalendar.getPopup().isVisible()); // check date is still the same (no move through enabled and already not selected days) checkSelectedDate(referenceDate); // try to select thursday from previous year (disabled) Graphene.guardAjax(keyboard).sendKeys(Keys.chord(Keys.SHIFT, Keys.PAGE_UP));// move to previous year will trigger an ajax request keyboard.sendKeys(Keys.ARROW_LEFT); keyboard.sendKeys(Keys.ENTER); assertTrue(popupCalendar.getPopup().isVisible()); // check selected date has changed (day moved to friday when the year was switched) // 2x to the left and 1x to previous year referenceDate = referenceDate.minusDays(2).minusYears(1); checkSelectedDate(referenceDate); // finally, select wednesday (enabled) Graphene.guardAjax(keyboard).sendKeys(Keys.ARROW_LEFT); keyboard.sendKeys(Keys.ENTER); popupCalendar.getPopup().waitUntilIsNotVisible().perform(); referenceDate = referenceDate.withYear(2014).withMonthOfYear(10).withDayOfMonth(29); checkSelectedDate(referenceDate); }