2022-02-18 14:57:10 +01:00
|
|
|
import test, { expect } from '@playwright/test'
|
2023-02-10 15:06:02 +01:00
|
|
|
import { createId } from '@paralleldrive/cuid2'
|
2024-03-15 16:32:29 +01:00
|
|
|
import { createTypebots } from '@typebot.io/playwright/databaseActions'
|
|
|
|
import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
|
|
|
|
import { starterWorkspaceId } from '@typebot.io/playwright/databaseSetup'
|
2023-11-08 15:34:16 +01:00
|
|
|
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
|
2022-02-18 14:57:10 +01:00
|
|
|
|
2022-05-13 15:22:44 -07:00
|
|
|
test('should be able to connect custom domain', async ({ page }) => {
|
2023-02-10 15:06:02 +01:00
|
|
|
const typebotId = createId()
|
2022-05-13 15:22:44 -07:00
|
|
|
await createTypebots([
|
|
|
|
{
|
|
|
|
id: typebotId,
|
2022-06-11 07:27:38 +02:00
|
|
|
...parseDefaultGroupWithBlock({
|
|
|
|
type: InputBlockType.TEXT,
|
2022-05-13 15:22:44 -07:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
])
|
|
|
|
await page.goto(`/typebots/${typebotId}/share`)
|
|
|
|
await page.click('text=Add my domain')
|
|
|
|
await page.click('text=Connect new')
|
|
|
|
await page.fill('input[placeholder="bot.my-domain.com"]', 'test')
|
|
|
|
await expect(page.locator('text=Save')).toBeDisabled()
|
|
|
|
await page.fill('input[placeholder="bot.my-domain.com"]', 'yolozeeer.com')
|
|
|
|
await expect(page.locator('text="A"')).toBeVisible()
|
|
|
|
await page.fill('input[placeholder="bot.my-domain.com"]', 'sub.yolozeeer.com')
|
|
|
|
await expect(page.locator('text="CNAME"')).toBeVisible()
|
|
|
|
await page.click('text=Save')
|
|
|
|
await expect(page.locator('text="https://sub.yolozeeer.com/"')).toBeVisible()
|
2024-03-15 16:32:29 +01:00
|
|
|
await page.click('text="Edit"')
|
2022-05-13 15:22:44 -07:00
|
|
|
await page.fill('text=https://sub.yolozeeer.com/Copy >> input', 'custom-path')
|
|
|
|
await page.press(
|
|
|
|
'text=https://sub.yolozeeer.com/custom-path >> input',
|
|
|
|
'Enter'
|
|
|
|
)
|
|
|
|
await expect(page.locator('text="custom-path"')).toBeVisible()
|
2023-08-21 15:32:27 +02:00
|
|
|
await page.click('[aria-label="Remove custom URL"]')
|
2022-05-13 15:22:44 -07:00
|
|
|
await expect(page.locator('text=sub.yolozeeer.com')).toBeHidden()
|
|
|
|
await page.click('button >> text=Add my domain')
|
|
|
|
await page.click('[aria-label="Remove domain"]')
|
2023-03-21 15:42:03 +01:00
|
|
|
await expect(page.locator('[aria-label="Remove domain"]')).toBeHidden({
|
|
|
|
timeout: 10000,
|
|
|
|
})
|
2022-05-13 15:22:44 -07:00
|
|
|
})
|
|
|
|
|
2022-09-17 16:37:33 +02:00
|
|
|
test.describe('Starter workspace', () => {
|
2022-05-13 15:22:44 -07:00
|
|
|
test("Add my domain shouldn't be available", async ({ page }) => {
|
2023-02-10 15:06:02 +01:00
|
|
|
const typebotId = createId()
|
2022-02-18 14:57:10 +01:00
|
|
|
await createTypebots([
|
|
|
|
{
|
|
|
|
id: typebotId,
|
2022-09-17 16:37:33 +02:00
|
|
|
workspaceId: starterWorkspaceId,
|
2022-06-11 07:27:38 +02:00
|
|
|
...parseDefaultGroupWithBlock({
|
|
|
|
type: InputBlockType.TEXT,
|
2022-02-18 14:57:10 +01:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
])
|
|
|
|
await page.goto(`/typebots/${typebotId}/share`)
|
2023-10-04 16:47:58 +02:00
|
|
|
await expect(
|
|
|
|
page.locator('[data-testid="pro-lock-tag"]').nth(0)
|
|
|
|
).toBeVisible()
|
2022-02-18 14:57:10 +01:00
|
|
|
await page.click('text=Add my domain')
|
2022-09-24 08:58:23 +02:00
|
|
|
await expect(
|
|
|
|
page.locator(
|
|
|
|
'text="You need to upgrade your plan in order to add custom domains"'
|
|
|
|
)
|
|
|
|
).toBeVisible()
|
2022-02-18 14:57:10 +01:00
|
|
|
})
|
|
|
|
})
|