2
0
Files
bot/apps/builder/playwright/tests/customDomains.spec.ts

69 lines
2.4 KiB
TypeScript
Raw Normal View History

2022-02-18 14:57:10 +01:00
import test, { expect } from '@playwright/test'
2022-06-11 07:27:38 +02:00
import { InputBlockType, defaultTextInputOptions } from 'models'
2022-05-13 15:22:44 -07:00
import {
createTypebots,
freeWorkspaceId,
2022-06-11 07:27:38 +02:00
parseDefaultGroupWithBlock,
2022-05-13 15:22:44 -07:00
} from '../services/database'
2022-02-18 14:57:10 +01:00
import path from 'path'
import cuid from 'cuid'
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 }) => {
const typebotId = cuid()
await createTypebots([
{
id: typebotId,
2022-06-11 07:27:38 +02:00
...parseDefaultGroupWithBlock({
type: InputBlockType.TEXT,
2022-05-13 15:22:44 -07:00
options: defaultTextInputOptions,
}),
},
])
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()
await page.click('text="Edit" >> nth=1')
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()
await page.click('[aria-label="Remove custom domain"]')
await expect(page.locator('text=sub.yolozeeer.com')).toBeHidden()
await page.click('button >> text=Add my domain')
await page.click('[aria-label="Remove domain"]')
await expect(page.locator('[aria-label="Remove domain"]')).toBeHidden()
})
test.describe('Free workspace', () => {
test.use({
storageState: path.join(__dirname, '../freeUser.json'),
})
test("Add my domain shouldn't be available", async ({ page }) => {
const typebotId = cuid()
2022-02-18 14:57:10 +01:00
await createTypebots([
{
id: typebotId,
2022-05-13 15:22:44 -07:00
workspaceId: freeWorkspaceId,
2022-06-11 07:27:38 +02:00
...parseDefaultGroupWithBlock({
type: InputBlockType.TEXT,
2022-02-18 14:57:10 +01:00
options: defaultTextInputOptions,
}),
},
])
await page.goto(`/typebots/${typebotId}/share`)
await expect(page.locator('text=Pro')).toBeVisible()
2022-02-18 14:57:10 +01:00
await page.click('text=Add my domain')
2022-05-13 15:22:44 -07:00
await expect(page.locator('text=For solo creator')).toBeVisible()
2022-02-18 14:57:10 +01:00
})
})