summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2014-08-12 13:19:54 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-15 13:32:19 +0000
commit50a879e52e56d3acb3b8b8e77c2a86753e0c0385 (patch)
tree67734c90aee0dddc728af741d211af1acd67694b /uitest
parent56c98c7bf18a2aa2b5e86db0f46b1cdb3f900822 (diff)
downloadvaadin-framework-50a879e52e56d3acb3b8b8e77c2a86753e0c0385.tar.gz
vaadin-framework-50a879e52e56d3acb3b8b8e77c2a86753e0c0385.zip
PopupDateFieldExtendedRange test upgrade (#14292)
Change-Id: I62f3f17cfbd5ddb5e1cd1b6085f4437fa49cfad1
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html136
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java510
3 files changed, 517 insertions, 142 deletions
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html
deleted file mode 100644
index 2783ed2aa3..0000000000
--- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>PopupDateFieldExtendedRange</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">PopupDateFieldExtendedRange</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldExtendedRange?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
- <td>7,16</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-01-2011</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]#prevmon</td>
- <td>8,7</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-12-2010</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]#prevy</td>
- <td>12,6</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-12-2009</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
- <td>10,13</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td>
- <td>14,13</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-02-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-03-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-02-2010-again</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td>
- <td>7,16</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td>
- <td>17,10</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>shift left</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup3-01-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>shift down</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup3-01-2009</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td>
- <td>10,8</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
index a12bdfa44c..2608e6e081 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
@@ -3,20 +3,21 @@ package com.vaadin.tests.components.datefield;
import java.util.Calendar;
import java.util.Locale;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.DateField;
import com.vaadin.ui.PopupDateField;
@SuppressWarnings("serial")
-public class PopupDateFieldExtendedRange extends TestBase {
+public class PopupDateFieldExtendedRange extends AbstractTestUI {
private Calendar date = Calendar.getInstance();
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
date.set(2011, 0, 1);
getLayout().setSpacing(true);
@@ -52,7 +53,7 @@ public class PopupDateFieldExtendedRange extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Show a few days of the preceding and following months in the datefield popup";
}
@@ -63,7 +64,7 @@ public class PopupDateFieldExtendedRange extends TestBase {
private PopupDateField makeDateField() {
PopupDateField pdf = new PopupDateField();
- pdf.setResolution(DateField.RESOLUTION_DAY);
+ pdf.setResolution(Resolution.DAY);
pdf.setValue(date.getTime());
return pdf;
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java
new file mode 100644
index 0000000000..6d22048d32
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java
@@ -0,0 +1,510 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.datefield;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.DateFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests contents and functionality of PopupDateField's popup.
+ *
+ * @author Vaadin Ltd
+ */
+public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest {
+
+ @Override
+ @Before
+ public void setup() throws Exception {
+ super.setup();
+ openTestURL();
+ }
+
+ @Test
+ public void testFirstDateField() {
+ List<DateFieldElement> dateFields = $(DateFieldElement.class).all();
+ assertEquals("unexpected amount of datefields", 3, dateFields.size());
+
+ DateFieldElement dateField = dateFields.get(0);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2011",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "MA", weekdays.get(0)
+ .getText());
+ assertEquals(
+ "unexpected weeknumber count",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-weeknumber"))
+ .size());
+ assertEquals(
+ "unexpected selection",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "27", days.get(0).getText());
+ assertEquals("unexpected day content", "4", days.get(8).getText());
+ assertEquals("unexpected day content", "21", days.get(25).getText());
+ assertEquals("unexpected day content", "6", days.get(41).getText());
+
+ // move to the previous month
+ popup.findElement(By.className("v-datefield-calendarpanel-prevmonth"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "joulukuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .size());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "29", days.get(0).getText());
+ assertEquals("unexpected day content", "7", days.get(8).getText());
+ assertEquals("unexpected day content", "24", days.get(25).getText());
+ assertEquals("unexpected day content", "9", days.get(41).getText());
+
+ // move to the previous year
+ popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "joulukuu 2009",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ assertEquals(
+ "unexpected focus",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .size());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "30", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "10", days.get(41).getText());
+
+ // close the popup by clicking the button again
+ dateField.findElement(By.tagName("button")).click();
+
+ // TODO: remove this once #14405 has been fixed
+ if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())) {
+ // click something else outside the popup to close it
+ dateField.findElement(By.tagName("input")).click();
+ }
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+ @Test
+ public void testSecondDateField() throws InterruptedException {
+ DateFieldElement dateField = $(DateFieldElement.class).all().get(1);
+ ButtonElement button = $(ButtonElement.class).first();
+
+ // change the date
+ button.click();
+ sleep(100);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "February 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "SUN", weekdays.get(0)
+ .getText());
+ assertEquals(
+ "unexpected weeknumber count",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-weeknumber"))
+ .size());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "31", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "13", days.get(41).getText());
+
+ // navigate down
+ WebElement popupBody = popup.findElement(By
+ .className("v-datefield-calendarpanel"));
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+
+ // ensure the focus changed
+ assertEquals(
+ "unexpected focus",
+ "23",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+
+ // navigate down
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "March 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ assertEquals(
+ "unexpected focus",
+ "2",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "28", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "10", days.get(41).getText());
+
+ // navigate left
+ popupBody = popup
+ .findElement(By.className("v-datefield-calendarpanel"));
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+
+ // ensure the focus changed
+ assertEquals(
+ "unexpected focus",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+
+ // navigate left
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "February 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "28",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "31", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "13", days.get(41).getText());
+
+ // close the popup by clicking the input field
+ dateField.findElement(By.tagName("input")).click();
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+ @Test
+ public void testThirdDateField() throws InterruptedException {
+ DateFieldElement dateField = $(DateFieldElement.class).all().get(2);
+ ButtonElement button = $(ButtonElement.class).first();
+
+ // change the date
+ button.click();
+ sleep(100);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "helmikuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "MA", weekdays.get(0)
+ .getText());
+ List<WebElement> weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "5", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "10", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "1", days.get(0).getText());
+ assertEquals("unexpected day content", "9", days.get(8).getText());
+ assertEquals("unexpected day content", "26", days.get(25).getText());
+ assertEquals("unexpected day content", "14", days.get(41).getText());
+
+ // navigate to previous month
+ WebElement popupBody = popup.findElement(By
+ .className("v-datefield-calendarpanel"));
+ new Actions(driver).keyDown(Keys.SHIFT).perform();
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+ new Actions(driver).keyUp(Keys.SHIFT).perform();
+
+ // TODO: remove this once #14406 has been fixed
+ if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())
+ && !Browser.IE8.getDesiredCapabilities().equals(
+ getDesiredCapabilities())) {
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-prevmonth"))
+ .findElement(By.tagName("button")).click();
+ }
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "53", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "5", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ // TODO: remove this check once #14406 has been fixed -- clicking the
+ // button instead of navigating with arrow keys steals the focus
+ if (getBrowsersExcludingIE().contains(getDesiredCapabilities())
+ || Browser.IE8.getDesiredCapabilities().equals(
+ getDesiredCapabilities())) {
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ }
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "28", days.get(0).getText());
+ assertEquals("unexpected day content", "5", days.get(8).getText());
+ assertEquals("unexpected day content", "22", days.get(25).getText());
+ assertEquals("unexpected day content", "7", days.get(41).getText());
+
+ // navigate to previous year
+ new Actions(driver).keyDown(Keys.SHIFT).perform();
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+ new Actions(driver).keyUp(Keys.SHIFT).perform();
+
+ // TODO: remove this once #14406 has been fixed
+ popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2009",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "1", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "6", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ // TODO: remove this check once #14406 has been fixed -- clicking the
+ // button instead of navigating with arrow keys steals the focus
+ if (false) {
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ }
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "29", days.get(0).getText());
+ assertEquals("unexpected day content", "6", days.get(8).getText());
+ assertEquals("unexpected day content", "23", days.get(25).getText());
+ assertEquals("unexpected day content", "8", days.get(41).getText());
+
+ // close the popup by clicking an unrelated element
+ button.click();
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+}