Skip to content

Commit f989e45

Browse files
Copilothasparus
andcommitted
Replace networkidle with load wait and remove manual scrolling
Co-authored-by: hasparus <[email protected]>
1 parent affcccc commit f989e45

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

test/e2e/community-events.spec.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ test("map tooltip appears on marker hover", async ({ page }) => {
141141
test("event type filters hide cards and lock the last active tag", async ({
142142
page,
143143
}) => {
144-
await page.goto("/community/events", { waitUntil: "networkidle" })
145-
await page.waitForLoadState("domcontentloaded")
144+
await page.goto("/community/events", { waitUntil: "load" })
146145

147146
const pastEventsSection = page
148147
.locator("section")
@@ -154,9 +153,8 @@ test("event type filters hide cards and lock the last active tag", async ({
154153
})
155154
.first()
156155

157-
await pastEventsSection.waitFor({ state: "visible", timeout: 15000 })
158-
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
159-
await page.waitForTimeout(500)
156+
await pastEventsSection.waitFor({ state: "visible", timeout: 20000 })
157+
await page.waitForTimeout(1000)
160158

161159
const filterGroup = pastEventsSection.locator("fieldset")
162160

@@ -220,8 +218,7 @@ test("event type filters hide cards and lock the last active tag", async ({
220218
test("upcoming and past sections only show events on the correct side of now", async ({
221219
page,
222220
}) => {
223-
await page.goto("/community/events", { waitUntil: "networkidle" })
224-
await page.waitForLoadState("domcontentloaded")
221+
await page.goto("/community/events", { waitUntil: "load" })
225222

226223
const upcomingSection = page
227224
.locator("section")
@@ -239,13 +236,10 @@ test("upcoming and past sections only show events on the correct side of now", a
239236
})
240237
.first()
241238

242-
// Wait for both sections to be present before scrolling
243-
await upcomingSection.waitFor({ state: "attached", timeout: 15000 })
244-
await pastEventsSection.waitFor({ state: "attached", timeout: 15000 })
245-
246-
// Scroll to bottom to ensure everything is loaded
247-
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
248-
await page.waitForTimeout(500)
239+
// Wait for both sections to be visible
240+
await upcomingSection.waitFor({ state: "visible", timeout: 20000 })
241+
await pastEventsSection.waitFor({ state: "visible", timeout: 20000 })
242+
await page.waitForTimeout(1000)
249243

250244
const now = Date.now()
251245

0 commit comments

Comments
 (0)