2
0

build: upgrade packages

This commit is contained in:
Baptiste Arnaud
2022-08-21 22:33:09 +02:00
parent 93161b74b2
commit 59281426b0
23 changed files with 2341 additions and 1063 deletions

View File

@ -6,6 +6,9 @@ import { typebotViewer } from '../services/selectorUtils'
import { importTypebotInDatabase } from '../services/database'
import { readFileSync } from 'fs'
import { isDefined } from 'utils'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('should work as expected', async ({ page, browser }) => {
const typebotId = cuid()
@ -26,7 +29,7 @@ test('should work as expected', async ({ page, browser }) => {
await expect(
typebotViewer(page).locator(`text="3 files uploaded"`)
).toBeVisible()
await page.goto(`http://localhost:3000/typebots/${typebotId}/results`)
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await expect(page.locator('text="api.json"')).toHaveAttribute(
'href',
/.+\/api\.json/

View File

@ -3,6 +3,9 @@ import path from 'path'
import { importTypebotInDatabase } from '../services/database'
import { typebotViewer } from '../services/selectorUtils'
import cuid from 'cuid'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('should work as expected', async ({ page }) => {
const typebotId = cuid()
@ -16,7 +19,7 @@ test('should work as expected', async ({ page }) => {
await typebotViewer(page).locator('input').fill('26')
await typebotViewer(page).locator('input').press('Enter')
await typebotViewer(page).locator('button >> text=Yes').click()
await page.goto(`http://localhost:3000/typebots/${typebotId}/results`)
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await expect(page.locator('text="Baptiste"')).toBeVisible()
await expect(page.locator('text="26"')).toBeVisible()
await expect(page.locator('text="Yes"')).toBeVisible()

View File

@ -11,6 +11,9 @@ import {
} from 'models'
import { typebotViewer } from '../services/selectorUtils'
import cuid from 'cuid'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('Should correctly parse metadata', async ({ page }) => {
const typebotId = cuid()

View File

@ -3,6 +3,9 @@ import { importTypebotInDatabase } from '../services/database'
import cuid from 'cuid'
import path from 'path'
import { typebotViewer } from '../services/selectorUtils'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('should correctly be injected', async ({ page }) => {
const typebotId = cuid()

View File

@ -7,17 +7,20 @@ import cuid from 'cuid'
import path from 'path'
import { typebotViewer } from '../services/selectorUtils'
import { SmtpCredentialsData } from 'models'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
const mockSmtpCredentials: SmtpCredentialsData = {
from: {
email: 'tobin.tillman65@ethereal.email',
name: 'John Smith',
email: 'kimberly.boyer36@ethereal.email',
name: 'Kimberly Boyer',
},
host: 'smtp.ethereal.email',
port: 587,
isTlsEnabled: false,
username: 'tobin.tillman65@ethereal.email',
password: 'Ty9BcwCBrK6w8AG2hx',
isTlsEnabled: true,
username: 'kimberly.boyer36@ethereal.email',
password: '4jvjGUgxYKRjbk15tW',
}
test('should send an email', async ({ page }) => {
@ -36,13 +39,13 @@ test('should send an email', async ({ page }) => {
const { previewUrl } = await response.json()
await page.goto(previewUrl)
await expect(page.locator('text="Hey!"')).toBeVisible()
await expect(page.locator('text="John Smith"')).toBeVisible()
await expect(page.locator('text="Kimberly Boyer"')).toBeVisible()
await expect(page.locator('text="<test1@gmail.com>" >> nth=0')).toBeVisible()
await expect(page.locator('text="<test2@gmail.com>" >> nth=0')).toBeVisible()
await expect(
page.locator('text="<baptiste.arnaud95@gmail.com>" >> nth=0')
).toBeVisible()
await page.goto(`http://localhost:3000/typebots/${typebotId}/results`)
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await page.click('text="See logs"')
await expect(page.locator('text="Email successfully sent"')).toBeVisible()
})

View File

@ -10,6 +10,9 @@ import {
defaultTextInputOptions,
InputBlockType,
} from 'models'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('Result should be in storage by default', async ({ page }) => {
const typebotId = cuid()

View File

@ -2,6 +2,9 @@ import test, { expect } from '@playwright/test'
import path from 'path'
import { importTypebotInDatabase } from '../services/database'
import { typebotViewer } from '../services/selectorUtils'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('should work as expected', async ({ page }) => {
const typebotId = 'cl0ibhi7s0018n21aarlmg0cm'
@ -24,6 +27,6 @@ test('should work as expected', async ({ page }) => {
resp.status() === 200 &&
resp.request().method() === 'PUT'
)
await page.goto(`http://localhost:3000/typebots/${typebotId}/results`)
await page.goto(`${process.env.BUILDER_URL}/typebots/${typebotId}/results`)
await expect(page.locator('text=Hello there!')).toBeVisible()
})

View File

@ -4,6 +4,9 @@ import cuid from 'cuid'
import path from 'path'
import { typebotViewer } from '../services/selectorUtils'
import { HttpMethod } from 'models'
import { mockSessionApiCalls } from 'playwright/services/browser'
test.beforeEach(({ page }) => mockSessionApiCalls(page))
test('should execute webhooks properly', async ({ page }) => {
const typebotId = cuid()