2022-11-15 09:35:48 +01:00
|
|
|
import { getTestAsset } from '@/test/utils/playwright'
|
2022-09-24 08:58:23 +02:00
|
|
|
import test, { expect } from '@playwright/test'
|
2023-02-10 15:06:02 +01:00
|
|
|
import { createId } from '@paralleldrive/cuid2'
|
2022-11-02 19:45:46 +01:00
|
|
|
import {
|
|
|
|
|
importTypebotInDatabase,
|
|
|
|
|
injectFakeResults,
|
2023-03-15 08:35:16 +01:00
|
|
|
} from '@typebot.io/lib/playwright/databaseActions'
|
|
|
|
|
import { starterWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup'
|
2022-09-24 08:58:23 +02:00
|
|
|
|
|
|
|
|
test('analytics are not available for non-pro workspaces', async ({ page }) => {
|
2023-02-10 15:06:02 +01:00
|
|
|
const typebotId = createId()
|
2022-09-24 08:58:23 +02:00
|
|
|
await importTypebotInDatabase(
|
2022-11-15 09:35:48 +01:00
|
|
|
getTestAsset('typebots/results/submissionHeader.json'),
|
2022-09-24 08:58:23 +02:00
|
|
|
{
|
|
|
|
|
id: typebotId,
|
|
|
|
|
workspaceId: starterWorkspaceId,
|
|
|
|
|
}
|
|
|
|
|
)
|
2022-11-02 19:45:46 +01:00
|
|
|
await injectFakeResults({ typebotId, count: 10 })
|
2022-09-24 08:58:23 +02:00
|
|
|
await page.goto(`/typebots/${typebotId}/results/analytics`)
|
|
|
|
|
const firstDropoffBox = page.locator('text="%" >> nth=0')
|
|
|
|
|
await firstDropoffBox.hover()
|
|
|
|
|
await expect(
|
2023-06-30 12:13:17 +02:00
|
|
|
page.locator('text="Upgrade your plan to PRO to reveal drop-off rate."')
|
2022-09-24 08:58:23 +02:00
|
|
|
).toBeVisible()
|
|
|
|
|
await firstDropoffBox.click()
|
|
|
|
|
await expect(
|
|
|
|
|
page.locator(
|
|
|
|
|
'text="You need to upgrade your plan in order to unlock in-depth analytics"'
|
|
|
|
|
)
|
|
|
|
|
).toBeVisible()
|
|
|
|
|
})
|