From af6420e06d95684235fc08046f85c97fb8c9097c Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 11 Aug 2024 14:17:32 +0100 Subject: [PATCH 1/3] ci: increase usable disk space for integration test --- .github/workflows/integration-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 41c19d32d..8d9dd7aeb 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,6 +15,13 @@ jobs: name: Run Cypress Integration Tests runs-on: ubuntu-latest steps: + - name: Maximize build space + uses: AdityaGarg8/remove-unwanted-software@v4.1 + with: + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + - name: Checkout Repository uses: actions/checkout@v4 From c70b18b2ef93a5a45a97c0477544c7b74fd1d39f Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 11 Aug 2024 16:22:33 +0100 Subject: [PATCH 2/3] tests: change how cypress detects chat messages --- cypress/e2e/chat.cy.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/chat.cy.ts b/cypress/e2e/chat.cy.ts index ddb33d6c0..9cc10a280 100644 --- a/cypress/e2e/chat.cy.ts +++ b/cypress/e2e/chat.cy.ts @@ -38,9 +38,10 @@ describe('Settings', () => { // User's message should be visible cy.get('.chat-user').should('exist'); // Wait for the response - cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received - .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received - .should('exist'); + // .chat-assistant is created after the first token is received + cy.get('.chat-assistant', { timeout: 10_000 }).should('exist'); + // Generation Info is created after the stop token is received + cy.get('div[aria-label="Generation Info"]', { timeout: 120_000 }).should('exist'); }); it('user can share chat', () => { @@ -57,9 +58,10 @@ describe('Settings', () => { // User's message should be visible cy.get('.chat-user').should('exist'); // Wait for the response - cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received - .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received - .should('exist'); + // .chat-assistant is created after the first token is received + cy.get('.chat-assistant', { timeout: 10_000 }).should('exist'); + // Generation Info is created after the stop token is received + 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); @@ -89,9 +91,10 @@ describe('Settings', () => { // User's message should be visible cy.get('.chat-user').should('exist'); // Wait for the response - cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received - .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received - .should('exist'); + // .chat-assistant is created after the first token is received + cy.get('.chat-assistant', { timeout: 10_000 }).should('exist'); + // Generation Info is created after the stop token is received + cy.get('div[aria-label="Generation Info"]', { timeout: 120_000 }).should('exist'); // Click on the generate image button cy.get('[aria-label="Generate Image"]').click(); // Wait for image to be visible From 153ba168a09e757daf968fa8cdc5fa519da01b89 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 11 Aug 2024 22:30:25 +0100 Subject: [PATCH 3/3] 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); }); });