Skip to content

Commit

Permalink
new test for user chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Zahra Ali authored and Zahra-8d committed Jun 20, 2023
1 parent 3fbed20 commit ef43feb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/layout/SecondaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const SecondaryNav = ({ currentPage }: { currentPage: string }) => {
ariaLabel: t('chat'),
href: '/chat',
event: SECONDARY_HEADER_CHAT_CLICKED,
qaId: 'secondary-nav-chat-button',
},
{
label: t('notes'),
Expand Down
22 changes: 22 additions & 0 deletions cypress/integration/user-chat.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('A logged in public user can start a chat', () => {
before(() => {
cy.cleanUpTestState();
cy.logInWithEmailAndPassword(Cypress.env('public_email'), Cypress.env('public_password'));
});

it('Navigate to the chat page and begin a chat', () => {
cy.get(`[qa-id=secondary-nav-chat-button]`).should('exist').click(); //go to chat page

cy.get('button[type="button"]').contains('Start a chat').click(); //click button to start chatting

cy.get('#crisp-chatbox [data-chat-status="initial"]')
.should('have.attr', 'data-visible')
.and('equal', 'true'); //chatbox visible

cy.get('a[aria-label="Close chat"]').click(); //close chat box
});

after(() => {
cy.logout();
});
});

0 comments on commit ef43feb

Please sign in to comment.