Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Add asserts about special goal modals (#6439)

Artur Pata414d240c5d77
diff --git a/e2e/tests/dashboard/behaviours.spec.ts b/e2e/tests/dashboard/behaviours.spec.ts
index 32a6238405..470efb77d9 100644
--- a/e2e/tests/dashboard/behaviours.spec.ts
+++ b/e2e/tests/dashboard/behaviours.spec.ts
@@ -25,7 +25,11 @@ import {
const getReport = (page: Page) => page.getByTestId('report-behaviours')
-test('special goals', async ({ page, request }) => {
+test('special goals', async ({ page, request }, testInfo) => {
+ test.slow(
+ testInfo.project.use.headless === false,
+ 'This test has many interactions which exceed default timeout when running --headed'
+ )
const report = getReport(page)
const { domain } = await setupSite({ page, request })
@@ -146,23 +150,11 @@ test('special goals', async ({ page, request }) => {
]
})
- await addGoal({ request, domain, params: { event_name: 'Form: Submission' } })
- await addGoal({ request, domain, params: { event_name: '404' } })
- await addGoal({
- request,
- domain,
- params: { event_name: 'Outbound Link: Click' }
- })
await addGoal({
request,
domain,
params: { event_name: 'Cloaked Link: Click' }
})
- await addGoal({
- request,
- domain,
- params: { event_name: 'File Download' }
- })
await addGoal({
request,
domain,
@@ -209,6 +201,29 @@ test('special goals', async ({ page, request }) => {
])
})
+ await test.step('Form: Submission special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'Form Actions' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), [
+ '/form-action/another-path',
+ '/form-action/path'
+ ])
+
+ await expectMetricValues(modal(page), '/form-action/path', [
+ '1',
+ '1',
+ '50%'
+ ])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is Form: Submission'
@@ -231,6 +246,22 @@ test('special goals', async ({ page, request }) => {
await expectMetricValues(report, '/another-wrong-path', ['1', '1', '50%'])
})
+ await test.step('404 special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: '404 Pages' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), ['/another-wrong-path', '/wrong-path'])
+
+ await expectMetricValues(modal(page), '/wrong-path', ['1', '1', '50%'])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is 404'
@@ -261,6 +292,29 @@ test('special goals', async ({ page, request }) => {
])
})
+ await test.step('Outbound Link: Click special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'Outbound Links' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), [
+ 'https://example.com/another-link',
+ 'https://example.com/link'
+ ])
+
+ await expectMetricValues(modal(page), 'https://example.com/link', [
+ '1',
+ '1',
+ '50%'
+ ])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is Outbound Link: Click'
@@ -291,6 +345,29 @@ test('special goals', async ({ page, request }) => {
)
})
+ await test.step('Cloaked Link: Click special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'Cloaked Links' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), [
+ 'https://example.com/another-cloaked-link',
+ 'https://example.com/cloaked-link'
+ ])
+
+ await expectMetricValues(modal(page), 'https://example.com/cloaked-link', [
+ '1',
+ '1',
+ '50%'
+ ])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is Cloaked Link: Click'
@@ -321,6 +398,29 @@ test('special goals', async ({ page, request }) => {
])
})
+ await test.step('File Download special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'File Downloads' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['url', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), [
+ 'https://example.com/another-file.zip',
+ 'https://example.com/file.zip'
+ ])
+
+ await expectMetricValues(modal(page), 'https://example.com/file.zip', [
+ '1',
+ '1',
+ '50%'
+ ])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is File Download'
@@ -343,6 +443,27 @@ test('special goals', async ({ page, request }) => {
await expectMetricValues(report, 'another query', ['1', '1', '50%'])
})
+ await test.step('WP Search Queries special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'WordPress Search Queries' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), [
+ 'search_query',
+ /Visitors/,
+ /Events/,
+ /CR/
+ ])
+
+ await expectRows(modal(page), ['another query', 'some query'])
+
+ await expectMetricValues(modal(page), 'some query', ['1', '1', '50%'])
+
+ await closeModalButton(page).click()
+ })
+
await page
.getByRole('button', {
name: 'Remove filter: Goal is WP Search Queries'
@@ -363,6 +484,22 @@ test('special goals', async ({ page, request }) => {
await expectMetricValues(report, '/some/path', ['1', '1', '50%'])
await expectMetricValues(report, '/another/path', ['1', '1', '50%'])
})
+
+ await test.step('WP Form Completions special-goal modal', async () => {
+ await detailsLink(report).click()
+
+ await expect(
+ modal(page).getByRole('heading', { name: 'WordPress Form Completions' })
+ ).toBeVisible()
+
+ await expectHeaders(modal(page), ['path', /Visitors/, /Events/, /CR/])
+
+ await expectRows(modal(page), ['/another/path', '/some/path'])
+
+ await expectMetricValues(modal(page), '/some/path', ['1', '1', '50%'])
+
+ await closeModalButton(page).click()
+ })
})
test('goals breakdown', async ({ page, request }) => {