2
0

feat(inputs): Add Phone number input

This commit is contained in:
Baptiste Arnaud
2022-01-10 10:43:27 +01:00
parent 8cba7ff37b
commit b20bcb1408
19 changed files with 218 additions and 10 deletions

View File

@ -144,7 +144,7 @@ describe('Date input', () => {
cy.signOut()
})
it.only('options should work', () => {
it('options should work', () => {
cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot3/edit')
cy.findByRole('button', { name: 'Preview' }).click()
@ -172,6 +172,41 @@ describe('Date input', () => {
})
})
describe('Phone number input', () => {
beforeEach(() => {
cy.task('seed')
cy.log(JSON.stringify({ type: InputStepType.PHONE }))
createTypebotWithStep({ type: InputStepType.PHONE })
cy.signOut()
})
it('options should work', () => {
cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot3/edit')
cy.findByRole('button', { name: 'Preview' }).click()
getIframeBody()
.findByPlaceholderText('Your phone number...')
.should('have.attr', 'type')
.should('eq', 'tel')
getIframeBody().findByRole('button', { name: 'Send' }).should('be.disabled')
cy.findByTestId('step-step1').click({ force: true })
cy.findByRole('textbox', { name: 'Placeholder:' })
.clear()
.type('+33 XX XX XX XX')
cy.findByRole('textbox', { name: 'Button label:' }).clear().type('Go')
cy.findByRole('button', { name: 'Restart' }).click()
getIframeBody()
.findByPlaceholderText('+33 XX XX XX XX')
.type('+33 6 73 18 45 36')
getIframeBody()
.findByRole('img')
.should('have.attr', 'alt')
.should('eq', 'France')
getIframeBody().findByRole('button', { name: 'Go' }).click()
getIframeBody().findByText('+33673184536').should('exist')
})
})
const createTypebotWithStep = (step: Omit<InputStep, 'id' | 'blockId'>) => {
cy.task(
'createTypebot',