2
0

fix(tests): 💚 Fix tests

This commit is contained in:
Baptiste Arnaud
2022-01-19 14:41:42 +01:00
parent 3506d86d50
commit ab34f95cce
5 changed files with 58 additions and 60 deletions

View File

@@ -78,7 +78,7 @@ export const InputWithVariableButton = ({
bgColor={'white'} bgColor={'white'}
/> />
<InputRightElement> <InputRightElement>
<Popover matchWidth isLazy> <Popover matchWidth isLazy closeOnBlur={false}>
<PopoverTrigger> <PopoverTrigger>
<IconButton <IconButton
aria-label="Insert a variable" aria-label="Insert a variable"

View File

@@ -111,62 +111,60 @@ export const VariableSearchInput = ({
{...inputProps} {...inputProps}
/> />
</PopoverTrigger> </PopoverTrigger>
<Portal> <PopoverContent
<PopoverContent maxH="35vh"
maxH="35vh" overflowY="scroll"
overflowY="scroll" spacing="0"
spacing="0" role="menu"
role="menu" w="inherit"
w="inherit" shadow="lg"
shadow="lg" >
> {(inputValue?.length ?? 0) > 0 &&
{(inputValue?.length ?? 0) > 0 && !isDefined(variables.find((v) => v.name === inputValue)) && (
!isDefined(variables.find((v) => v.name === inputValue)) && ( <Button
<Button role="menuitem"
role="menuitem" minH="40px"
minH="40px" onClick={handleCreateNewVariableClick}
onClick={handleCreateNewVariableClick} fontSize="16px"
fontSize="16px" fontWeight="normal"
fontWeight="normal" rounded="none"
rounded="none" colorScheme="gray"
colorScheme="gray" variant="ghost"
variant="ghost" justifyContent="flex-start"
justifyContent="flex-start" leftIcon={<PlusIcon />}
leftIcon={<PlusIcon />} >
> Create "{inputValue}"
Create "{inputValue}" </Button>
</Button>
)}
{filteredItems.length > 0 && (
<>
{filteredItems.map((item, idx) => {
return (
<Button
role="menuitem"
minH="40px"
key={idx}
onClick={handleVariableNameClick(item)}
fontSize="16px"
fontWeight="normal"
rounded="none"
colorScheme="gray"
variant="ghost"
justifyContent="space-between"
>
{item.name}
<IconButton
icon={<TrashIcon />}
aria-label="Remove variable"
size="xs"
onClick={handleDeleteVariableClick(item)}
/>
</Button>
)
})}
</>
)} )}
</PopoverContent> {filteredItems.length > 0 && (
</Portal> <>
{filteredItems.map((item, idx) => {
return (
<Button
role="menuitem"
minH="40px"
key={idx}
onClick={handleVariableNameClick(item)}
fontSize="16px"
fontWeight="normal"
rounded="none"
colorScheme="gray"
variant="ghost"
justifyContent="space-between"
>
{item.name}
<IconButton
icon={<TrashIcon />}
aria-label="Remove variable"
size="xs"
onClick={handleDeleteVariableClick(item)}
/>
</Button>
)
})}
</>
)}
</PopoverContent>
</Popover> </Popover>
</Flex> </Flex>
) )

View File

@@ -15,7 +15,7 @@ describe('Google Analytics', () => {
}) })
}) })
it.only('can be filled correctly', () => { it('can be filled correctly', () => {
cy.signIn('test2@gmail.com') cy.signIn('test2@gmail.com')
cy.visit('/typebots/typebot3/edit') cy.visit('/typebots/typebot3/edit')
cy.intercept({ cy.intercept({

View File

@@ -32,7 +32,7 @@ describe('Google sheets', () => {
cy.findByRole('button', { name: 'Insert a variable' }).click() cy.findByRole('button', { name: 'Insert a variable' }).click()
cy.findByRole('menuitem', { name: 'Email' }).click() cy.findByRole('menuitem', { name: 'Email' }).click()
cy.findByRole('button', { name: 'Add' }).click() cy.findByRole('button', { name: 'Add a value' }).click()
cy.findByRole('button', { name: 'Select a column' }).click() cy.findByRole('button', { name: 'Select a column' }).click()
cy.findByRole('menuitem', { name: 'First name' }).click() cy.findByRole('menuitem', { name: 'First name' }).click()
@@ -106,7 +106,7 @@ describe('Google sheets', () => {
cy.findByRole('menuitem', { name: 'First name' }).click() cy.findByRole('menuitem', { name: 'First name' }).click()
createNewVar('First name') createNewVar('First name')
cy.findByRole('button', { name: 'Add' }).click() cy.findByRole('button', { name: 'Add a value' }).click()
cy.findByRole('button', { name: 'Select a column' }).click() cy.findByRole('button', { name: 'Select a column' }).click()
cy.findByRole('menuitem', { name: 'Last name' }).click() cy.findByRole('menuitem', { name: 'Last name' }).click()

View File

@@ -64,7 +64,7 @@ describe('Condition step', () => {
cy.findByRole('menuitem', { name: 'Greater than' }).click() cy.findByRole('menuitem', { name: 'Greater than' }).click()
cy.findByPlaceholderText('Type a value...').type('80') cy.findByPlaceholderText('Type a value...').type('80')
cy.findByRole('button', { name: 'Add' }).click() cy.findByRole('button', { name: 'Add a comparison' }).click()
cy.findAllByTestId('variables-input').last().click() cy.findAllByTestId('variables-input').last().click()
cy.findByRole('menuitem', { name: 'Age' }).click() cy.findByRole('menuitem', { name: 'Age' }).click()
cy.findByRole('button', { name: 'Equal to' }).click() cy.findByRole('button', { name: 'Equal to' }).click()