From be361846e0f3214399c66ae533692bf37a3d3fc3 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:40:47 +0200 Subject: [PATCH 1/6] add firefox cypress run --- .github/workflows/cypress-firefox.yml | 14 ++++++++++++++ .github/workflows/cypress.yml | 10 ++-------- cypress.config.ts | 6 ------ package.json | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/cypress-firefox.yml diff --git a/.github/workflows/cypress-firefox.yml b/.github/workflows/cypress-firefox.yml new file mode 100644 index 00000000..640d31bf --- /dev/null +++ b/.github/workflows/cypress-firefox.yml @@ -0,0 +1,14 @@ +name: E2E Firefox +on: [pull_request] +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "npm" + - run: npm ci + - run: npm run cypress:run:firefox diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index f9a40a29..0a82637f 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,20 +1,14 @@ -name: Run Cypress +name: E2E Chrome on: [pull_request] jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20.x cache: "npm" - run: npm ci - run: npm test - - \ No newline at end of file diff --git a/cypress.config.ts b/cypress.config.ts index ea6efc6b..56a98996 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -2,14 +2,8 @@ import { defineConfig } from "cypress"; export default defineConfig({ video: false, - chromeWebSecurity: false, viewportHeight: 800, e2e: { - // We've imported your old cypress plugins here. - // You may want to clean this up later by importing these. - setupNodeEvents(on, config) { - return require("./cypress/plugins/index.js")(on, config); - }, baseUrl: "http://localhost:8787/", }, }); diff --git a/package.json b/package.json index 4dd6ed67..b927bb41 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "cypress:open": "cypress open --e2e --browser chrome", "cypress:serve": "http-server -a localhost -p 8787 dist/", "cypress:run": "cypress run", + "cypress:run:firefox": "cypress run --browser firefox", "test:cypress": "run-p -r cypress:serve cypress:run", "test": "npm run test:cypress", "pretest": "npm run build", From 6c23ca4925528211fbf10bdae47461f54d8a5bef Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:46:06 +0200 Subject: [PATCH 2/6] add cypress serve to firefox run --- .github/workflows/cypress-firefox.yml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress-firefox.yml b/.github/workflows/cypress-firefox.yml index 640d31bf..35b400ab 100644 --- a/.github/workflows/cypress-firefox.yml +++ b/.github/workflows/cypress-firefox.yml @@ -11,4 +11,4 @@ jobs: node-version: 20.x cache: "npm" - run: npm ci - - run: npm run cypress:run:firefox + - run: npm run test:cypress:firefox diff --git a/package.json b/package.json index b927bb41..efbffcae 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "cypress:run": "cypress run", "cypress:run:firefox": "cypress run --browser firefox", "test:cypress": "run-p -r cypress:serve cypress:run", + "test:cypress:firefox": "run-p -r cypress:serve cypress:run:firefox", "test": "npm run test:cypress", "pretest": "npm run build", "prettier:check": "prettier --check --config .prettierrc.json src/", From a329398ca964a6a6c88908bf14a4f420244af870 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:14:23 +0200 Subject: [PATCH 3/6] add build stage to firefox run --- .github/workflows/cypress-firefox.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cypress-firefox.yml b/.github/workflows/cypress-firefox.yml index 35b400ab..ce32f4bd 100644 --- a/.github/workflows/cypress-firefox.yml +++ b/.github/workflows/cypress-firefox.yml @@ -11,4 +11,5 @@ jobs: node-version: 20.x cache: "npm" - run: npm ci + - run: npm run build - run: npm run test:cypress:firefox From c0513d88e72ca3e2a27d1c19a7dd46f07735aeb5 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Wed, 10 Jul 2024 09:49:56 +0200 Subject: [PATCH 4/6] fix tests for firefox --- cypress/e2e/homeScreen.cy.ts | 5 +++-- cypress/e2e/message-colors.cy.ts | 8 ++++---- cypress/e2e/sourceColorMapping.cy.ts | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/homeScreen.cy.ts b/cypress/e2e/homeScreen.cy.ts index c542b93f..bf0942d7 100644 --- a/cypress/e2e/homeScreen.cy.ts +++ b/cypress/e2e/homeScreen.cy.ts @@ -89,7 +89,8 @@ describe('Home Screen', () => { } }); cy.openWebchat(); - cy.get('.webchat-homescreen-content').should('have.css', 'background', 'none repeat scroll 50% 50% / cover padding-box border-box, rgba(0, 0, 0, 0) radial-gradient(204.5% 136.79% at 0.53% 95.79%, rgb(237, 236, 249) 0%, rgb(191, 186, 255) 31.77%, rgb(33, 82, 227) 65.63%, rgb(5, 48, 158) 100%) repeat scroll 50% 50% / cover padding-box border-box'); + cy.get('.webchat-homescreen-content') + .should('have.css', 'background-image', 'none, radial-gradient(204.5% 136.79% at 0.53% 95.79%, rgb(237, 236, 249) 0%, rgb(191, 186, 255) 31.77%, rgb(33, 82, 227) 65.63%, rgb(5, 48, 158) 100%)'); }); it('has specified background gradient when configured', () => { @@ -105,7 +106,7 @@ describe('Home Screen', () => { } }); cy.openWebchat(); - cy.get('.webchat-homescreen-content').should('have.css', 'background', 'none repeat scroll 50% 50% / cover padding-box border-box, rgba(0, 0, 0, 0) linear-gradient(to right, rgb(255, 0, 0), rgb(0, 0, 255)) repeat scroll 50% 50% / cover padding-box border-box'); + cy.get('.webchat-homescreen-content').should('have.css', 'background-image', 'none, linear-gradient(to right, rgb(255, 0, 0), rgb(0, 0, 255))'); }); it('has the specified background color when configured', () => { diff --git a/cypress/e2e/message-colors.cy.ts b/cypress/e2e/message-colors.cy.ts index 45adda49..35674a8b 100644 --- a/cypress/e2e/message-colors.cy.ts +++ b/cypress/e2e/message-colors.cy.ts @@ -19,7 +19,7 @@ describe('Message Color Variants', () => { it('renders a "text with buttons"', () => { cy.receiveMessageFixture('buttons'); - cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'background', 'rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box'); + cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'background-color', 'rgb(255, 255, 255)'); cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'color', 'rgb(28, 28, 28)'); }); @@ -57,7 +57,7 @@ describe('Message Color Variants', () => { cy.receiveMessageFixture('date-picker'); cy.get('.webchat-message-row button') - .should('have.css', 'background-color', 'rgb(26, 26, 26)') + .should('have.css', 'background-color', 'rgb(16, 13, 13)') .should('have.css', 'color', 'rgb(255, 255, 255)'); }); @@ -95,7 +95,7 @@ describe('Message Color Variants', () => { it('renders a "text with buttons"', () => { cy.receiveMessageFixture('buttons'); - cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'background', 'rgb(232, 235, 255) none repeat scroll 0% 0% / auto padding-box border-box'); + cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'background-color', 'rgb(232, 235, 255)'); cy.get('.webchat-buttons-template-root .chat-bubble').should('have.css', 'color', 'rgba(26, 26, 26, 0.95)'); }); @@ -106,7 +106,7 @@ describe('Message Color Variants', () => { cy.receiveMessage(text, data, source); cy.get('.webchat-quick-reply-template-root .chat-bubble') - .should('have.css', 'background', 'rgb(232, 235, 255) none repeat scroll 0% 0% / auto padding-box border-box'); + .should('have.css', 'background-color', 'rgb(232, 235, 255)'); }); }); diff --git a/cypress/e2e/sourceColorMapping.cy.ts b/cypress/e2e/sourceColorMapping.cy.ts index 2a08691a..0b9dc229 100644 --- a/cypress/e2e/sourceColorMapping.cy.ts +++ b/cypress/e2e/sourceColorMapping.cy.ts @@ -21,7 +21,7 @@ describe('Source Color Mapping', () => { cy.receiveMessage('bot message', {}, 'bot'); - cy.get('.webchat-message-row.bot .chat-bubble').should('have.css', 'background', 'rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box'); + cy.get('.webchat-message-row.bot .chat-bubble').should('have.css', 'background-color', 'rgb(255, 255, 255)'); }); it('should render agent messages as "neutral" by default', () => { @@ -29,7 +29,7 @@ describe('Source Color Mapping', () => { cy.receiveMessage('agent message', {}, 'agent'); - cy.get('.webchat-message-row.agent .chat-bubble').should('have.css', 'background', 'rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box'); + cy.get('.webchat-message-row.agent .chat-bubble').should('have.css', 'background-color', 'rgb(255, 255, 255)'); }); it('should render user messages as "neutral" if configures in sourceColorMapping', () => { From cfe15e8bad93fca7c16a5039bc4477681fa1f388 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:06:59 +0200 Subject: [PATCH 5/6] fix test --- cypress/e2e/message-colors.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/message-colors.cy.ts b/cypress/e2e/message-colors.cy.ts index 35674a8b..ca6e6951 100644 --- a/cypress/e2e/message-colors.cy.ts +++ b/cypress/e2e/message-colors.cy.ts @@ -57,7 +57,7 @@ describe('Message Color Variants', () => { cy.receiveMessageFixture('date-picker'); cy.get('.webchat-message-row button') - .should('have.css', 'background-color', 'rgb(16, 13, 13)') + .should('have.css', 'background-color', 'rgb(26, 26, 26)') .should('have.css', 'color', 'rgb(255, 255, 255)'); }); From f7e3ab47785aae10e613bf0954a61b0d3b3266e0 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich <90881+kwinto@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:43:09 +0200 Subject: [PATCH 6/6] add package script to open cypress-firefox --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b9fa278d..227fe482 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "update-license": "node update-license.js", "dev": "webpack-dev-server --config webpack.dev.js --host 0.0.0.0", "cypress:open": "cypress open --e2e --browser chrome", + "cypress:open:firefox": "cypress open --e2e --browser firefox", "cypress:serve": "http-server -a localhost -p 8787 dist/", "cypress:run": "cypress run", "cypress:run:firefox": "cypress run --browser firefox",