Skip to content

Commit 1b6c09b

Browse files
committed
Add asserts about special goal modals
1 parent bff16a4 commit 1b6c09b

1 file changed

Lines changed: 150 additions & 13 deletions

File tree

e2e/tests/dashboard/behaviours.spec.ts

Lines changed: 150 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import {
2525

2626
const getReport = (page: Page) => page.getByTestId('report-behaviours')
2727

28-
test('special goals', async ({ page, request }) => {
28+
test('special goals', async ({ page, request }, testInfo) => {
29+
test.slow(
30+
testInfo.project.use.headless === false,
31+
'This test has many interactions which exceed default timeout when running --headed'
32+
)
2933
const report = getReport(page)
3034
const { domain } = await setupSite({ page, request })
3135

@@ -146,23 +150,11 @@ test('special goals', async ({ page, request }) => {
146150
]
147151
})
148152

149-
await addGoal({ request, domain, params: { event_name: 'Form: Submission' } })
150-
await addGoal({ request, domain, params: { event_name: '404' } })
151-
await addGoal({
152-
request,
153-
domain,
154-
params: { event_name: 'Outbound Link: Click' }
155-
})
156153
await addGoal({
157154
request,
158155
domain,
159156
params: { event_name: 'Cloaked Link: Click' }
160157
})
161-
await addGoal({
162-
request,
163-
domain,
164-
params: { event_name: 'File Download' }
165-
})
166158
await addGoal({
167159
request,
168160
domain,
@@ -209,6 +201,29 @@ test('special goals', async ({ page, request }) => {
209201
])
210202
})
211203

204+
await test.step('Form: Submission special-goal modal', async () => {
205+
await detailsLink(report).click()
206+
207+
await expect(
208+
modal(page).getByRole('heading', { name: 'Form Actions' })
209+
).toBeVisible()
210+
211+
await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
212+
213+
await expectRows(modal(page), [
214+
'/form-action/another-path',
215+
'/form-action/path'
216+
])
217+
218+
await expectMetricValues(modal(page), '/form-action/path', [
219+
'1',
220+
'1',
221+
'50%'
222+
])
223+
224+
await closeModalButton(page).click()
225+
})
226+
212227
await page
213228
.getByRole('button', {
214229
name: 'Remove filter: Goal is Form: Submission'
@@ -231,6 +246,22 @@ test('special goals', async ({ page, request }) => {
231246
await expectMetricValues(report, '/another-wrong-path', ['1', '1', '50%'])
232247
})
233248

249+
await test.step('404 special-goal modal', async () => {
250+
await detailsLink(report).click()
251+
252+
await expect(
253+
modal(page).getByRole('heading', { name: '404 Pages' })
254+
).toBeVisible()
255+
256+
await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
257+
258+
await expectRows(modal(page), ['/another-wrong-path', '/wrong-path'])
259+
260+
await expectMetricValues(modal(page), '/wrong-path', ['1', '1', '50%'])
261+
262+
await closeModalButton(page).click()
263+
})
264+
234265
await page
235266
.getByRole('button', {
236267
name: 'Remove filter: Goal is 404'
@@ -261,6 +292,29 @@ test('special goals', async ({ page, request }) => {
261292
])
262293
})
263294

295+
await test.step('Outbound Link: Click special-goal modal', async () => {
296+
await detailsLink(report).click()
297+
298+
await expect(
299+
modal(page).getByRole('heading', { name: 'Outbound Links' })
300+
).toBeVisible()
301+
302+
await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
303+
304+
await expectRows(modal(page), [
305+
'https://example.com/another-link',
306+
'https://example.com/link'
307+
])
308+
309+
await expectMetricValues(modal(page), 'https://example.com/link', [
310+
'1',
311+
'1',
312+
'50%'
313+
])
314+
315+
await closeModalButton(page).click()
316+
})
317+
264318
await page
265319
.getByRole('button', {
266320
name: 'Remove filter: Goal is Outbound Link: Click'
@@ -291,6 +345,29 @@ test('special goals', async ({ page, request }) => {
291345
)
292346
})
293347

348+
await test.step('Cloaked Link: Click special-goal modal', async () => {
349+
await detailsLink(report).click()
350+
351+
await expect(
352+
modal(page).getByRole('heading', { name: 'Cloaked Links' })
353+
).toBeVisible()
354+
355+
await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
356+
357+
await expectRows(modal(page), [
358+
'https://example.com/another-cloaked-link',
359+
'https://example.com/cloaked-link'
360+
])
361+
362+
await expectMetricValues(modal(page), 'https://example.com/cloaked-link', [
363+
'1',
364+
'1',
365+
'50%'
366+
])
367+
368+
await closeModalButton(page).click()
369+
})
370+
294371
await page
295372
.getByRole('button', {
296373
name: 'Remove filter: Goal is Cloaked Link: Click'
@@ -321,6 +398,29 @@ test('special goals', async ({ page, request }) => {
321398
])
322399
})
323400

401+
await test.step('File Download special-goal modal', async () => {
402+
await detailsLink(report).click()
403+
404+
await expect(
405+
modal(page).getByRole('heading', { name: 'File Downloads' })
406+
).toBeVisible()
407+
408+
await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
409+
410+
await expectRows(modal(page), [
411+
'https://example.com/another-file.zip',
412+
'https://example.com/file.zip'
413+
])
414+
415+
await expectMetricValues(modal(page), 'https://example.com/file.zip', [
416+
'1',
417+
'1',
418+
'50%'
419+
])
420+
421+
await closeModalButton(page).click()
422+
})
423+
324424
await page
325425
.getByRole('button', {
326426
name: 'Remove filter: Goal is File Download'
@@ -343,6 +443,27 @@ test('special goals', async ({ page, request }) => {
343443
await expectMetricValues(report, 'another query', ['1', '1', '50%'])
344444
})
345445

446+
await test.step('WP Search Queries special-goal modal', async () => {
447+
await detailsLink(report).click()
448+
449+
await expect(
450+
modal(page).getByRole('heading', { name: 'WordPress Search Queries' })
451+
).toBeVisible()
452+
453+
await expectHeaders(modal(page), [
454+
'search_query',
455+
/Visitors/,
456+
/Events/,
457+
/CR/
458+
])
459+
460+
await expectRows(modal(page), ['another query', 'some query'])
461+
462+
await expectMetricValues(modal(page), 'some query', ['1', '1', '50%'])
463+
464+
await closeModalButton(page).click()
465+
})
466+
346467
await page
347468
.getByRole('button', {
348469
name: 'Remove filter: Goal is WP Search Queries'
@@ -363,6 +484,22 @@ test('special goals', async ({ page, request }) => {
363484
await expectMetricValues(report, '/some/path', ['1', '1', '50%'])
364485
await expectMetricValues(report, '/another/path', ['1', '1', '50%'])
365486
})
487+
488+
await test.step('WP Form Completions special-goal modal', async () => {
489+
await detailsLink(report).click()
490+
491+
await expect(
492+
modal(page).getByRole('heading', { name: 'WordPress Form Completions' })
493+
).toBeVisible()
494+
495+
await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
496+
497+
await expectRows(modal(page), ['/another/path', '/some/path'])
498+
499+
await expectMetricValues(modal(page), '/some/path', ['1', '1', '50%'])
500+
501+
await closeModalButton(page).click()
502+
})
366503
})
367504

368505
test('goals breakdown', async ({ page, request }) => {

0 commit comments

Comments
 (0)