test(core): fix selectMonthFromMonthPicker logic (#5498)

This commit is contained in:
Peng Xiao
2024-01-02 14:21:14 +00:00
parent 53c76ae2e2
commit 922bc11f16

View File

@@ -148,10 +148,10 @@ export const selectMonthFromMonthPicker = async (page: Page, date: Date) => {
.getByTestId('month-picker-current-year') .getByTestId('month-picker-current-year')
.innerText()); .innerText());
if (selectedYear > year) { if (selectedYear > year) {
page.locator('[data-testid="month-picker-prev-button"]').click(); await page.locator('[data-testid="month-picker-prev-button"]').click();
return await selectMonth(); return await selectMonth();
} else if (selectedYear < year) { } else if (selectedYear < year) {
page.locator('[data-testid="month-picker-next-button"]').click(); await page.locator('[data-testid="month-picker-next-button"]').click();
return await selectMonth(); return await selectMonth();
} }
// Click on the day cell // Click on the day cell