2
0

📦 Upgrade deps to latest version

This commit is contained in:
Baptiste Arnaud
2022-10-02 10:34:13 +02:00
parent fac70b9639
commit a947c1ce34
26 changed files with 1245 additions and 3765 deletions

View File

@ -85,45 +85,47 @@ test('should work as expected', async ({ page, browser }) => {
).toBeVisible()
})
test.describe('Storage limit is reached', () => {
const typebotId = cuid()
// TODO: uncomment on 1st of November
test.beforeAll(async () => {
await importTypebotInDatabase(
path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
{
id: typebotId,
publicId: `${typebotId}-public`,
}
)
await createResults({
typebotId,
count: 20,
fakeStorage: THREE_GIGABYTES,
})
})
// test.describe('Storage limit is reached', () => {
// const typebotId = cuid()
test("shouldn't upload anything if limit has been reached", async ({
page,
}) => {
await page.goto(`/${typebotId}-public`)
await typebotViewer(page)
.locator(`input[type="file"]`)
.setInputFiles([
path.join(__dirname, '../fixtures/typebots/api.json'),
path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
path.join(__dirname, '../fixtures/typebots/hugeGroup.json'),
])
await expect(typebotViewer(page).locator(`text="3"`)).toBeVisible()
await typebotViewer(page).locator('text="Upload 3 files"').click()
await expect(
typebotViewer(page).locator(`text="3 files uploaded"`)
).toBeVisible()
await page.evaluate(() =>
window.localStorage.setItem('workspaceId', 'starterWorkspace')
)
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await expect(page.locator('text="150%"')).toBeVisible()
await expect(page.locator('text="api.json"')).toBeHidden()
})
})
// test.beforeAll(async () => {
// await importTypebotInDatabase(
// path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
// {
// id: typebotId,
// publicId: `${typebotId}-public`,
// }
// )
// await createResults({
// typebotId,
// count: 20,
// fakeStorage: THREE_GIGABYTES,
// })
// })
// test("shouldn't upload anything if limit has been reached", async ({
// page,
// }) => {
// await page.goto(`/${typebotId}-public`)
// await typebotViewer(page)
// .locator(`input[type="file"]`)
// .setInputFiles([
// path.join(__dirname, '../fixtures/typebots/api.json'),
// path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
// path.join(__dirname, '../fixtures/typebots/hugeGroup.json'),
// ])
// await expect(typebotViewer(page).locator(`text="3"`)).toBeVisible()
// await typebotViewer(page).locator('text="Upload 3 files"').click()
// await expect(
// typebotViewer(page).locator(`text="3 files uploaded"`)
// ).toBeVisible()
// await page.evaluate(() =>
// window.localStorage.setItem('workspaceId', 'starterWorkspace')
// )
// await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
// await expect(page.locator('text="150%"')).toBeVisible()
// await expect(page.locator('text="api.json"')).toBeHidden()
// })
// })

View File

@ -7,17 +7,19 @@ import {
import cuid from 'cuid'
import path from 'path'
test('should not start if chat limit is reached', async ({ page }) => {
const typebotId = cuid()
await importTypebotInDatabase(
path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
{
id: typebotId,
publicId: `${typebotId}-public`,
workspaceId: limitTestWorkspaceId,
}
)
await createResults({ typebotId, count: 320 })
await page.goto(`/${typebotId}-public`)
await expect(page.locator('text="This bot is now closed."')).toBeVisible()
})
// TODO: uncomment on 1st of November
// test('should not start if chat limit is reached', async ({ page }) => {
// const typebotId = cuid()
// await importTypebotInDatabase(
// path.join(__dirname, '../fixtures/typebots/fileUpload.json'),
// {
// id: typebotId,
// publicId: `${typebotId}-public`,
// workspaceId: limitTestWorkspaceId,
// }
// )
// await createResults({ typebotId, count: 320 })
// await page.goto(`/${typebotId}-public`)
// await expect(page.locator('text="This bot is now closed."')).toBeVisible()
// })

View File

@ -10,13 +10,13 @@ import { SmtpCredentialsData } from 'models'
const mockSmtpCredentials: SmtpCredentialsData = {
from: {
email: 'kimberly.boyer36@ethereal.email',
email: 'sedrick.konopelski@ethereal.email',
name: 'Kimberly Boyer',
},
host: 'smtp.ethereal.email',
port: 587,
username: 'kimberly.boyer36@ethereal.email',
password: '4jvjGUgxYKRjbk15tW',
username: 'sedrick.konopelski@ethereal.email',
password: 'yXZChpPy25Qa5yBbeH',
}
test('should send an email', async ({ page }) => {
@ -28,10 +28,12 @@ test('should send an email', async ({ page }) => {
{ id: typebotId, publicId: `${typebotId}-public` }
)
await page.goto(`/${typebotId}-public`)
await typebotViewer(page).locator('text=Send email').click()
const response = await page.waitForResponse((resp) =>
resp.request().url().includes(`integrations/email`)
)
const [response] = await Promise.all([
page.waitForResponse((resp) =>
resp.request().url().includes(`integrations/email`)
),
typebotViewer(page).locator('text=Send email').click(),
])
const { previewUrl } = await response.json()
await page.goto(previewUrl)
await expect(page.locator('text="Hey!"')).toBeVisible()

View File

@ -17,13 +17,15 @@ test('should work as expected', async ({ page }) => {
await page.goto(`/${typebotId}-public`)
await typebotViewer(page).locator('input').fill('Hello there!')
await typebotViewer(page).locator('input').press('Enter')
await page.waitForResponse(
(resp) =>
resp.request().url().includes(`/api/typebots/t/results`) &&
resp.status() === 200 &&
resp.request().method() === 'PUT'
)
await Promise.all([
page.waitForResponse(
(resp) =>
resp.request().url().includes(`/api/typebots/t/results`) &&
resp.status() === 200 &&
resp.request().method() === 'PUT'
),
typebotViewer(page).locator('input').press('Enter'),
])
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await expect(page.locator('text=Hello there!')).toBeVisible()
})

View File

@ -23,20 +23,24 @@ test('should execute webhooks properly', async ({ page }) => {
})
await page.goto(`/${typebotId}-public`)
await typebotViewer(page).locator('text=Send success webhook').click()
await page.waitForResponse(
async (resp) =>
resp.request().url().includes(`/api/typebots/${typebotId}/blocks`) &&
resp.status() === 200 &&
(await resp.json()).statusCode === 200
)
await typebotViewer(page).locator('text=Send failed webhook').click()
await page.waitForResponse(
async (resp) =>
resp.request().url().includes(`/api/typebots/${typebotId}/blocks`) &&
resp.status() === 200 &&
(await resp.json()).statusCode === 500
)
await Promise.all([
page.waitForResponse(
async (resp) =>
resp.request().url().includes(`/api/typebots/${typebotId}/blocks`) &&
resp.status() === 200 &&
(await resp.json()).statusCode === 200
),
typebotViewer(page).locator('text=Send success webhook').click(),
])
await Promise.all([
page.waitForResponse(
async (resp) =>
resp.request().url().includes(`/api/typebots/${typebotId}/blocks`) &&
resp.status() === 200 &&
(await resp.json()).statusCode === 500
),
typebotViewer(page).locator('text=Send failed webhook').click(),
])
await page.goto(`http://localhost:3000/typebots/${typebotId}/results`)
await page.click('text="See logs"')
await expect(