diff --git a/test/tests/spinbutton_datepicker.js b/test/tests/spinbutton_datepicker.js index 4d0caa48d4..a54fe2408c 100644 --- a/test/tests/spinbutton_datepicker.js +++ b/test/tests/spinbutton_datepicker.js @@ -370,17 +370,23 @@ ariaTest( exampleFile, 'spinbutton-down-arrow', async (t) => { - let control = parseInt(ex.dayNow); - let daysInMonth = parseInt(ex.dayMax); + let control = 31; + + // Set to December for a 31 day month + let monthSpinner = await t.context.session.findElement( + By.css(ex.monthSelector) + ); + await monthSpinner.sendKeys(Key.END); // Send down arrow to day date spinner let daySpinner = await t.context.session.findElement( By.css(ex.daySelector) ); - await daySpinner.sendKeys(Key.ARROW_DOWN); - // Subtract a day to the control - control = (control - 1) % daysInMonth; + // Set to first of month + await daySpinner.sendKeys(Key.HOME); + + await daySpinner.sendKeys(Key.ARROW_DOWN); t.is( parseInt(await daySpinner.getText()), @@ -395,7 +401,7 @@ ariaTest( } // Subtract 30 days to the control - control = daysInMonth + ((control - 30) % daysInMonth); + control -= 30; t.is( parseInt(await daySpinner.getText()),