Skip to content

Commit

Permalink
[#3730] cypress connector update (#3731)
Browse files Browse the repository at this point in the history
* fixes

* small fixes

* lint

* removed import
  • Loading branch information
AudreyKj authored Sep 19, 2022
1 parent 0aa93a7 commit be728f9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
8 changes: 7 additions & 1 deletion frontend/control-center/src/pages/Connectors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ const Connectors = (props: ConnectedProps<typeof connector>) => {
} else {
const listArr = [];
catalogListArr.map(component => {
if (component[1]?.name && component[1].installed === true && component[1].source !== 'webhooks') {
if (
component[1] &&
component[1]?.name &&
component[1]?.displayName &&
component[1].installed === true &&
component[1].source !== 'webhooks'
) {
setHasInstalledComponents(true);
listArr.push({
name: component[1].name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {ReactComponent as PlusIcon} from 'assets/images/icons/plus.svg';
import {ReactComponent as CloseIcon} from 'assets/images/icons/close.svg';

import styles from './index.module.scss';
import {cyChannelsFormBackButton} from 'handles';
import {CONNECTORS_ROUTE} from '../../../routes/routes';
import {getChannelAvatar} from '../../../components/ChannelAvatar';
import {useTranslation} from 'react-i18next';
Expand Down Expand Up @@ -81,7 +80,7 @@ const ChannelsList = () => {

return (
<div className={styles.wrapper}>
<LinkButton dataCy={cyChannelsFormBackButton} onClick={() => navigate(-1)} type="button">
<LinkButton onClick={() => navigate(-1)} type="button">
<div className={styles.linkButtonContainer}>
<ArrowLeftIcon className={styles.backIcon} />
{connectorsRoute ? t('channelsCapital') : ''}
Expand Down
5 changes: 4 additions & 1 deletion frontend/control-center/src/services/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ const capitalize = (str: string) => {

export const removePrefix = (name: string) => name.split('/').pop();

export const formatComponentNameToConfigKey = (componentName: string) => componentName.split('/')[1];
export const formatComponentNameToConfigKey = (componentName: string) => {
if (!componentName) return null;
return componentName.split('/')[1];
};
7 changes: 0 additions & 7 deletions frontend/inbox/handles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export const cyTagsTableRowDisplayDeleteModalButton = 'tagsTableRowDisplayDelete
export const cyConnectorAddButton = 'connectorAddButton';
export const cyAddChannelButton = 'addChannelButton';

export const cyChannelsChatPluginAddButton = 'channelsChatPluginAddButton';
export const cyChannelsFacebookAddButton = 'channelsFacebookAddButton';
export const cyChannelsTwilioSmsAddButton = 'channelsTwilioSmsAddButton';
export const cyChannelsTwilioWhatsappAddButton = 'channelsTwilioWhatsappAddButton';
export const cyChannelsGoogleAddButton = 'channelsGoogleAddButton';

export const cyChannelsChatPluginList = 'channelsChatPluginList';
export const cyChannelsFacebookList = 'channelsFacebookList';
export const cyChannelsTwilioSmsList = 'channelsTwilioSmsList';
Expand All @@ -39,7 +33,6 @@ export const cyConnectorsAddNewButton = 'connectorsAddNewButton';
export const cyChannelsChatPluginFormNameInput = 'channelsChatPluginFormNameInput';
export const cyChannelsChatPluginFormSubmitButton = 'channelsChatPluginFormSubmitButton';
export const cyChannelCreatedChatPluginCloseButton = 'channelCreatedChatPluginCloseButton';
export const cyChannelsFormBackButton = 'channelsFormBackButton';

export const cyOpenStateButton = 'openStateButton';
export const cyClosedStateButton = 'closedStateButton';
Expand Down
9 changes: 4 additions & 5 deletions integration/support/createChatPluginConversation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
cyChannelsChatPluginAddButton,
cyAddChannelButton,
cyConnectorsAddNewButton,
cyChannelsChatPluginFormNameInput,
cyChannelsChatPluginFormSubmitButton,
cyChannelsChatPluginList,
cyChannelsFormBackButton,
cyChannelCreatedChatPluginCloseButton,
} from 'handles';
import {cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles';

export const connectChatPluginConnector = (): void => {
cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click();
cy.get(`[data-cy=${cyConnectorsAddNewButton}]`).first().click({force: true});
cy.get(`[data-cy=${cyAddChannelButton}]`).click();
cy.wait(500);
cy.get(`[data-cy=${cyConnectorsAddNewButton}]`).click({force: true});
cy.wait(500);
cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName'), {force: true});
cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click();
Expand All @@ -23,7 +23,6 @@ export const createChatPluginConversation = (): void => {
cy.wait(500);
cy.connectChatPluginConnector();

cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click();
cy.wait(500);
cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`);

Expand Down
4 changes: 2 additions & 2 deletions integration/ui/connect_chatplugin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {cyChannelsFormBackButton, cyChannelsChatPluginList} from 'handles';
import {cyChannelsChatPluginList} from 'handles';

declare global {
namespace Cypress {
Expand All @@ -20,7 +20,7 @@ describe('Connect chatplugin channel', () => {
cy.connectChatPluginConnector();

cy.url().should('include', '/control-center/connectors');
cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click();

cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`);
});
});
12 changes: 12 additions & 0 deletions lib/typescript/translations/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ const resources = {
//Inbox
frontendinboxDescription: 'An Inbox to view and organize all your conversations.',

//AiryContacts
airyContactsDescription: 'View and manage contacts for personalized interactions.',

//Connectors
connectors: 'Connectors',
noResults: 'Result not found.',
Expand Down Expand Up @@ -860,6 +863,9 @@ const resources = {
//Inbox
frontendinboxDescription: 'Ein Inbox zum Anzeigen und Organisieren aller Ihrer Konversationen.',

//AiryContacts
airyContactsDescription: 'Anzeigen und Verwalten von Kontakten für personalisierte Interaktionen.',

//Facebook Messenger
connectMessenger: 'Messenger verbinden',
facebookConfiguration: 'Die Facebook-Quelle erfordert die folgende Konfiguration:',
Expand Down Expand Up @@ -1426,6 +1432,9 @@ const resources = {
//Inbox
frontendinboxDescription: 'Une boîte de réception pour afficher et organiser toutes vos conversations.',

//AiryContacts
airyContactsDescription: 'Un outil de gestion de contacts pour des conversations personnalisées',

//Connectors
connectors: 'Connecteurs',
noResults: 'Résultat non trouvé.',
Expand Down Expand Up @@ -1931,6 +1940,9 @@ const resources = {
//Inbox
frontendinboxDescription: 'Una bandeja de entrada para ver y organizar todas tus conversaciones.',

//AiryContacts
airyContactsDescription: 'Administre contactos para interacciones personalizadas.',

//Connectors
connectors: 'Conectores',
noResults: 'Resultado no encontrado.',
Expand Down

0 comments on commit be728f9

Please sign in to comment.