Date pickers (flatpickr)
flatpickr 4.6, the calendar opens under the field. The calendars sit inside their fields (option static), so a test finds them there.
1. One date
Selected: none
2. Two dates, different years
"From" starts in January 2019 and "To" in June 2027, so the two calendars show different years. A test that changes the year in one of them must not touch the other.
Days between: —
3. Date and time
What to practise
- Choose a date and check the field: the format is
yyyy-MM-dd, with a timeyyyy-MM-dd hh:mm tt(12 hours, AM/PM). - Choose "From" and "To" in years far apart; check both and the number of days between them.
- In VAF the element is the flatpickr wrapper:
#birthday-field .flatpickr-wrapper.
In VAF: AsDateTimeFlatpickerV4() — guide, section 2.
Tested in VAF-Demo
A test of this page from VAF-Demo, written with shared steps: the test says what the user does, the steps hold the VAF chains.
[Test]
public void FromAndToInDifferentYears()
{
var from = new DateTime(2018, 3, 15);
var to = new DateTime(2028, 11, 20);
DatePickersSteps.LetsChooseTheDates(from, to);
DatePickersSteps.LetsCheckTheDates(from, to);
}
On GitHub (opens in a new tab)
-
Page object
—
DatePickersPage.cs: the locators of this page -
Native tests
—
DatePickersTests.cs: the whole VAF chain in each test -
Shared steps
—
DatePickersSteps.cs: the steps the test above calls -
Shared steps tests
—
DatePickersStepsTests.cs: the tests of this page written with steps - The whole project and its README Latest test run (GitHub Actions)