diff --git a/calendar/test/browser/views/browser_monthView.js b/calendar/test/browser/views/browser_monthView.js index 288387e4c3..c423a83d20 100644 --- a/calendar/test/browser/views/browser_monthView.js +++ b/calendar/test/browser/views/browser_monthView.js @@ -80,10 +80,16 @@ add_task(async function testMonthView() { }); // Check if name was saved. - eventBox = await monthView.waitForItemAt(controller.window, 1, 5, 1); + eventBox = await TestUtils.waitForCondition(() => { + let newEventBox = monthView.getItemAt(controller.window, 1, 5, 1); + if (newEventBox && newEventBox != eventBox) { + return newEventBox; + } + return false; + }); let eventName = eventBox.querySelector(".event-name-label"); Assert.ok(eventName); - Assert.ok(eventName.value == TITLE2); + Assert.equal(eventName.value, TITLE2); // Delete event. controller.click(new elib.Elem(eventBox)); diff --git a/calendar/test/browser/views/browser_weekView.js b/calendar/test/browser/views/browser_weekView.js index 1ee7a959db..51d663de93 100644 --- a/calendar/test/browser/views/browser_weekView.js +++ b/calendar/test/browser/views/browser_weekView.js @@ -77,10 +77,16 @@ add_task(async function testWeekView() { }); // Check if name was saved. - eventBox = await weekView.waitForEventBoxAt(controller.window, 5, 1); + eventBox = await TestUtils.waitForCondition(() => { + let newEventBox = weekView.getEventBoxAt(controller.window, 5, 1); + if (newEventBox && newEventBox != eventBox) { + return newEventBox; + } + return false; + }); let eventName = eventBox.querySelector(".calendar-event-details-core"); Assert.ok(eventName); - Assert.ok(eventName.textContent == TITLE2); + Assert.equal(eventName.textContent, TITLE2); // Delete event. controller.click(new elib.Elem(eventBox));