From 0bbf0bd082b828834f9ba0fc97cf51a10c899182 Mon Sep 17 00:00:00 2001 From: Pascal Holy Date: Thu, 18 Mar 2021 10:39:55 +0100 Subject: [PATCH 01/13] =?UTF-8?q?[#1272]=20Make=20Cypress=20tests=20indepe?= =?UTF-8?q?ndent=20from=20each=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …other From d3888baf7f2c881092a5b97e5d1c98c7d8e0a0ef Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Wed, 17 Mar 2021 18:05:30 +0100 Subject: [PATCH 02/13] initial commit --- frontend/ui/handles/index.ts | 3 +++ integration/ui/create_ui_conversation.spec.ts | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 integration/ui/create_ui_conversation.spec.ts diff --git a/frontend/ui/handles/index.ts b/frontend/ui/handles/index.ts index c3232668be..d7d004fa86 100644 --- a/frontend/ui/handles/index.ts +++ b/frontend/ui/handles/index.ts @@ -24,3 +24,6 @@ export const cyChannelsChatPluginConnectButton = 'channelsChatPluginConnectButto export const cyChannelsChatPluginFormNameInput = 'channelsChatPluginFormNameInput'; export const cyChannelsChatPluginFormSubmitButton = 'channelsChatPluginFormSubmitButton'; export const cyChannelsChatPluginFormBackButton = 'channelsChatPluginFormBackButton'; +export const cyBubble = 'bubble'; +export const cyInputbarTextarea = 'inputbarTextarea'; +export const cyInputbarButton = 'inputbarButton'; diff --git a/integration/ui/create_ui_conversation.spec.ts b/integration/ui/create_ui_conversation.spec.ts new file mode 100644 index 0000000000..ca6ab8bb3a --- /dev/null +++ b/integration/ui/create_ui_conversation.spec.ts @@ -0,0 +1,19 @@ +import {cyBubble, cyInputbarTextarea, cyInputbarButton} from 'handles'; + +describe( + 'Create UI Conversation', + { + baseUrl: 'http://airy.core/chatplugin/ui', + }, + () => { + const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; + const messageChatplugin = 'Hello from Inbox!'; + + it('Creates a chat plugin conversation', () => { + cy.visit('/example?channel_id=' + channelId); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(messageChatplugin); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); + }); + } +); From 18836f3be14f4702dc6f57ca91c6642607a52c74 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Fri, 19 Mar 2021 11:52:03 +0100 Subject: [PATCH 03/13] resolve conflict --- frontend/ui/src/pages/Tags/TableRow.tsx | 12 ++++ frontend/ui/src/pages/Tags/index.tsx | 11 ++++ .../chat-plugin/create_conversation.spec.ts | 2 +- integration/cypress.json | 10 +++- integration/ui/BUILD | 4 ++ integration/ui/create_tag.spec.ts | 59 ++++++++++++++----- integration/ui/filtering.spec.ts | 35 +++++++++-- .../ui/send_chatplugin_message.spec.ts | 33 ++++++++--- 8 files changed, 135 insertions(+), 31 deletions(-) diff --git a/frontend/ui/src/pages/Tags/TableRow.tsx b/frontend/ui/src/pages/Tags/TableRow.tsx index 3bab69299b..574a965295 100644 --- a/frontend/ui/src/pages/Tags/TableRow.tsx +++ b/frontend/ui/src/pages/Tags/TableRow.tsx @@ -11,6 +11,10 @@ import Tag from '../../components/Tag'; import {Tag as TagModel, TagColor} from 'httpclient'; import {Settings} from '../../reducers/data/settings'; import {StateModel} from '../../reducers'; +<<<<<<< HEAD +======= +import {cyTagsTableRowDisplayDeleteModal} from 'handles'; +>>>>>>> 7c74e61b (independent test for filter and sending messages) type TableRowProps = { tag: TagModel; @@ -136,7 +140,15 @@ const TableRowComponent = (props: TableRowProps) => { +<<<<<<< HEAD diff --git a/frontend/ui/src/pages/Tags/index.tsx b/frontend/ui/src/pages/Tags/index.tsx index 6b04049ac4..8a6a83e529 100644 --- a/frontend/ui/src/pages/Tags/index.tsx +++ b/frontend/ui/src/pages/Tags/index.tsx @@ -16,6 +16,10 @@ import SimpleTagForm from './SimpleTagForm'; import EmptyStateTags from './EmptyStateTags'; import {StateModel} from '../../reducers'; import {setPageTitle} from '../../services/pageTitle'; +<<<<<<< HEAD +======= +import {cyTagsTableRowDisplayDeleteModalInput, cyTagsTableRowDisplayDeleteModalButton} from 'handles'; +>>>>>>> 7c74e61b (independent test for filter and sending messages) const initialState = { modal: { @@ -145,7 +149,14 @@ class Tags extends Component, typeof initialSta

{this.state.modal.error}

Cancel +<<<<<<< HEAD
diff --git a/integration/chat-plugin/create_conversation.spec.ts b/integration/chat-plugin/create_conversation.spec.ts index f2dd56cf59..6ea23e1950 100644 --- a/integration/chat-plugin/create_conversation.spec.ts +++ b/integration/chat-plugin/create_conversation.spec.ts @@ -6,7 +6,7 @@ describe( baseUrl: 'http://airy.core/chatplugin/ui', }, () => { - const channelId = 'bbeff18c-6517-5506-b464-8353b8923d46'; + const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; const messageChatplugin = 'Hello from Chatplugin!'; it('Creates a chat plugin conversation', () => { diff --git a/integration/cypress.json b/integration/cypress.json index 6caec1879c..6fb3a61b97 100644 --- a/integration/cypress.json +++ b/integration/cypress.json @@ -3,8 +3,14 @@ "integrationFolder": "integration", "testFiles": "**/*.spec.?s", "env": { - "username": "grace@example.com", - "password": "the_answer_is_42" + "username": "grace@example.com", + "password": "the_answer_is_42", + "chatPluginName": "Cypress Chatplugin", + "tagName": "Cypress Tag", + "searchQuery": "Cypress Filter", + "messageInbox": "Hello from Cypress Inbox!", + "messageChatplugin": "Hello from Cypress Chatplugin!", + "channelId": "3502a0a7-933d-5410-b5fc-51f041146d89" }, "viewportHeight": 800, "viewportWidth": 1280 diff --git a/integration/ui/BUILD b/integration/ui/BUILD index 04ab97277b..ea909f055b 100644 --- a/integration/ui/BUILD +++ b/integration/ui/BUILD @@ -4,6 +4,10 @@ ts_web_library( name = "specs", srcs = glob(["*.spec.ts"]), deps = [ +<<<<<<< HEAD +======= + "//frontend/chat-plugin/handles:chat-plugin-handles", +>>>>>>> 7c74e61b (independent test for filter and sending messages) "//frontend/ui/handles", "@npm//cypress", ], diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index 1d696c912a..f0f2dd4d9b 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -5,25 +5,52 @@ import { cyTagsDialogColorSelectorRed, cyTagsSearchField, cyTagsTable, + cyChannelsChatPluginAddButton, + cyChannelsChatPluginConnectButton, + cyChannelsChatPluginFormNameInput, + cyChannelsChatPluginFormSubmitButton, + cyChannelsChatPluginFormBackButton, + cyTagsTableRowDisplayDeleteModal, + cyTagsTableRowDisplayDeleteModalInput, + cyTagsTableRowDisplayDeleteModalButton, } from 'handles'; -const tagName = 'prio'; +describe('Creates and Deletes Tag', () => { + it('Login', () => { + cy.visit('/login'); + cy.get('form') + .within(() => { + cy.get('input[type=email]').type(Cypress.env('username')); + cy.get('input[type=password]').type(Cypress.env('password')); + }) + .submit(); -it('Creates a tag', () => { - cy.visit('/login'); - cy.get('form') - .within(() => { - cy.get('input[type=email]').type(Cypress.env('username')); - cy.get('input[type=password]').type(Cypress.env('password')); - }) - .submit(); + cy.wait(500); - cy.get(`[data-cy=${cyShowTagsDialog}]`).click(); - cy.get(`[data-cy=${cyTagsDialogInput}]`).type(tagName); - cy.get(`[data-cy=${cyTagsDialogColorSelectorRed}]`).check({force: true}); - cy.get(`[data-cy=${cyTagsDialogButton}]`).click(); + cy.visit('/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); - cy.visit('/tags'); - cy.get(`[data-cy=${cyTagsSearchField}]`).type(tagName); - cy.get(`[data-cy=${cyTagsTable}]`).children().children().its('length').should('be.gte', 2); + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); + + cy.visit('/'); + cy.get(`[data-cy=${cyShowTagsDialog}]`).click(); + cy.get(`[data-cy=${cyTagsDialogInput}]`).type(Cypress.env('tagName')); + cy.get(`[data-cy=${cyTagsDialogColorSelectorRed}]`).check({force: true}); + cy.get(`[data-cy=${cyTagsDialogButton}]`).click(); + + cy.visit('/tags'); + cy.get(`[data-cy=${cyTagsSearchField}]`).type(Cypress.env('tagName')); + cy.get(`[data-cy=${cyTagsTable}]`).children().children().its('length').should('be.gte', 2); + cy.get(`[data-cy=${cyTagsTable}]`).children().children(); + cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModal}]`).click(); + cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModalInput}]`).type('DELETE'); + cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModalButton}]`).click(); + }); }); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filtering.spec.ts index b0fc37af7e..e2391f9f02 100644 --- a/integration/ui/filtering.spec.ts +++ b/integration/ui/filtering.spec.ts @@ -1,9 +1,20 @@ -import {cySearchButton, cySearchField, cyConversationList} from 'handles'; +import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; +import { + cySearchButton, + cySearchField, + cyConversationList, + cyChannelsChatPluginAddButton, + cyChannelsChatPluginConnectButton, + cyChannelsChatPluginFormNameInput, + cyChannelsChatPluginFormSubmitButton, + cyChannelsChatPluginFormBackButton, +} from 'handles'; -describe('Login', () => { - it('Filters conversation', () => { - const searchQuery = 'Inbox'; +describe('Filters conversation', () => { + const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; + const messageChatplugin = 'Hello from Cypress Inbox!'; + it('Login', () => { cy.visit('/login'); cy.get('form') .within(() => { @@ -12,12 +23,26 @@ describe('Login', () => { }) .submit(); + cy.wait(500); + + cy.visit('/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + + // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); + // cy.get(`[data-cy=${cyBubble}]`).click(); + // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('/'); cy.url().should('include', '/conversations'); cy.get(`[data-cy=${cyConversationList}]`).children().children().children().its('length').should('gte', 1); cy.get(`[data-cy=${cySearchButton}]`).click(); - cy.get(`[data-cy=${cySearchField}]`).get('input').type(searchQuery); + cy.get(`[data-cy=${cySearchField}]`).get('input').type(Cypress.env('searchQuery')); cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); }); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index 770beefdd0..eeed0d3583 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -1,8 +1,16 @@ -import {cyMessageTextArea, cyMessageSendButton, cyMessageList} from 'handles'; +import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; +import { + cyMessageTextArea, + cyMessageSendButton, + cyMessageList, + cyChannelsChatPluginAddButton, + cyChannelsChatPluginConnectButton, + cyChannelsChatPluginFormNameInput, + cyChannelsChatPluginFormSubmitButton, + cyChannelsChatPluginFormBackButton, +} from 'handles'; describe('Send chatplugin Message', () => { - const messageInbox = 'Hello from Inbox!'; - it('Logs into the UI', () => { cy.visit('/login'); @@ -13,11 +21,22 @@ describe('Send chatplugin Message', () => { }) .submit(); - cy.url().should('include', '/inbox'); - }); + cy.wait(500); - it('Opens conversation and sends reply in Inbox', () => { - cy.get(`[data-cy=${cyMessageTextArea}]`).type(messageInbox); + cy.visit('/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + + // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); + // cy.get(`[data-cy=${cyBubble}]`).click(); + // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('/'); + cy.url().should('include', '/inbox'); + cy.get(`[data-cy=${cyMessageTextArea}]`).type(Cypress.env('messageInbox')); cy.get(`[data-cy=${cyMessageSendButton}]`).click(); cy.get(`[data-cy=${cyMessageList}]`).children().its('length').should('be.gte', 1); }); From 4169c0a18627a72426f4221c6b3aef07adb51bbb Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Fri, 19 Mar 2021 18:55:31 +0100 Subject: [PATCH 04/13] Fixed failing test --- frontend/ui/handles/index.ts | 19 +++++++++----- .../ConnectedChannelsBySourceCard/index.tsx | 8 +++--- .../ui/src/pages/Channels/MainPage/index.tsx | 25 ++++++++++++++++++- .../SourceTypeDescriptionCard/index.tsx | 6 ++++- frontend/ui/src/pages/Tags/TableRow.tsx | 7 ------ frontend/ui/src/pages/Tags/index.tsx | 8 +----- integration/cypress.json | 2 +- integration/ui/connect_chatplugin.spec.ts | 13 +++++----- integration/ui/create_tag.spec.ts | 13 ++++++---- integration/ui/filtering.spec.ts | 8 +++--- .../ui/send_chatplugin_message.spec.ts | 5 +++- 11 files changed, 70 insertions(+), 44 deletions(-) diff --git a/frontend/ui/handles/index.ts b/frontend/ui/handles/index.ts index d7d004fa86..f795c62fd9 100644 --- a/frontend/ui/handles/index.ts +++ b/frontend/ui/handles/index.ts @@ -2,13 +2,10 @@ export const cyMessageList = 'messageList'; export const cyInputBar = 'inputBar'; export const cyMessageTextArea = 'messageTextArea'; export const cyMessageSendButton = 'messageSendButton'; - export const cySearchButton = 'searchButton'; export const cySearchField = 'searchField'; export const cySearchFieldBackButton = 'searchFieldBackButton'; - export const cyConversationList = 'conversationList'; - export const cyShowTagsDialog = 'showTagsDialog'; export const cyTagsDialogInput = 'tagsDialogInput'; export const cyTagsDialogButton = 'tagsDialogButton'; @@ -18,12 +15,22 @@ export const cyTagsDialogColorSelectorGreen = 'tagsDialogColorSelectorGreen'; export const cyTagsDialogColorSelectorPurple = 'tagsDialogColorSelectorPurple'; export const cyTagsSearchField = 'tagsSearchField'; export const cyTagsTable = 'tagsTable'; +export const cyTagsTableRowDisplayDeleteModal = 'tagsTableRowDisplayDeleteModal'; +export const cyTagsTableRowDisplayDeleteModalInput = 'tagsTableRowDisplayDeleteModalInput'; +export const cyTagsTableRowDisplayDeleteModalButton = 'tagsTableRowDisplayDeleteModalButton'; + 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'; +export const cyChannelsTwilioWhatsappList = 'channelsTwilioWhatsappList'; +export const cyChannelsGoogleList = 'channelsGoogleList'; + export const cyChannelsChatPluginConnectButton = 'channelsChatPluginConnectButton'; export const cyChannelsChatPluginFormNameInput = 'channelsChatPluginFormNameInput'; export const cyChannelsChatPluginFormSubmitButton = 'channelsChatPluginFormSubmitButton'; export const cyChannelsChatPluginFormBackButton = 'channelsChatPluginFormBackButton'; -export const cyBubble = 'bubble'; -export const cyInputbarTextarea = 'inputbarTextarea'; -export const cyInputbarButton = 'inputbarButton'; diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx index ea8d1fe07a..d69455a6aa 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx @@ -13,12 +13,10 @@ type ConnectedChannelsBySourceCardProps = { sourceTypeInfo: SourceTypeInfo; channels: Channel[]; connected: string; - dataCyAddChannelButton?: string; - dataCyChannelList?: string; }; const ConnectedChannelsBySourceCard = (props: ConnectedChannelsBySourceCardProps & RouteComponentProps) => { - const {sourceTypeInfo, channels, dataCyChannelList, dataCyAddChannelButton} = props; + const {sourceTypeInfo, channels} = props; const hasExtraChannels = channels.length > sourceTypeInfo.channelsToShow; @@ -35,7 +33,7 @@ const ConnectedChannelsBySourceCard = (props: ConnectedChannelsBySourceCardProps
props.history.push(sourceTypeInfo.channelsListRoute)}> -
+
{channels.slice(0, sourceTypeInfo.channelsToShow).map((channel: Channel) => { return (
  • @@ -76,7 +74,7 @@ const ConnectedChannelsBySourceCard = (props: ConnectedChannelsBySourceCardProps type="button" className={styles.addChannelButton} onClick={() => props.history.push(sourceTypeInfo.newChannelRoute)} - data-cy={dataCyAddChannelButton}> + data-cy={sourceTypeInfo.dataCyAddChannelButton}>
    diff --git a/frontend/ui/src/pages/Channels/MainPage/index.tsx b/frontend/ui/src/pages/Channels/MainPage/index.tsx index 7a6dd44153..385b87c88d 100644 --- a/frontend/ui/src/pages/Channels/MainPage/index.tsx +++ b/frontend/ui/src/pages/Channels/MainPage/index.tsx @@ -14,7 +14,18 @@ import {ReactComponent as WhatsappLogo} from 'assets/images/icons/whatsapp_avata import {ReactComponent as GoogleAvatarIcon} from 'assets/images/icons/google_avatar.svg'; import styles from './index.module.scss'; - +import { + cyChannelsChatPluginAddButton, + cyChannelsChatPluginList, + cyChannelsFacebookAddButton, + cyChannelsFacebookList, + cyChannelsGoogleAddButton, + cyChannelsGoogleList, + cyChannelsTwilioSmsAddButton, + cyChannelsTwilioSmsList, + cyChannelsTwilioWhatsappAddButton, + cyChannelsTwilioWhatsappList, +} from 'handles'; import { CHANNELS_FACEBOOK_ROUTE, CHANNELS_TWILIO_SMS_ROUTE, @@ -38,6 +49,8 @@ export type SourceTypeInfo = { configKey: string; channelsToShow: number; itemInfoString: string; + dataCyAddChannelButton: string; + dataCyChannelList: string; }; const sourceTypesInfo: SourceTypeInfo[] = [ @@ -51,6 +64,8 @@ const sourceTypesInfo: SourceTypeInfo[] = [ configKey: 'sources-chatplugin', channelsToShow: 4, itemInfoString: 'channels', + dataCyAddChannelButton: cyChannelsChatPluginAddButton, + dataCyChannelList: cyChannelsChatPluginList, }, { type: SourceType.facebook, @@ -62,6 +77,8 @@ const sourceTypesInfo: SourceTypeInfo[] = [ configKey: 'sources-facebook', channelsToShow: 4, itemInfoString: 'channels', + dataCyAddChannelButton: cyChannelsFacebookAddButton, + dataCyChannelList: cyChannelsFacebookList, }, { type: SourceType.twilioSMS, @@ -73,6 +90,8 @@ const sourceTypesInfo: SourceTypeInfo[] = [ configKey: 'sources-twilio', channelsToShow: 2, itemInfoString: 'phones', + dataCyAddChannelButton: cyChannelsTwilioSmsAddButton, + dataCyChannelList: cyChannelsTwilioSmsList, }, { type: SourceType.twilioWhatsapp, @@ -84,6 +103,8 @@ const sourceTypesInfo: SourceTypeInfo[] = [ configKey: 'sources-twilio', channelsToShow: 2, itemInfoString: 'phones', + dataCyAddChannelButton: cyChannelsTwilioWhatsappAddButton, + dataCyChannelList: cyChannelsTwilioWhatsappList, }, { type: SourceType.google, @@ -95,6 +116,8 @@ const sourceTypesInfo: SourceTypeInfo[] = [ configKey: 'sources-google', channelsToShow: 4, itemInfoString: 'channels', + dataCyAddChannelButton: cyChannelsGoogleAddButton, + dataCyChannelList: cyChannelsGoogleList, }, ]; diff --git a/frontend/ui/src/pages/Channels/SourceTypeDescriptionCard/index.tsx b/frontend/ui/src/pages/Channels/SourceTypeDescriptionCard/index.tsx index 9a396bd34a..46700fd421 100644 --- a/frontend/ui/src/pages/Channels/SourceTypeDescriptionCard/index.tsx +++ b/frontend/ui/src/pages/Channels/SourceTypeDescriptionCard/index.tsx @@ -27,7 +27,11 @@ const SourceTypeDescriptionCard = (props: SourceTypeDescriptionCardProps) => { {displayButton && (
    - -<<<<<<< HEAD -
    diff --git a/frontend/ui/src/pages/Tags/index.tsx b/frontend/ui/src/pages/Tags/index.tsx index 8a6a83e529..bb6ee1b589 100644 --- a/frontend/ui/src/pages/Tags/index.tsx +++ b/frontend/ui/src/pages/Tags/index.tsx @@ -16,10 +16,7 @@ import SimpleTagForm from './SimpleTagForm'; import EmptyStateTags from './EmptyStateTags'; import {StateModel} from '../../reducers'; import {setPageTitle} from '../../services/pageTitle'; -<<<<<<< HEAD -======= import {cyTagsTableRowDisplayDeleteModalInput, cyTagsTableRowDisplayDeleteModalButton} from 'handles'; ->>>>>>> 7c74e61b (independent test for filter and sending messages) const initialState = { modal: { @@ -145,18 +142,15 @@ class Tags extends Component, typeof initialSta onChange={this.handleDelete} onKeyDown={this.keyPressed} autoFocus={true} + dataCy={cyTagsTableRowDisplayDeleteModalInput} />

    {this.state.modal.error}

    Cancel -<<<<<<< HEAD -
    diff --git a/integration/cypress.json b/integration/cypress.json index 6fb3a61b97..be975f8f0d 100644 --- a/integration/cypress.json +++ b/integration/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://airy.core/ui", + "baseUrl": "http://localhost:8080/ui", "integrationFolder": "integration", "testFiles": "**/*.spec.?s", "env": { diff --git a/integration/ui/connect_chatplugin.spec.ts b/integration/ui/connect_chatplugin.spec.ts index d4f89fb6e1..26bad9b81c 100644 --- a/integration/ui/connect_chatplugin.spec.ts +++ b/integration/ui/connect_chatplugin.spec.ts @@ -20,16 +20,17 @@ describe('Connect chatplugin channel', () => { }) .submit(); - cy.url().should('include', '/inbox'); cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(chatPluginName); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`) - .children() - .filter(`:contains(${chatPluginName})`) - .should('have.length', 1); + // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + // cy.get(`[data-cy=${cyChannelsChatPluginList}]`) + // .children() + // .filter(`:contains(${chatPluginName})`) + // .should('have.length', 1); }); }); diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index f0f2dd4d9b..a53b2f3039 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -28,16 +28,18 @@ describe('Creates and Deletes Tag', () => { cy.wait(500); cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); - cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); - cy.get(`[data-cy=${cyBubble}]`).click(); - cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); - cy.get(`[data-cy=${cyInputbarButton}]`).click(); + // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + // cy.get(`[data-cy=${cyBubble}]`).click(); + // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + // cy.get(`[data-cy=${cyInputbarButton}]`).click(); cy.visit('/'); cy.get(`[data-cy=${cyShowTagsDialog}]`).click(); @@ -46,6 +48,7 @@ describe('Creates and Deletes Tag', () => { cy.get(`[data-cy=${cyTagsDialogButton}]`).click(); cy.visit('/tags'); + cy.wait(500); cy.get(`[data-cy=${cyTagsSearchField}]`).type(Cypress.env('tagName')); cy.get(`[data-cy=${cyTagsTable}]`).children().children().its('length').should('be.gte', 2); cy.get(`[data-cy=${cyTagsTable}]`).children().children(); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filtering.spec.ts index e2391f9f02..bd4607517f 100644 --- a/integration/ui/filtering.spec.ts +++ b/integration/ui/filtering.spec.ts @@ -11,9 +11,6 @@ import { } from 'handles'; describe('Filters conversation', () => { - const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; - const messageChatplugin = 'Hello from Cypress Inbox!'; - it('Login', () => { cy.visit('/login'); cy.get('form') @@ -26,16 +23,19 @@ describe('Filters conversation', () => { cy.wait(500); cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('/'); cy.url().should('include', '/conversations'); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index eeed0d3583..21da1a2a1f 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -24,16 +24,19 @@ describe('Send chatplugin Message', () => { cy.wait(500); cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('/'); cy.url().should('include', '/inbox'); cy.get(`[data-cy=${cyMessageTextArea}]`).type(Cypress.env('messageInbox')); From 884f358d4724d5d3862e422ba879deee260fbb41 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Fri, 19 Mar 2021 21:01:19 +0100 Subject: [PATCH 05/13] add delay to test --- integration/ui/create_tag.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index a53b2f3039..df348db629 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -48,7 +48,6 @@ describe('Creates and Deletes Tag', () => { cy.get(`[data-cy=${cyTagsDialogButton}]`).click(); cy.visit('/tags'); - cy.wait(500); cy.get(`[data-cy=${cyTagsSearchField}]`).type(Cypress.env('tagName')); cy.get(`[data-cy=${cyTagsTable}]`).children().children().its('length').should('be.gte', 2); cy.get(`[data-cy=${cyTagsTable}]`).children().children(); From 641fa1bc205e45b276007740d9424d453375b988 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Fri, 19 Mar 2021 22:41:00 +0100 Subject: [PATCH 06/13] Added test for channel list --- frontend/ui/handles/index.ts | 2 +- .../ConnectedChannelsBySourceCard/index.tsx | 2 +- .../ChannelListItem/index.tsx | 5 +++- .../ui/src/pages/Channels/MainPage/index.tsx | 6 ----- .../Airy/ChatPlugin/ChatPluginConnect.tsx | 3 +-- integration/ui/connect_chatplugin.spec.ts | 9 +++---- integration/ui/create_tag.spec.ts | 8 +++++-- integration/ui/filtering.spec.ts | 24 ++++++++++--------- .../ui/send_chatplugin_message.spec.ts | 22 +++++++++-------- 9 files changed, 41 insertions(+), 40 deletions(-) diff --git a/frontend/ui/handles/index.ts b/frontend/ui/handles/index.ts index f795c62fd9..498d4ce0ad 100644 --- a/frontend/ui/handles/index.ts +++ b/frontend/ui/handles/index.ts @@ -33,4 +33,4 @@ export const cyChannelsGoogleList = 'channelsGoogleList'; export const cyChannelsChatPluginConnectButton = 'channelsChatPluginConnectButton'; export const cyChannelsChatPluginFormNameInput = 'channelsChatPluginFormNameInput'; export const cyChannelsChatPluginFormSubmitButton = 'channelsChatPluginFormSubmitButton'; -export const cyChannelsChatPluginFormBackButton = 'channelsChatPluginFormBackButton'; + diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx index d69455a6aa..7ec4ac27d9 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx @@ -33,7 +33,7 @@ const ConnectedChannelsBySourceCard = (props: ConnectedChannelsBySourceCardProps
    props.history.push(sourceTypeInfo.channelsListRoute)}> -
    +
    {channels.slice(0, sourceTypeInfo.channelsToShow).map((channel: Channel) => { return (
  • diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx index 1ff6135a99..3947562f2f 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx @@ -16,6 +16,7 @@ import {ReactComponent as AiryAvatarIcon} from 'assets/images/icons/airy_avatar. import {ReactComponent as CheckMarkIcon} from 'assets/images/icons/checkmark.svg'; import styles from './index.module.scss'; +import {cyChannelsChatPluginList} from 'handles'; type ChannelListItemProps = { channel: Channel; @@ -84,7 +85,9 @@ const ChannelListItem = (props: ChannelListItemProps) => {
  • -
    {channel.metadata?.name}
    +
    + {channel.metadata?.name} +
    {isPhoneNumberSource() &&
    {channel.sourceChannelId}
    } {channel.connected && (
    diff --git a/frontend/ui/src/pages/Channels/MainPage/index.tsx b/frontend/ui/src/pages/Channels/MainPage/index.tsx index 385b87c88d..cd47cbf18a 100644 --- a/frontend/ui/src/pages/Channels/MainPage/index.tsx +++ b/frontend/ui/src/pages/Channels/MainPage/index.tsx @@ -50,7 +50,6 @@ export type SourceTypeInfo = { channelsToShow: number; itemInfoString: string; dataCyAddChannelButton: string; - dataCyChannelList: string; }; const sourceTypesInfo: SourceTypeInfo[] = [ @@ -65,7 +64,6 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsChatPluginAddButton, - dataCyChannelList: cyChannelsChatPluginList, }, { type: SourceType.facebook, @@ -78,7 +76,6 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsFacebookAddButton, - dataCyChannelList: cyChannelsFacebookList, }, { type: SourceType.twilioSMS, @@ -91,7 +88,6 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 2, itemInfoString: 'phones', dataCyAddChannelButton: cyChannelsTwilioSmsAddButton, - dataCyChannelList: cyChannelsTwilioSmsList, }, { type: SourceType.twilioWhatsapp, @@ -104,7 +100,6 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 2, itemInfoString: 'phones', dataCyAddChannelButton: cyChannelsTwilioWhatsappAddButton, - dataCyChannelList: cyChannelsTwilioWhatsappList, }, { type: SourceType.google, @@ -117,7 +112,6 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsGoogleAddButton, - dataCyChannelList: cyChannelsGoogleList, }, ]; diff --git a/frontend/ui/src/pages/Channels/Providers/Airy/ChatPlugin/ChatPluginConnect.tsx b/frontend/ui/src/pages/Channels/Providers/Airy/ChatPlugin/ChatPluginConnect.tsx index b1db2401aa..6ccbe9af6f 100644 --- a/frontend/ui/src/pages/Channels/Providers/Airy/ChatPlugin/ChatPluginConnect.tsx +++ b/frontend/ui/src/pages/Channels/Providers/Airy/ChatPlugin/ChatPluginConnect.tsx @@ -18,7 +18,6 @@ import { cyChannelsChatPluginConnectButton, cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, - cyChannelsChatPluginFormBackButton, } from 'handles'; import {CHANNELS_CHAT_PLUGIN_ROUTE, CHANNELS_CONNECTED_ROUTE} from '../../../../../routes/routes'; @@ -289,7 +288,7 @@ const ChatPluginConnect = (props: ChatPluginProps) => {
    )}
    - + Back diff --git a/integration/ui/connect_chatplugin.spec.ts b/integration/ui/connect_chatplugin.spec.ts index 26bad9b81c..bc927bb540 100644 --- a/integration/ui/connect_chatplugin.spec.ts +++ b/integration/ui/connect_chatplugin.spec.ts @@ -3,7 +3,6 @@ import { cyChannelsChatPluginConnectButton, cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, - cyChannelsChatPluginFormBackButton, cyChannelsChatPluginList, } from 'handles'; @@ -27,10 +26,8 @@ describe('Connect chatplugin channel', () => { cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(chatPluginName); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); - // cy.get(`[data-cy=${cyChannelsChatPluginList}]`) - // .children() - // .filter(`:contains(${chatPluginName})`) - // .should('have.length', 1); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') }); }); diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index df348db629..dd995b17a6 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -9,13 +9,14 @@ import { cyChannelsChatPluginConnectButton, cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, - cyChannelsChatPluginFormBackButton, cyTagsTableRowDisplayDeleteModal, cyTagsTableRowDisplayDeleteModalInput, cyTagsTableRowDisplayDeleteModalButton, + cyChannelsChatPluginList, } from 'handles'; describe('Creates and Deletes Tag', () => { + it('Login', () => { cy.visit('/login'); cy.get('form') @@ -34,7 +35,10 @@ describe('Creates and Deletes Tag', () => { cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') + // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); // cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filtering.spec.ts index bd4607517f..02848edda9 100644 --- a/integration/ui/filtering.spec.ts +++ b/integration/ui/filtering.spec.ts @@ -7,7 +7,7 @@ import { cyChannelsChatPluginConnectButton, cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, - cyChannelsChatPluginFormBackButton, + cyChannelsChatPluginList, } from 'handles'; describe('Filters conversation', () => { @@ -20,16 +20,18 @@ describe('Filters conversation', () => { }) .submit(); - cy.wait(500); - - cy.visit('/channels'); - cy.wait(500); - cy.url().should('include', '/channels'); - cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); - cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + cy.wait(500); + + cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index 21da1a2a1f..0a1e72b25f 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -7,7 +7,7 @@ import { cyChannelsChatPluginConnectButton, cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, - cyChannelsChatPluginFormBackButton, + cyChannelsChatPluginList, } from 'handles'; describe('Send chatplugin Message', () => { @@ -21,16 +21,18 @@ describe('Send chatplugin Message', () => { }) .submit(); - cy.wait(500); + cy.wait(500); - cy.visit('/channels'); - cy.wait(500); - cy.url().should('include', '/channels'); - cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); - cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - // cy.get(`[data-cy=${cyChannelsChatPluginFormBackButton}]`).click(); + cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); From 4baf324d06978b21ff4c5a532fa3446b72d7c7d8 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Sat, 20 Mar 2021 09:14:39 +0100 Subject: [PATCH 07/13] minor fixes --- frontend/ui/handles/index.ts | 2 +- .../ConnectedChannelsBySourceCard/index.tsx | 2 +- .../ChannelListItem/index.tsx | 5 +--- .../Channels/ConnectedChannelsList/index.tsx | 6 +++-- .../ui/src/pages/Channels/MainPage/index.tsx | 6 +++++ integration/ui/connect_chatplugin.spec.ts | 7 +++-- integration/ui/create_tag.spec.ts | 7 ++--- integration/ui/filtering.spec.ts | 27 ++++++++++--------- .../ui/send_chatplugin_message.spec.ts | 25 +++++++++-------- 9 files changed, 51 insertions(+), 36 deletions(-) diff --git a/frontend/ui/handles/index.ts b/frontend/ui/handles/index.ts index 498d4ce0ad..2faca55454 100644 --- a/frontend/ui/handles/index.ts +++ b/frontend/ui/handles/index.ts @@ -33,4 +33,4 @@ export const cyChannelsGoogleList = 'channelsGoogleList'; export const cyChannelsChatPluginConnectButton = 'channelsChatPluginConnectButton'; export const cyChannelsChatPluginFormNameInput = 'channelsChatPluginFormNameInput'; export const cyChannelsChatPluginFormSubmitButton = 'channelsChatPluginFormSubmitButton'; - +export const cyChannelsFormBackButton = 'channelsFormBackButton'; diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx index 7ec4ac27d9..d69455a6aa 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsBySourceCard/index.tsx @@ -33,7 +33,7 @@ const ConnectedChannelsBySourceCard = (props: ConnectedChannelsBySourceCardProps
    props.history.push(sourceTypeInfo.channelsListRoute)}> -
    +
    {channels.slice(0, sourceTypeInfo.channelsToShow).map((channel: Channel) => { return (
  • diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx index 3947562f2f..1ff6135a99 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsList/ChannelListItem/index.tsx @@ -16,7 +16,6 @@ import {ReactComponent as AiryAvatarIcon} from 'assets/images/icons/airy_avatar. import {ReactComponent as CheckMarkIcon} from 'assets/images/icons/checkmark.svg'; import styles from './index.module.scss'; -import {cyChannelsChatPluginList} from 'handles'; type ChannelListItemProps = { channel: Channel; @@ -85,9 +84,7 @@ const ChannelListItem = (props: ChannelListItemProps) => {
  • -
    - {channel.metadata?.name} -
    +
    {channel.metadata?.name}
    {isPhoneNumberSource() &&
    {channel.sourceChannelId}
    } {channel.connected && (
    diff --git a/frontend/ui/src/pages/Channels/ConnectedChannelsList/index.tsx b/frontend/ui/src/pages/Channels/ConnectedChannelsList/index.tsx index fc12c8c2fb..5f5ce903ec 100644 --- a/frontend/ui/src/pages/Channels/ConnectedChannelsList/index.tsx +++ b/frontend/ui/src/pages/Channels/ConnectedChannelsList/index.tsx @@ -15,7 +15,7 @@ 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 { CHANNELS_FACEBOOK_ROUTE, CHANNELS_CHAT_PLUGIN_ROUTE, @@ -106,10 +106,12 @@ const ConnectedChannelsList = (props: ConnectedChannelsListProps) => {
    - + + Back to channels +
    {filteredChannels.length > 0 ? ( sortBy(filteredChannels, (channel: Channel) => channel.metadata.name.toLowerCase()).map( diff --git a/frontend/ui/src/pages/Channels/MainPage/index.tsx b/frontend/ui/src/pages/Channels/MainPage/index.tsx index cd47cbf18a..385b87c88d 100644 --- a/frontend/ui/src/pages/Channels/MainPage/index.tsx +++ b/frontend/ui/src/pages/Channels/MainPage/index.tsx @@ -50,6 +50,7 @@ export type SourceTypeInfo = { channelsToShow: number; itemInfoString: string; dataCyAddChannelButton: string; + dataCyChannelList: string; }; const sourceTypesInfo: SourceTypeInfo[] = [ @@ -64,6 +65,7 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsChatPluginAddButton, + dataCyChannelList: cyChannelsChatPluginList, }, { type: SourceType.facebook, @@ -76,6 +78,7 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsFacebookAddButton, + dataCyChannelList: cyChannelsFacebookList, }, { type: SourceType.twilioSMS, @@ -88,6 +91,7 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 2, itemInfoString: 'phones', dataCyAddChannelButton: cyChannelsTwilioSmsAddButton, + dataCyChannelList: cyChannelsTwilioSmsList, }, { type: SourceType.twilioWhatsapp, @@ -100,6 +104,7 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 2, itemInfoString: 'phones', dataCyAddChannelButton: cyChannelsTwilioWhatsappAddButton, + dataCyChannelList: cyChannelsTwilioWhatsappList, }, { type: SourceType.google, @@ -112,6 +117,7 @@ const sourceTypesInfo: SourceTypeInfo[] = [ channelsToShow: 4, itemInfoString: 'channels', dataCyAddChannelButton: cyChannelsGoogleAddButton, + dataCyChannelList: cyChannelsGoogleList, }, ]; diff --git a/integration/ui/connect_chatplugin.spec.ts b/integration/ui/connect_chatplugin.spec.ts index bc927bb540..73a055e883 100644 --- a/integration/ui/connect_chatplugin.spec.ts +++ b/integration/ui/connect_chatplugin.spec.ts @@ -4,6 +4,7 @@ import { cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, cyChannelsChatPluginList, + cyChannelsFormBackButton, } from 'handles'; describe('Connect chatplugin channel', () => { @@ -27,7 +28,9 @@ describe('Connect chatplugin channel', () => { cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(chatPluginName); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); cy.wait(500); - cy.url().should('include', '/channels/connected'); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); + cy.wait(500); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); }); }); diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index dd995b17a6..883d6066a5 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -13,10 +13,10 @@ import { cyTagsTableRowDisplayDeleteModalInput, cyTagsTableRowDisplayDeleteModalButton, cyChannelsChatPluginList, + cyChannelsFormBackButton, } from 'handles'; describe('Creates and Deletes Tag', () => { - it('Login', () => { cy.visit('/login'); cy.get('form') @@ -37,8 +37,9 @@ describe('Creates and Deletes Tag', () => { cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); cy.wait(500); cy.url().should('include', '/channels/connected'); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') - + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); + cy.wait(500); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); // cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filtering.spec.ts index 02848edda9..9cb132477e 100644 --- a/integration/ui/filtering.spec.ts +++ b/integration/ui/filtering.spec.ts @@ -8,6 +8,7 @@ import { cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, cyChannelsChatPluginList, + cyChannelsFormBackButton, } from 'handles'; describe('Filters conversation', () => { @@ -20,18 +21,20 @@ describe('Filters conversation', () => { }) .submit(); - cy.wait(500); - - cy.visit('/channels'); - cy.wait(500); - cy.url().should('include', '/channels'); - cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); - cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); - cy.url().should('include', '/channels/connected'); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') + cy.wait(500); + + cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); + cy.wait(500); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index 0a1e72b25f..f790705b81 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -8,6 +8,7 @@ import { cyChannelsChatPluginFormNameInput, cyChannelsChatPluginFormSubmitButton, cyChannelsChatPluginList, + cyChannelsFormBackButton, } from 'handles'; describe('Send chatplugin Message', () => { @@ -21,18 +22,20 @@ describe('Send chatplugin Message', () => { }) .submit(); - cy.wait(500); + cy.wait(500); - cy.visit('/channels'); - cy.wait(500); - cy.url().should('include', '/channels'); - cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); - cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); - cy.url().should('include', '/channels/connected'); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")') + cy.visit('/channels'); + cy.wait(500); + cy.url().should('include', '/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); + cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); + cy.wait(500); + cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); + cy.wait(500); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); // cy.get(`[data-cy=${cyBubble}]`).click(); From ac2126098e5acf097b987d7be87d3866791a8414 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 10:06:57 +0100 Subject: [PATCH 08/13] Fix cypress import error --- integration/tsconfig.json | 8 ++++++++ integration/ui/BUILD | 3 --- integration/ui/create_tag.spec.ts | 10 ++++++---- integration/ui/filtering.spec.ts | 11 ++++++----- integration/ui/send_chatplugin_message.spec.ts | 11 ++++++----- 5 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 integration/tsconfig.json diff --git a/integration/tsconfig.json b/integration/tsconfig.json new file mode 100644 index 0000000000..f87a578b65 --- /dev/null +++ b/integration/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["es5", "dom"], + "types": ["cypress"] + }, + "include": ["**/*.ts"] +} diff --git a/integration/ui/BUILD b/integration/ui/BUILD index ea909f055b..7e62525bb3 100644 --- a/integration/ui/BUILD +++ b/integration/ui/BUILD @@ -4,10 +4,7 @@ ts_web_library( name = "specs", srcs = glob(["*.spec.ts"]), deps = [ -<<<<<<< HEAD -======= "//frontend/chat-plugin/handles:chat-plugin-handles", ->>>>>>> 7c74e61b (independent test for filter and sending messages) "//frontend/ui/handles", "@npm//cypress", ], diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index 883d6066a5..9c62115ac2 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -16,6 +16,8 @@ import { cyChannelsFormBackButton, } from 'handles'; +import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; + describe('Creates and Deletes Tag', () => { it('Login', () => { cy.visit('/login'); @@ -41,10 +43,10 @@ describe('Creates and Deletes Tag', () => { cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); - // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); - // cy.get(`[data-cy=${cyBubble}]`).click(); - // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); - // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); cy.visit('/'); cy.get(`[data-cy=${cyShowTagsDialog}]`).click(); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filtering.spec.ts index 9cb132477e..60f76ee0ae 100644 --- a/integration/ui/filtering.spec.ts +++ b/integration/ui/filtering.spec.ts @@ -1,4 +1,3 @@ -import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; import { cySearchButton, cySearchField, @@ -11,6 +10,8 @@ import { cyChannelsFormBackButton, } from 'handles'; +import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; + describe('Filters conversation', () => { it('Login', () => { cy.visit('/login'); @@ -36,10 +37,10 @@ describe('Filters conversation', () => { cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); - // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); - // cy.get(`[data-cy=${cyBubble}]`).click(); - // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); - // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); cy.visit('/'); cy.url().should('include', '/conversations'); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index f790705b81..e772d22c8f 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -1,4 +1,3 @@ -import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; import { cyMessageTextArea, cyMessageSendButton, @@ -11,6 +10,8 @@ import { cyChannelsFormBackButton, } from 'handles'; +import {cyBubble, cyInputbarButton, cyInputbarTextarea} from 'chat-plugin-handles'; + describe('Send chatplugin Message', () => { it('Logs into the UI', () => { cy.visit('/login'); @@ -37,10 +38,10 @@ describe('Send chatplugin Message', () => { cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); - // cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + (Cypress.env('channelId'))); - // cy.get(`[data-cy=${cyBubble}]`).click(); - // cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); - // cy.get(`[data-cy=${cyInputbarButton}]`).click(); + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); cy.visit('/'); cy.url().should('include', '/inbox'); From 1ca54ab017b338189c52bcffd9a3aba96168b710 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 14:32:43 +0100 Subject: [PATCH 09/13] minor fixes --- integration/ui/create_ui_conversation.spec.ts | 27 +++++++------------ ...ng.spec.ts => filter_conversation.spec.ts} | 0 2 files changed, 9 insertions(+), 18 deletions(-) rename integration/ui/{filtering.spec.ts => filter_conversation.spec.ts} (100%) diff --git a/integration/ui/create_ui_conversation.spec.ts b/integration/ui/create_ui_conversation.spec.ts index ca6ab8bb3a..9dc7ab0e72 100644 --- a/integration/ui/create_ui_conversation.spec.ts +++ b/integration/ui/create_ui_conversation.spec.ts @@ -1,19 +1,10 @@ -import {cyBubble, cyInputbarTextarea, cyInputbarButton} from 'handles'; +import {cyBubble, cyInputbarTextarea, cyInputbarButton} from 'chat-plugin-handles'; -describe( - 'Create UI Conversation', - { - baseUrl: 'http://airy.core/chatplugin/ui', - }, - () => { - const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; - const messageChatplugin = 'Hello from Inbox!'; - - it('Creates a chat plugin conversation', () => { - cy.visit('/example?channel_id=' + channelId); - cy.get(`[data-cy=${cyBubble}]`).click(); - cy.get(`[data-cy=${cyInputbarTextarea}]`).type(messageChatplugin); - cy.get(`[data-cy=${cyInputbarButton}]`).click(); - }); - } -); +describe('Create UI Conversation', () => { + it('Creates a chat plugin conversation', () => { + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); + }); +}); diff --git a/integration/ui/filtering.spec.ts b/integration/ui/filter_conversation.spec.ts similarity index 100% rename from integration/ui/filtering.spec.ts rename to integration/ui/filter_conversation.spec.ts From 2ac83e882709239ca620be71b2555c53d0d90ba6 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 15:55:39 +0100 Subject: [PATCH 10/13] implement suggested changes --- integration/tsconfig.json | 2 -- integration/ui/connect_chatplugin.spec.ts | 6 ++---- integration/ui/create_tag.spec.ts | 2 +- integration/ui/filter_conversation.spec.ts | 2 +- integration/ui/send_chatplugin_message.spec.ts | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/integration/tsconfig.json b/integration/tsconfig.json index f87a578b65..a569e9438d 100644 --- a/integration/tsconfig.json +++ b/integration/tsconfig.json @@ -1,7 +1,5 @@ { "compilerOptions": { - "target": "es5", - "lib": ["es5", "dom"], "types": ["cypress"] }, "include": ["**/*.ts"] diff --git a/integration/ui/connect_chatplugin.spec.ts b/integration/ui/connect_chatplugin.spec.ts index 73a055e883..0dc82616fa 100644 --- a/integration/ui/connect_chatplugin.spec.ts +++ b/integration/ui/connect_chatplugin.spec.ts @@ -9,8 +9,6 @@ import { describe('Connect chatplugin channel', () => { it('Logs into the UI', () => { - const chatPluginName = 'Cypress Chatplugin'; - cy.visit('/login'); cy.get('form') @@ -25,12 +23,12 @@ describe('Connect chatplugin channel', () => { cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(chatPluginName); + cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); cy.wait(500); cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); cy.wait(500); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); }); }); diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index 9c62115ac2..e6c2fc2d50 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -41,7 +41,7 @@ describe('Creates and Deletes Tag', () => { cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); cy.wait(500); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/filter_conversation.spec.ts b/integration/ui/filter_conversation.spec.ts index 60f76ee0ae..9309fd1e08 100644 --- a/integration/ui/filter_conversation.spec.ts +++ b/integration/ui/filter_conversation.spec.ts @@ -35,7 +35,7 @@ describe('Filters conversation', () => { cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); cy.wait(500); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); cy.get(`[data-cy=${cyBubble}]`).click(); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index e772d22c8f..183230b195 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -36,7 +36,7 @@ describe('Send chatplugin Message', () => { cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); cy.wait(500); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(':contains("Cypress Chatplugin")'); + cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); cy.get(`[data-cy=${cyBubble}]`).click(); From df3f5d568f6a60ef30366986ef8f283c7982e19d Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 16:45:19 +0100 Subject: [PATCH 11/13] implement suggested changes --- integration/tsconfig.json | 6 ------ integration/ui/connect_chatplugin.spec.ts | 2 -- integration/ui/create_tag.spec.ts | 2 -- integration/ui/filter_conversation.spec.ts | 5 ----- 4 files changed, 15 deletions(-) delete mode 100644 integration/tsconfig.json diff --git a/integration/tsconfig.json b/integration/tsconfig.json deleted file mode 100644 index a569e9438d..0000000000 --- a/integration/tsconfig.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "types": ["cypress"] - }, - "include": ["**/*.ts"] -} diff --git a/integration/ui/connect_chatplugin.spec.ts b/integration/ui/connect_chatplugin.spec.ts index 0dc82616fa..c9405b5c0f 100644 --- a/integration/ui/connect_chatplugin.spec.ts +++ b/integration/ui/connect_chatplugin.spec.ts @@ -25,10 +25,8 @@ describe('Connect chatplugin channel', () => { cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); - cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); }); }); diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index e6c2fc2d50..80ab145129 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -37,10 +37,8 @@ describe('Creates and Deletes Tag', () => { cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); - cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); diff --git a/integration/ui/filter_conversation.spec.ts b/integration/ui/filter_conversation.spec.ts index 9309fd1e08..f141123118 100644 --- a/integration/ui/filter_conversation.spec.ts +++ b/integration/ui/filter_conversation.spec.ts @@ -31,10 +31,8 @@ describe('Filters conversation', () => { cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); cy.url().should('include', '/channels/connected'); cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); - cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); @@ -44,12 +42,9 @@ describe('Filters conversation', () => { cy.visit('/'); cy.url().should('include', '/conversations'); - cy.get(`[data-cy=${cyConversationList}]`).children().children().children().its('length').should('gte', 1); - cy.get(`[data-cy=${cySearchButton}]`).click(); cy.get(`[data-cy=${cySearchField}]`).get('input').type(Cypress.env('searchQuery')); - cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); }); }); From 6b6d5a14b7432dd7f7575686422ae5c3f61046e2 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 17:10:24 +0100 Subject: [PATCH 12/13] remove duplicate file --- .../chat-plugin/create_conversation.spec.ts | 25 ++++++------------- integration/ui/create_ui_conversation.spec.ts | 10 -------- integration/ui/filter_conversation.spec.ts | 3 +-- 3 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 integration/ui/create_ui_conversation.spec.ts diff --git a/integration/chat-plugin/create_conversation.spec.ts b/integration/chat-plugin/create_conversation.spec.ts index 6ea23e1950..9dc7ab0e72 100644 --- a/integration/chat-plugin/create_conversation.spec.ts +++ b/integration/chat-plugin/create_conversation.spec.ts @@ -1,19 +1,10 @@ import {cyBubble, cyInputbarTextarea, cyInputbarButton} from 'chat-plugin-handles'; -describe( - 'Chatplugin', - { - baseUrl: 'http://airy.core/chatplugin/ui', - }, - () => { - const channelId = '3502a0a7-933d-5410-b5fc-51f041146d89'; - const messageChatplugin = 'Hello from Chatplugin!'; - - it('Creates a chat plugin conversation', () => { - cy.visit('/example?channel_id=' + channelId); - cy.get(`[data-cy=${cyBubble}]`).click(); - cy.get(`[data-cy=${cyInputbarTextarea}]`).type(messageChatplugin); - cy.get(`[data-cy=${cyInputbarButton}]`).click(); - }); - } -); +describe('Create UI Conversation', () => { + it('Creates a chat plugin conversation', () => { + cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); + cy.get(`[data-cy=${cyBubble}]`).click(); + cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); + cy.get(`[data-cy=${cyInputbarButton}]`).click(); + }); +}); diff --git a/integration/ui/create_ui_conversation.spec.ts b/integration/ui/create_ui_conversation.spec.ts deleted file mode 100644 index 9dc7ab0e72..0000000000 --- a/integration/ui/create_ui_conversation.spec.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {cyBubble, cyInputbarTextarea, cyInputbarButton} from 'chat-plugin-handles'; - -describe('Create UI Conversation', () => { - it('Creates a chat plugin conversation', () => { - cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); - cy.get(`[data-cy=${cyBubble}]`).click(); - cy.get(`[data-cy=${cyInputbarTextarea}]`).type(Cypress.env('messageChatplugin')); - cy.get(`[data-cy=${cyInputbarButton}]`).click(); - }); -}); diff --git a/integration/ui/filter_conversation.spec.ts b/integration/ui/filter_conversation.spec.ts index f141123118..c7e68cc17c 100644 --- a/integration/ui/filter_conversation.spec.ts +++ b/integration/ui/filter_conversation.spec.ts @@ -42,9 +42,8 @@ describe('Filters conversation', () => { cy.visit('/'); cy.url().should('include', '/conversations'); - cy.get(`[data-cy=${cyConversationList}]`).children().children().children().its('length').should('gte', 1); + cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); cy.get(`[data-cy=${cySearchButton}]`).click(); cy.get(`[data-cy=${cySearchField}]`).get('input').type(Cypress.env('searchQuery')); - cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); }); }); From e5cff13693cdfc657dbcb06e6e0c80b3aa55b663 Mon Sep 17 00:00:00 2001 From: Kazeem Adetunji Date: Mon, 22 Mar 2021 17:47:08 +0100 Subject: [PATCH 13/13] removed irrelevant assertions --- frontend/chat-plugin/handles/BUILD | 3 +++ frontend/ui/handles/BUILD | 3 +++ integration/BUILD | 3 +++ integration/chat-plugin/BUILD | 3 +++ integration/cypress.json | 2 +- integration/ui/BUILD | 3 +++ integration/ui/create_tag.spec.ts | 7 +------ integration/ui/filter_conversation.spec.ts | 12 +++++++----- integration/ui/send_chatplugin_message.spec.ts | 4 +--- 9 files changed, 25 insertions(+), 15 deletions(-) diff --git a/frontend/chat-plugin/handles/BUILD b/frontend/chat-plugin/handles/BUILD index e75c7a997b..c11c75ee58 100644 --- a/frontend/chat-plugin/handles/BUILD +++ b/frontend/chat-plugin/handles/BUILD @@ -1,4 +1,7 @@ load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library") +load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg") + +check_pkg(name = "buildifier") package(default_visibility = ["//visibility:public"]) diff --git a/frontend/ui/handles/BUILD b/frontend/ui/handles/BUILD index 334ea614f1..7f2b72070f 100644 --- a/frontend/ui/handles/BUILD +++ b/frontend/ui/handles/BUILD @@ -1,4 +1,7 @@ load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library") +load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg") + +check_pkg(name = "buildifier") package(default_visibility = ["//visibility:public"]) diff --git a/integration/BUILD b/integration/BUILD index 973792c37d..505a8c3d92 100644 --- a/integration/BUILD +++ b/integration/BUILD @@ -1,4 +1,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") +load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg") + +check_pkg(name = "buildifier") nodejs_binary( name = "cypress", diff --git a/integration/chat-plugin/BUILD b/integration/chat-plugin/BUILD index 754f561aa8..abfa93332a 100644 --- a/integration/chat-plugin/BUILD +++ b/integration/chat-plugin/BUILD @@ -1,4 +1,7 @@ load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library") +load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg") + +check_pkg(name = "buildifier") ts_web_library( name = "specs", diff --git a/integration/cypress.json b/integration/cypress.json index be975f8f0d..566572929a 100644 --- a/integration/cypress.json +++ b/integration/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:8080/ui", + "baseUrl": "http://airy.core/ui", "integrationFolder": "integration", "testFiles": "**/*.spec.?s", "env": { diff --git a/integration/ui/BUILD b/integration/ui/BUILD index 7e62525bb3..e4c9958609 100644 --- a/integration/ui/BUILD +++ b/integration/ui/BUILD @@ -1,4 +1,7 @@ load("@com_github_airyhq_bazel_tools//web:typescript.bzl", "ts_web_library") +load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg") + +check_pkg(name = "buildifier") ts_web_library( name = "specs", diff --git a/integration/ui/create_tag.spec.ts b/integration/ui/create_tag.spec.ts index 80ab145129..87f5fb8a7b 100644 --- a/integration/ui/create_tag.spec.ts +++ b/integration/ui/create_tag.spec.ts @@ -28,18 +28,14 @@ describe('Creates and Deletes Tag', () => { }) .submit(); - cy.wait(500); - cy.visit('/channels'); cy.wait(500); - cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); cy.get(`[data-cy=${cyBubble}]`).click(); @@ -55,7 +51,6 @@ describe('Creates and Deletes Tag', () => { cy.visit('/tags'); cy.get(`[data-cy=${cyTagsSearchField}]`).type(Cypress.env('tagName')); cy.get(`[data-cy=${cyTagsTable}]`).children().children().its('length').should('be.gte', 2); - cy.get(`[data-cy=${cyTagsTable}]`).children().children(); cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModal}]`).click(); cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModalInput}]`).type('DELETE'); cy.get(`[data-cy=${cyTagsTableRowDisplayDeleteModalButton}]`).click(); diff --git a/integration/ui/filter_conversation.spec.ts b/integration/ui/filter_conversation.spec.ts index c7e68cc17c..31c39a0ac7 100644 --- a/integration/ui/filter_conversation.spec.ts +++ b/integration/ui/filter_conversation.spec.ts @@ -26,14 +26,13 @@ describe('Filters conversation', () => { cy.visit('/channels'); cy.wait(500); - cy.url().should('include', '/channels'); + cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); - cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`); cy.visit('http://airy.core/chatplugin/ui/example?channel_id=' + Cypress.env('channelId')); cy.get(`[data-cy=${cyBubble}]`).click(); @@ -41,9 +40,12 @@ describe('Filters conversation', () => { cy.get(`[data-cy=${cyInputbarButton}]`).click(); cy.visit('/'); - cy.url().should('include', '/conversations'); - cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); + + cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('gte', 1); + cy.wait(500); cy.get(`[data-cy=${cySearchButton}]`).click(); + cy.wait(500); cy.get(`[data-cy=${cySearchField}]`).get('input').type(Cypress.env('searchQuery')); + cy.get(`[data-cy=${cyConversationList}]`).children().children().its('length').should('eq', 1); }); }); diff --git a/integration/ui/send_chatplugin_message.spec.ts b/integration/ui/send_chatplugin_message.spec.ts index 183230b195..0a9ba95a02 100644 --- a/integration/ui/send_chatplugin_message.spec.ts +++ b/integration/ui/send_chatplugin_message.spec.ts @@ -27,13 +27,11 @@ describe('Send chatplugin Message', () => { cy.visit('/channels'); cy.wait(500); - cy.url().should('include', '/channels'); cy.get(`[data-cy=${cyChannelsChatPluginAddButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginConnectButton}]`).click(); cy.get(`[data-cy=${cyChannelsChatPluginFormNameInput}]`).type(Cypress.env('chatPluginName')); cy.get(`[data-cy=${cyChannelsChatPluginFormSubmitButton}]`).click(); - cy.wait(500); - cy.url().should('include', '/channels/connected'); + cy.get(`[data-cy=${cyChannelsFormBackButton}]`).click(); cy.wait(500); cy.get(`[data-cy=${cyChannelsChatPluginList}]`).filter(`:contains("${Cypress.env('chatPluginName')}")`);