2
0

chore(inputs): Add Button targets e2e tests

This commit is contained in:
Baptiste Arnaud
2022-01-12 09:57:00 +01:00
parent 659f50eb06
commit 13f72f5ff7
10 changed files with 168 additions and 13 deletions

View File

@ -1,3 +1,5 @@
import { userIds } from 'cypress/plugins/data'
describe('Dashboard page', () => {
before(() => {
cy.intercept({
@ -33,7 +35,7 @@ describe('Dashboard page', () => {
.should('have.attr', 'src')
.should(
'include',
'https://s3.eu-west-3.amazonaws.com/typebot/test1/avatar'
`https://s3.eu-west-3.amazonaws.com/typebot/${userIds[0]}/avatar`
)
cy.findByRole('button', { name: 'Save' }).should('exist').click()
cy.wait('@getUpdatedSession')
@ -43,7 +45,7 @@ describe('Dashboard page', () => {
.should('have.attr', 'src')
.should(
'include',
'https://s3.eu-west-3.amazonaws.com/typebot/test1/avatar'
`https://s3.eu-west-3.amazonaws.com/typebot/${userIds[0]}/avatar`
)
cy.findByRole('button', { name: 'Save' }).should('not.exist')
})

View File

@ -1,3 +1,4 @@
import { userIds } from 'cypress/plugins/data'
import {
parseTestTypebot,
preventUserFromRefreshing,
@ -12,7 +13,7 @@ describe('Text bubbles', () => {
parseTestTypebot({
id: 'typebot3',
name: 'Typebot #3',
ownerId: 'test2',
ownerId: userIds[1],
steps: {
byId: {
step1: {

View File

@ -1,3 +1,4 @@
import { userIds } from 'cypress/plugins/data'
import {
parseTestTypebot,
preventUserFromRefreshing,
@ -213,7 +214,7 @@ describe('Button input', () => {
cy.signOut()
})
it('Can edit choice items', () => {
it.only('Can edit choice items', () => {
cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot3/edit')
cy.findByDisplayValue('Click to edit').type('Item 1{enter}')
@ -249,7 +250,15 @@ describe('Button input', () => {
})
it('Single choice targets should work', () => {
//TO-DO
cy.loadTypebotFixtureInDatabase('typebots/singleChoiceTarget.json')
cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot4/edit')
cy.findByRole('button', { name: 'Preview' }).click()
getIframeBody().findByRole('button', { name: 'Burgers' }).click()
getIframeBody().findByText('I love burgers!').should('exist')
cy.findByRole('button', { name: 'Restart' }).click()
getIframeBody().findByRole('button', { name: 'Carpaccio' }).click()
getIframeBody().findByText('Cool!').should('exist')
})
})
@ -259,7 +268,7 @@ const createTypebotWithStep = (step: Omit<InputStep, 'id' | 'blockId'>) => {
parseTestTypebot({
id: 'typebot3',
name: 'Typebot #3',
ownerId: 'test2',
ownerId: userIds[1],
steps: {
byId: {
step1: {