From 5b8bacb83f9fe06eda0be4a992ca5479caca6841 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 26 Feb 2023 19:06:22 -0800 Subject: [PATCH] Add chat embed automated browser tests. Closes #2743 --- .../03_offline_readwrite_chat_embed.cy.js | 8 +++++ .../04_offline_readonly_chat_embed.cy.js | 8 ++--- .../03_online_readwrite_chat_embed.cy.js | 36 +++++++++---------- .../04_online_readonly_chat_embed.cy.js | 8 ++--- web/pages/embed/chat/readwrite/index.tsx | 18 +++++----- 5 files changed, 44 insertions(+), 34 deletions(-) diff --git a/test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js b/test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js index afd5384f1..c1802fe96 100644 --- a/test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js +++ b/test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js @@ -5,4 +5,12 @@ describe(`Offline readwrite chat embed`, () => { it('Can visit the page', () => { cy.visit('http://localhost:8080/embed/chat/readwrite'); }); + + it('Header should be visible', () => { + cy.get('header').should('be.visible'); + }); + + it('Chat should be visible', () => { + cy.get('#chat-container').should('be.visible'); + }); }); diff --git a/test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js b/test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js index ce0009d16..a01a75f9d 100644 --- a/test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js +++ b/test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js @@ -3,10 +3,10 @@ setup(); describe(`Offline read-only chat embed`, () => { it('Can visit the page', () => { - cy.visit('http://localhost:8080/embed/chat/readwrite'); + cy.visit('http://localhost:8080/embed/chat/readonly'); }); - // it('Chat should be visible', () => { - // cy.get('#chat-container').should('be.visible'); - // }); + it('Chat should be visible', () => { + cy.get('#chat-container').should('be.visible'); + }); }); diff --git a/test/automated/browser/cypress/e2e/online/03_online_readwrite_chat_embed.cy.js b/test/automated/browser/cypress/e2e/online/03_online_readwrite_chat_embed.cy.js index 4f4811223..e4496b8d6 100644 --- a/test/automated/browser/cypress/e2e/online/03_online_readwrite_chat_embed.cy.js +++ b/test/automated/browser/cypress/e2e/online/03_online_readwrite_chat_embed.cy.js @@ -6,27 +6,27 @@ describe(`Online readwrite chat embed`, () => { cy.visit('http://localhost:8080/embed/chat/readwrite'); }); - // it('Chat should be visible', () => { - // cy.get('#chat-container').should('be.visible'); - // }); + it('Header should be visible', () => { + cy.get('header').should('be.visible'); + }); - // it('User menu should be visible', () => { - // cy.get('#user-menu').should('be.visible'); - // }); + it('User menu should be visible', () => { + cy.get('#user-menu').should('be.visible'); + }); - // it('Chat join message should exist', () => { - // cy.contains('joined the chat').should('be.visible'); - // }); + it('Chat join message should exist', () => { + cy.contains('joined the chat').should('be.visible'); + }); - // it('User menu should be visible', () => { - // cy.get('#user-menu').should('be.visible'); - // }); + it('Click on user menu', () => { + cy.get('#user-menu').click(); + }); - // it('Click on user menu', () => { - // cy.get('#user-menu').click(); - // }); + it('Show change name modal', () => { + cy.contains('Change name').click(); + }); - // it('Show change name modal', () => { - // cy.contains('Change name').click(); - // }); + it('Close name change modal', () => { + cy.get('.ant-modal-close-x').click(); + }); }); diff --git a/test/automated/browser/cypress/e2e/online/04_online_readonly_chat_embed.cy.js b/test/automated/browser/cypress/e2e/online/04_online_readonly_chat_embed.cy.js index ac0646b34..45c650955 100644 --- a/test/automated/browser/cypress/e2e/online/04_online_readonly_chat_embed.cy.js +++ b/test/automated/browser/cypress/e2e/online/04_online_readonly_chat_embed.cy.js @@ -3,10 +3,10 @@ setup(); describe(`Online read-only chat embed`, () => { it('Can visit the page', () => { - cy.visit('http://localhost:8080/embed/chat/readwrite'); + cy.visit('http://localhost:8080/embed/chat/readonly'); }); - // it('Chat should be visible', () => { - // cy.get('#chat-container').should('be.visible'); - // }); + it('Chat should be visible', () => { + cy.get('#chat-container').should('be.visible'); + }); }); diff --git a/web/pages/embed/chat/readwrite/index.tsx b/web/pages/embed/chat/readwrite/index.tsx index 1e0f85aee..35fc51820 100644 --- a/web/pages/embed/chat/readwrite/index.tsx +++ b/web/pages/embed/chat/readwrite/index.tsx @@ -33,14 +33,16 @@ export default function ReadWriteChatEmbed() {
{currentUser && ( - +
+ +
)} );