Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Calendar undo suite: tell the week by its first day, not the month in the title

Yashwanth Kamireddi41b96223aee5
diff --git a/.uiverify/calendar-undo.mjs b/.uiverify/calendar-undo.mjs
index 24cf47b..7274a14 100644
--- a/.uiverify/calendar-undo.mjs
+++ b/.uiverify/calendar-undo.mjs
@@ -31,12 +31,15 @@ const midnightIn = (n) => page.evaluate((n) => { const d = new Date(); d.setHour
const scroller = page.locator(".cx-scroll");
await scroller.evaluate((el) => { el.scrollTop = 18 * 48; });
const before = await scroller.evaluate((el) => el.scrollTop);
-const title = await page.locator(".cx-title").getAttribute("aria-label");
+// The week is told by its first day, not the title: the title names only the month, and the
+// next week is often in the same month.
+const firstDay = () => document.querySelector(".cal-col-head")?.textContent;
+const title = await page.evaluate(firstDay);
await page.keyboard.press("ArrowRight");
-await page.waitForFunction((t) => document.querySelector(".cx-title")?.getAttribute("aria-label") !== t, title);
+await page.waitForFunction((t) => document.querySelector(".cal-col-head")?.textContent !== t, title);
ok(await scroller.evaluate((el) => el.scrollTop) === before, "the next week keeps the hours scrolled to");
await page.keyboard.press("ArrowLeft");
-await page.waitForFunction((t) => document.querySelector(".cx-title")?.getAttribute("aria-label") === t, title);
+await page.waitForFunction((t) => document.querySelector(".cal-col-head")?.textContent === t, title);
ok(await scroller.evaluate((el) => el.scrollTop) === before, "and so does the week before");
// A double-click on a free part of the all-day row: an all-day event on that day.
diff --git a/check.sh b/check.sh
index b998773..2969e12 100755
--- a/check.sh
+++ b/check.sh
@@ -165,6 +165,7 @@ step "webkit: occasions" env ENGINE=webkit node .uiverify/occasions.mjs
step "webkit: drive nav" env ENGINE=webkit node .uiverify/drive-nav.mjs
step "sign-in keyring" node .uiverify/signin-keyring.mjs
step "lapse reason" node .uiverify/lapse-reason.mjs
+step "calendar undo" node .uiverify/calendar-undo.mjs
printf '\n'
if [ "$fail" -eq 0 ]; then printf '\033[32mAll checks passed.\033[0m\n'; else printf '\033[31mSome checks failed.\033[0m\n'; fi