Skip to content

Commit 7fddf70

Browse files
authored
Call page.goto in e2e test with waitUntil: commit better offline support (#6207)
1 parent dc51b4c commit 7fddf70

8 files changed

Lines changed: 65 additions & 59 deletions

File tree

e2e/tests/dashboard/behaviours.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ test('goals breakdown', async ({ page, request }) => {
104104
scrollPercentage: 75
105105
})
106106

107-
await page.goto('/' + domain)
107+
await page.goto('/' + domain, { waitUntil: 'commit' })
108108

109109
const goalsTabButton = tabButton(report, 'Goals')
110110

@@ -186,7 +186,9 @@ test('goals breakdown', async ({ page, request }) => {
186186
})
187187

188188
await test.step('listing goals without revenue', async () => {
189-
await page.goto('/' + domain + '?f=has_not_done,goal,purchase')
189+
await page.goto('/' + domain + '?f=has_not_done,goal,purchase', {
190+
waitUntil: 'commit'
191+
})
190192

191193
await goalsTabButton.scrollIntoViewIfNeeded()
192194
await expect(goalsTabButton).toHaveAttribute('data-active', 'true')
@@ -286,7 +288,7 @@ test('props breakdown', async ({ page, request }) => {
286288

287289
await addAllCustomProps({ page, domain })
288290

289-
await page.goto('/' + domain)
291+
await page.goto('/' + domain, { waitUntil: 'commit' })
290292

291293
const propsTabButton = tabButton(report, 'Properties')
292294

@@ -427,7 +429,7 @@ test('funnels', async ({ page, request }) => {
427429
})
428430
}
429431

430-
await page.goto('/' + domain)
432+
await page.goto('/' + domain, { waitUntil: 'commit' })
431433

432434
const funnelsTabButton = tabButton(report, 'Funnels')
433435

e2e/tests/dashboard/breakdowns.spec.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test('sources breakdown', async ({ page, request }) => {
4848
]
4949
})
5050

51-
await page.goto('/' + domain)
51+
await page.goto('/' + domain, { waitUntil: 'commit' })
5252

5353
const report = page.getByTestId('report-sources')
5454

@@ -409,7 +409,7 @@ test('pages breakdown', async ({ page, request }) => {
409409
]
410410
})
411411

412-
await page.goto('/' + domain)
412+
await page.goto('/' + domain, { waitUntil: 'commit' })
413413

414414
const report = page.getByTestId('report-pages')
415415

@@ -523,7 +523,7 @@ test('pages breakdown modal', async ({ page, request }) => {
523523
events: pageEvents
524524
})
525525

526-
await page.goto('/' + domain)
526+
await page.goto('/' + domain, { waitUntil: 'commit' })
527527

528528
const report = page.getByTestId('report-pages')
529529

@@ -683,7 +683,9 @@ test('pages breakdown with a pageview goal filter applied', async ({
683683
const report = page.getByTestId('report-pages')
684684

685685
await test.step('custom goal filter applied', async () => {
686-
await page.goto('/' + domain + '?f=is,goal,create_site')
686+
await page.goto('/' + domain + '?f=is,goal,create_site', {
687+
waitUntil: 'commit'
688+
})
687689

688690
const pagesTabButton = tabButton(report, 'Conversion pages')
689691
await pagesTabButton.scrollIntoViewIfNeeded()
@@ -718,7 +720,9 @@ test('pages breakdown with a pageview goal filter applied', async ({
718720
})
719721

720722
await test.step('revenue goal filter applied', async () => {
721-
await page.goto('/' + domain + '?f=is,goal,purchase')
723+
await page.goto('/' + domain + '?f=is,goal,purchase', {
724+
waitUntil: 'commit'
725+
})
722726

723727
const pagesTabButton = tabButton(report, 'Conversion pages')
724728
await pagesTabButton.scrollIntoViewIfNeeded()
@@ -789,7 +793,7 @@ test('locations breakdown', async ({ page, request }) => {
789793
]
790794
})
791795

792-
await page.goto('/' + domain)
796+
await page.goto('/' + domain, { waitUntil: 'commit' })
793797

794798
const report = page.getByTestId('report-locations')
795799

@@ -950,7 +954,7 @@ test('devices breakdown', async ({ page, request }) => {
950954
]
951955
})
952956

953-
await page.goto('/' + domain)
957+
await page.goto('/' + domain, { waitUntil: 'commit' })
954958

955959
const report = page.getByTestId('report-devices')
956960

e2e/tests/dashboard/filtering.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.describe('page filtering tests', () => {
3030
]
3131
})
3232

33-
await page.goto('/' + domain)
33+
await page.goto('/' + domain, { waitUntil: 'commit' })
3434

3535
const pageFilterRow = filterRow(page, 'page')
3636
const pageInput = page.getByPlaceholder('Select a Page')
@@ -84,7 +84,7 @@ test.describe('page filtering tests', () => {
8484
]
8585
})
8686

87-
await page.goto('/' + domain)
87+
await page.goto('/' + domain, { waitUntil: 'commit' })
8888

8989
const pageFilterRow = filterRow(page, 'page')
9090
const pageInput = page.getByPlaceholder('Select a Page')
@@ -199,7 +199,7 @@ test.describe('page filtering tests', () => {
199199
]
200200
})
201201

202-
await page.goto('/' + domain)
202+
await page.goto('/' + domain, { waitUntil: 'commit' })
203203

204204
const entryPageFilterRow = filterRow(page, 'entry_page')
205205
const entryPageInput = page.getByPlaceholder('Select an Entry Page')
@@ -236,7 +236,7 @@ test.describe('page filtering tests', () => {
236236
]
237237
})
238238

239-
await page.goto('/' + domain)
239+
await page.goto('/' + domain, { waitUntil: 'commit' })
240240

241241
const exitPageFilterRow = filterRow(page, 'exit_page')
242242
const exitPageInput = page.getByPlaceholder('Select an Exit Page')
@@ -273,7 +273,7 @@ test.describe('hostname filtering tests', () => {
273273
]
274274
})
275275

276-
await page.goto('/' + domain)
276+
await page.goto('/' + domain, { waitUntil: 'commit' })
277277

278278
const hostnameFilterRow = filterRow(page, 'hostname')
279279
const hostnameInput = page.getByPlaceholder('Select a Hostname')
@@ -310,7 +310,7 @@ test.describe('acquisition filtering tests', () => {
310310
]
311311
})
312312

313-
await page.goto('/' + domain)
313+
await page.goto('/' + domain, { waitUntil: 'commit' })
314314

315315
await test.step('filtering by source', async () => {
316316
const sourceFilterRow = filterRow(page, 'source')
@@ -415,7 +415,7 @@ test.describe('acquisition filtering tests', () => {
415415
]
416416
})
417417

418-
await page.goto('/' + domain)
418+
await page.goto('/' + domain, { waitUntil: 'commit' })
419419

420420
await test.step('filtering by UTM medium', async () => {
421421
const utmMediumFilterRow = filterRow(page, 'utm_medium')
@@ -574,7 +574,7 @@ test.describe('location filtering tests', () => {
574574
]
575575
})
576576

577-
await page.goto('/' + domain)
577+
await page.goto('/' + domain, { waitUntil: 'commit' })
578578

579579
await test.step('filtering by country', async () => {
580580
const countryFilterRow = filterRow(page, 'country')
@@ -658,7 +658,7 @@ test.describe('screen size filtering tests', () => {
658658
]
659659
})
660660

661-
await page.goto('/' + domain)
661+
await page.goto('/' + domain, { waitUntil: 'commit' })
662662

663663
const screenSizeFilterRow = filterRow(page, 'screen')
664664
const screenSizeInput = page.getByPlaceholder('Select a Screen size')
@@ -698,7 +698,7 @@ test.describe('browser filtering tests', () => {
698698
]
699699
})
700700

701-
await page.goto('/' + domain)
701+
await page.goto('/' + domain, { waitUntil: 'commit' })
702702

703703
await test.step('filtering by browser type', async () => {
704704
const browserFilterRow = filterRow(page, 'browser')
@@ -769,7 +769,7 @@ test.describe('operating system filtering tests', () => {
769769
]
770770
})
771771

772-
await page.goto('/' + domain)
772+
await page.goto('/' + domain, { waitUntil: 'commit' })
773773

774774
await test.step('filtering by operating system type', async () => {
775775
const operatingSystemFilterRow = filterRow(page, 'os')
@@ -840,7 +840,7 @@ test.describe('goal filtering tests', () => {
840840
await addPageviewGoal({ page, domain, pathname: '/page1' })
841841
await addPageviewGoal({ page, domain, pathname: '/page2' })
842842

843-
await page.goto('/' + domain)
843+
await page.goto('/' + domain, { waitUntil: 'commit' })
844844

845845
const goalFilterRow = filterRow(page, 'goal')
846846
const goalInput = goalFilterRow.getByPlaceholder('Select a Goal')
@@ -915,7 +915,7 @@ test.describe('property filtering tests', () => {
915915
]
916916
})
917917

918-
await page.goto('/' + domain)
918+
await page.goto('/' + domain, { waitUntil: 'commit' })
919919

920920
const propFilterRow = filterRow(page, 'props')
921921
const propNameInput = propFilterRow.getByPlaceholder('Property')

e2e/tests/dashboard/general.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('dashboard renders for logged in user', async ({ page, request }) => {
1111
const { domain } = await setupSite({ page, request })
1212
await populateStats({ request, domain, events: [{ name: 'pageview' }] })
1313

14-
await page.goto('/' + domain)
14+
await page.goto('/' + domain, { waitUntil: 'commit' })
1515

1616
await expect(page).toHaveTitle(/Plausible/)
1717

@@ -24,7 +24,7 @@ test('dashboard renders for anonymous viewer', async ({ page, request }) => {
2424
await populateStats({ request, domain, events: [{ name: 'pageview' }] })
2525
await logout(page)
2626

27-
await page.goto('/' + domain)
27+
await page.goto('/' + domain, { waitUntil: 'commit' })
2828

2929
await expect(page).toHaveTitle(/Plausible/)
3030

@@ -44,15 +44,15 @@ test('dashboard renders via shared link', async ({ page, request }) => {
4444
await logout(page)
4545

4646
await test.step('public link', async () => {
47-
await page.goto(link)
47+
await page.goto(link, { waitUntil: 'commit' })
4848

4949
await expect(page.getByRole('button', { name: domain })).toBeVisible()
5050

5151
await expect(page.locator('#visitors')).toHaveText('1')
5252
})
5353

5454
await test.step('password protected link', async () => {
55-
await page.goto(passwordLink)
55+
await page.goto(passwordLink, { waitUntil: 'commit' })
5656

5757
await page.locator('input#password').fill('secret')
5858

@@ -81,7 +81,7 @@ test('dashboard renders with imported data', async ({ page, request }) => {
8181
]
8282
})
8383

84-
await page.goto('/' + domain)
84+
await page.goto('/' + domain, { waitUntil: 'commit' })
8585

8686
await test.step('with imported data included', async () => {
8787
await expect(page.locator('#visitors')).toHaveText('4')
@@ -109,11 +109,11 @@ test('tab selection user preferences are preserved across reloads', async ({
109109
const { domain } = await setupSite({ page, request })
110110
await populateStats({ request, domain, events: [{ name: 'pageview' }] })
111111

112-
await page.goto('/' + domain)
112+
await page.goto('/' + domain, { waitUntil: 'commit' })
113113

114114
await page.getByRole('button', { name: 'Entry pages' }).click()
115115

116-
await page.goto('/' + domain)
116+
await page.goto('/' + domain, { waitUntil: 'commit' })
117117

118118
let currentTab = await page.evaluate(
119119
(domain) => localStorage.getItem('pageTab__' + domain),
@@ -124,7 +124,7 @@ test('tab selection user preferences are preserved across reloads', async ({
124124

125125
await page.getByRole('button', { name: 'Exit pages' }).click()
126126

127-
await page.goto('/' + domain)
127+
await page.goto('/' + domain, { waitUntil: 'commit' })
128128

129129
currentTab = await page.evaluate(
130130
(domain) => localStorage.getItem('pageTab__' + domain),
@@ -142,7 +142,7 @@ test('back navigation closes the modal', async ({ page, request, baseURL }) => {
142142
events: [{ name: 'pageview' }]
143143
})
144144

145-
await page.goto('/' + domain)
145+
await page.goto('/' + domain, { waitUntil: 'commit' })
146146

147147
await page.getByRole('button', { name: 'Filter' }).click()
148148

e2e/tests/dashboard/segments.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const createPersonalSegment = async (page: Page, name: string) => {
8383
test('saving a segment', async ({ page, request }) => {
8484
const { domain } = await setupSiteAndStats({ page, request })
8585

86-
await page.goto('/' + domain)
86+
await page.goto('/' + domain, { waitUntil: 'commit' })
8787

8888
await test.step('creating personal segment using defaults', async () => {
8989
await addSourceFilter(page, 'Facebook')
@@ -220,7 +220,7 @@ test('creating a segment from a combination of segment and a filter is not allow
220220
}) => {
221221
const { domain } = await setupSiteAndStats({ page, request })
222222

223-
await page.goto('/' + domain)
223+
await page.goto('/' + domain, { waitUntil: 'commit' })
224224

225225
await addSourceFilter(page, 'Google')
226226
await createPersonalSegment(page, 'Traffic from Google')
@@ -249,7 +249,7 @@ test('creating a segment from a combination of segment and a filter is not allow
249249
test('editing an existing segment', async ({ page, request }) => {
250250
const { domain } = await setupSiteAndStats({ page, request })
251251

252-
await page.goto('/' + domain)
252+
await page.goto('/' + domain, { waitUntil: 'commit' })
253253

254254
await addSourceFilter(page, 'Google')
255255
await createPersonalSegment(page, 'Traffic from Google')
@@ -294,7 +294,7 @@ test('editing an existing segment', async ({ page, request }) => {
294294
test('saving edited segment as new', async ({ page, request }) => {
295295
const { domain } = await setupSiteAndStats({ page, request })
296296

297-
await page.goto('/' + domain)
297+
await page.goto('/' + domain, { waitUntil: 'commit' })
298298

299299
await addSourceFilter(page, 'Google')
300300
await createPersonalSegment(page, 'Traffic from Google')
@@ -348,7 +348,7 @@ test('saving edited segment as new', async ({ page, request }) => {
348348
test('deleting segment', async ({ page, request }) => {
349349
const { domain } = await setupSiteAndStats({ page, request })
350350

351-
await page.goto('/' + domain)
351+
await page.goto('/' + domain, { waitUntil: 'commit' })
352352

353353
await addSourceFilter(page, 'Google')
354354
await createPersonalSegment(page, 'Traffic from Google')
@@ -377,7 +377,7 @@ test('deleting segment', async ({ page, request }) => {
377377
test('closing edited segment without saving', async ({ page, request }) => {
378378
const { domain } = await setupSiteAndStats({ page, request })
379379

380-
await page.goto('/' + domain)
380+
await page.goto('/' + domain, { waitUntil: 'commit' })
381381

382382
await addSourceFilter(page, 'Google')
383383
await createPersonalSegment(page, 'Traffic from Google')

e2e/tests/dashboard/team-setup.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('submitting team name via Enter key does not crash', async ({
77
request
88
}) => {
99
await setupSite({ page, request })
10-
await page.goto('/team/setup')
10+
await page.goto('/team/setup', { waitUntil: 'commit' })
1111

1212
await expectLiveViewConnected(page)
1313

0 commit comments

Comments
 (0)