Skip to content

Commit

Permalink
fix(tests): 💚 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jan 19, 2022
1 parent 3506d86 commit ab34f95
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 60 deletions.
2 changes: 1 addition & 1 deletion apps/builder/components/shared/InputWithVariableButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const InputWithVariableButton = ({
bgColor={'white'}
/>
<InputRightElement>
<Popover matchWidth isLazy>
<Popover matchWidth isLazy closeOnBlur={false}>
<PopoverTrigger>
<IconButton
aria-label="Insert a variable"
Expand Down
108 changes: 53 additions & 55 deletions apps/builder/components/shared/VariableSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,62 +111,60 @@ export const VariableSearchInput = ({
{...inputProps}
/>
</PopoverTrigger>
<Portal>
<PopoverContent
maxH="35vh"
overflowY="scroll"
spacing="0"
role="menu"
w="inherit"
shadow="lg"
>
{(inputValue?.length ?? 0) > 0 &&
!isDefined(variables.find((v) => v.name === inputValue)) && (
<Button
role="menuitem"
minH="40px"
onClick={handleCreateNewVariableClick}
fontSize="16px"
fontWeight="normal"
rounded="none"
colorScheme="gray"
variant="ghost"
justifyContent="flex-start"
leftIcon={<PlusIcon />}
>
Create "{inputValue}"
</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
maxH="35vh"
overflowY="scroll"
spacing="0"
role="menu"
w="inherit"
shadow="lg"
>
{(inputValue?.length ?? 0) > 0 &&
!isDefined(variables.find((v) => v.name === inputValue)) && (
<Button
role="menuitem"
minH="40px"
onClick={handleCreateNewVariableClick}
fontSize="16px"
fontWeight="normal"
rounded="none"
colorScheme="gray"
variant="ghost"
justifyContent="flex-start"
leftIcon={<PlusIcon />}
>
Create "{inputValue}"
</Button>
)}
</PopoverContent>
</Portal>
{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>
</Popover>
</Flex>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/cypress/tests/integrations/googleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Google Analytics', () => {
})
})

it.only('can be filled correctly', () => {
it('can be filled correctly', () => {
cy.signIn('[email protected]')
cy.visit('/typebots/typebot3/edit')
cy.intercept({
Expand Down
4 changes: 2 additions & 2 deletions apps/builder/cypress/tests/integrations/googleSheets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Google sheets', () => {
cy.findByRole('button', { name: 'Insert a variable' }).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('menuitem', { name: 'First name' }).click()
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Google sheets', () => {
cy.findByRole('menuitem', { name: 'First name' }).click()
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('menuitem', { name: 'Last name' }).click()
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/cypress/tests/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Condition step', () => {
cy.findByRole('menuitem', { name: 'Greater than' }).click()
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.findByRole('menuitem', { name: 'Age' }).click()
cy.findByRole('button', { name: 'Equal to' }).click()
Expand Down

0 comments on commit ab34f95

Please sign in to comment.