From 153ba168a09e757daf968fa8cdc5fa519da01b89 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 11 Aug 2024 22:30:25 +0100 Subject: [PATCH] tests: update share test to actually share --- cypress/e2e/chat.cy.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/chat.cy.ts b/cypress/e2e/chat.cy.ts index 9cc10a280..20be9755a 100644 --- a/cypress/e2e/chat.cy.ts +++ b/cypress/e2e/chat.cy.ts @@ -64,16 +64,18 @@ describe('Settings', () => { cy.get('div[aria-label="Generation Info"]', { timeout: 120_000 }).should('exist'); // spy on requests const spy = cy.spy(); - cy.intercept('GET', '/api/v1/chats/*', spy); + cy.intercept('POST', '/api/v1/chats/**/share', spy); // Open context menu cy.get('#chat-context-menu-button').click(); // Click share button cy.get('#chat-share-button').click(); // Check if the share dialog is visible cy.get('#copy-and-share-chat-button').should('exist'); - cy.wrap({}, { timeout: 5000 }).should(() => { - // Check if the request was made twice (once for to replace chat object and once more due to change event) - expect(spy).to.be.callCount(2); + // Click the copy button + cy.get('#copy-and-share-chat-button').click(); + cy.wrap({}, { timeout: 5_000 }).should(() => { + // Check if the share request was made + expect(spy).to.be.callCount(1); }); });