From 558906f2f844ace15205471632da4f8d2c21d775 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Tue, 7 Jan 2025 08:46:22 -0700 Subject: [PATCH] misc: update browser icons (#30790) --- cli/CHANGELOG.md | 8 + .../app/cypress/component/support/index.ts | 16 -- .../app/cypress/e2e/support/e2eSupport.ts | 4 +- packages/app/cypress/e2e/top-nav.cy.ts | 12 +- packages/app/package.json | 8 +- .../app/src/debug/LayeredBrowserIcons.cy.tsx | 3 +- .../app/src/debug/LayeredBrowserIcons.vue | 39 +-- .../runner/SpecRunnerHeaderOpenMode.cy.tsx | 5 +- .../src/runner/SpecRunnerHeaderOpenMode.vue | 6 +- .../src/runner/SpecRunnerHeaderRunMode.cy.tsx | 6 +- .../src/runner/SpecRunnerHeaderRunMode.vue | 6 +- .../automation/AutomationMissing.cy.tsx | 4 +- .../runner/automation/AutomationMissing.vue | 6 +- packages/app/src/runs/RunCard.vue | 4 +- .../specs/switcher/TestingTypeSwitcher.cy.tsx | 4 +- .../cypress/support/browserIconCommands.ts | 41 +++ .../cypress/support/component.ts | 1 + .../frontend-shared/cypress/support/e2e.ts | 1 + packages/frontend-shared/package.json | 3 +- .../src/assets/browserLogos.ts | 65 +++-- .../logos/browser-chrome-for-testing_x16.svg | 33 --- .../src/assets/logos/generic-browser.svg | 15 - .../src/gql-components/topnav/TopNav.vue | 6 +- .../src/gql-components/topnav/TopNavList.vue | 4 +- .../topnav/VerticalBrowserListItems.vue | 8 +- packages/launchpad/package.json | 2 +- .../src/setup/OpenBrowserList.cy.tsx | 3 +- .../launchpad/src/setup/OpenBrowserList.vue | 6 +- yarn.lock | 271 ++++++++---------- 29 files changed, 263 insertions(+), 327 deletions(-) create mode 100644 packages/frontend-shared/cypress/support/browserIconCommands.ts delete mode 100644 packages/frontend-shared/src/assets/logos/browser-chrome-for-testing_x16.svg delete mode 100644 packages/frontend-shared/src/assets/logos/generic-browser.svg diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index ee9a11991dcb..17722b2a32bb 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,4 +1,12 @@ +## 13.17.1 + +_Released 12/31/2024 (PENDING)_ + +**Misc:** + +- Updated to use Cypress design system browser icons. Addressed in [#30790](https://github.com/cypress-io/cypress/pull/30790). + ## 13.17.0 _Released 12/17/2024_ diff --git a/packages/app/cypress/component/support/index.ts b/packages/app/cypress/component/support/index.ts index 18d1ee68dad2..8b8fcfdda03a 100644 --- a/packages/app/cypress/component/support/index.ts +++ b/packages/app/cypress/component/support/index.ts @@ -1,22 +1,6 @@ /// import '../../../../frontend-shared/cypress/support/component.ts' import { registerMountFn } from '@packages/frontend-shared/cypress/support/common' -// *********************************************************** -// This example support/index.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: import { createRouter } from '../../../src/router/router' import { createPinia } from '../../../src/store' diff --git a/packages/app/cypress/e2e/support/e2eSupport.ts b/packages/app/cypress/e2e/support/e2eSupport.ts index 97620266165a..77f63d49f18c 100644 --- a/packages/app/cypress/e2e/support/e2eSupport.ts +++ b/packages/app/cypress/e2e/support/e2eSupport.ts @@ -20,7 +20,7 @@ beforeEach(() => { function e2eTestingTypeIsSelected () { cy.findByTestId('specs-testing-type-header').within(() => { cy.findByTestId('testing-type-switch').contains('button', 'E2E').should('have.attr', 'aria-selected', 'true') - cy.findByTestId('testing-type-switch').contains('button', 'Component').should('not.have.attr', 'aria-selected') + cy.findByTestId('testing-type-switch').contains('button', 'Component').should('have.attr', 'aria-selected', 'false') }) } @@ -28,7 +28,7 @@ Cypress.Commands.add('verifyE2ESelected', e2eTestingTypeIsSelected) function ctTestingTypeIsSelected () { cy.findByTestId('specs-testing-type-header').within(() => { - cy.findByTestId('testing-type-switch').contains('button', 'E2E').should('not.have.attr', 'aria-selected') + cy.findByTestId('testing-type-switch').contains('button', 'E2E').should('have.attr', 'aria-selected', 'false') cy.findByTestId('testing-type-switch').contains('button', 'Component').should('have.attr', 'aria-selected', 'true') }) } diff --git a/packages/app/cypress/e2e/top-nav.cy.ts b/packages/app/cypress/e2e/top-nav.cy.ts index 52ec9e8d7b03..24d0d60b4a6b 100644 --- a/packages/app/cypress/e2e/top-nav.cy.ts +++ b/packages/app/cypress/e2e/top-nav.cy.ts @@ -3,6 +3,7 @@ import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json' import { CYPRESS_REMOTE_MANIFEST_URL, NPM_CYPRESS_REGISTRY_URL } from '@packages/types' import type Sinon from 'sinon' import { dayjs } from '../../src/runs/utils/day' +import { cyBrowserMozillaFirefoxX16, cyBrowserChromeX16 } from '@cypress-design/icon-registry' const pkg = require('@packages/root') @@ -40,9 +41,9 @@ describe('App Top Nav Workflows', () => { cy.visitApp() cy.specsPageIsVisible() - cy.findByTestId('top-nav-active-browser-icon') - .should('have.attr', 'src') - .and('contain', 'firefox') + cy.findByTestId('top-nav-active-browser-icon').children() + .verifyBrowserIconSvg(cyBrowserMozillaFirefoxX16.data) + .get('title').should('contain', 'Firefox') cy.findByTestId('top-nav-active-browser').should('contain', 'Firefox 6') }) @@ -63,8 +64,9 @@ describe('App Top Nav Workflows', () => { }) it('shows the current browser in the top nav browser list button', () => { - cy.findByTestId('top-nav-active-browser-icon') - .should('have.attr', 'src') + cy.findByTestId('top-nav-active-browser-icon').children() + .verifyBrowserIconSvg(cyBrowserChromeX16.data) + .get('title').should('contain', 'Chrome') cy.findByTestId('top-nav-active-browser').should('contain', 'Chrome 1') }) diff --git a/packages/app/package.json b/packages/app/package.json index caf28bb0cc2c..bc84d3851d03 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -21,10 +21,10 @@ }, "dependencies": {}, "devDependencies": { - "@cypress-design/vue-button": "^0.11.6", - "@cypress-design/vue-icon": "^0.26.0", - "@cypress-design/vue-statusicon": "^0.5.7", - "@cypress-design/vue-tabs": "^0.5.1", + "@cypress-design/vue-button": "^1.1.0", + "@cypress-design/vue-icon": "^1.6.0", + "@cypress-design/vue-statusicon": "^1.0.0", + "@cypress-design/vue-tabs": "^1.2.2", "@faker-js/faker": "8.4.1", "@graphql-typed-document-node/core": "^3.1.0", "@headlessui/vue": "1.4.0", diff --git a/packages/app/src/debug/LayeredBrowserIcons.cy.tsx b/packages/app/src/debug/LayeredBrowserIcons.cy.tsx index 410812b46532..c1d9e2e5af04 100644 --- a/packages/app/src/debug/LayeredBrowserIcons.cy.tsx +++ b/packages/app/src/debug/LayeredBrowserIcons.cy.tsx @@ -1,8 +1,7 @@ import LayeredBrowserIcons from './LayeredBrowserIcons.vue' -import type { BrowserType } from './LayeredBrowserIcons.vue' describe('', () => { - const browsers: BrowserType[] = ['CHROME', 'CHROME BETA', 'CANARY', 'CHROME CANARY', 'CHROME FOR TESTING', 'CUSTOM CHROME FOR TESTING', 'CHROMIUM', 'CUSTOM CHROMIUM', 'EDGE', 'EDGE BETA', 'EDGE CANARY', 'EDGE DEV', 'ELECTRON', 'FIREFOX', 'FIREFOX DEVELOPER EDITION', 'FIREFOX NIGHTLY', 'WEBKIT'] + const browsers: string[] = ['CHROME', 'CHROME BETA', 'CANARY', 'CHROME CANARY', 'CHROME FOR TESTING', 'CUSTOM CHROME FOR TESTING', 'CHROMIUM', 'CUSTOM CHROMIUM', 'EDGE', 'EDGE BETA', 'EDGE CANARY', 'EDGE DEV', 'ELECTRON', 'FIREFOX', 'FIREFOX DEVELOPER EDITION', 'FIREFOX NIGHTLY', 'WEBKIT'] it('mounts correctly for single browser', () => { browsers.forEach((ele) => { diff --git a/packages/app/src/debug/LayeredBrowserIcons.vue b/packages/app/src/debug/LayeredBrowserIcons.vue index 4cb4032cd3b1..2e075ee48225 100644 --- a/packages/app/src/debug/LayeredBrowserIcons.vue +++ b/packages/app/src/debug/LayeredBrowserIcons.vue @@ -20,22 +20,10 @@ diff --git a/packages/app/src/runner/SpecRunnerHeaderOpenMode.cy.tsx b/packages/app/src/runner/SpecRunnerHeaderOpenMode.cy.tsx index be1bb84a1d39..727bfc7dc7fc 100644 --- a/packages/app/src/runner/SpecRunnerHeaderOpenMode.cy.tsx +++ b/packages/app/src/runner/SpecRunnerHeaderOpenMode.cy.tsx @@ -2,8 +2,8 @@ import SpecRunnerHeaderOpenMode from './SpecRunnerHeaderOpenMode.vue' import { useAutStore } from '../store' import { SpecRunnerHeaderFragment, SpecRunnerHeaderFragmentDoc } from '../generated/graphql-test' import { createEventManager, createTestAutIframe } from '../../cypress/component/support/ctSupport' -import { allBrowsersIcons } from '@packages/frontend-shared/src/assets/browserLogos' import { ExternalLink_OpenExternalDocument } from '@packages/frontend-shared/src/generated/graphql' +import { cyGeneralGlobeX16 } from '@cypress-design/icon-registry' function renderWithGql (gqlVal: SpecRunnerHeaderFragment) { const eventManager = createEventManager() @@ -227,8 +227,7 @@ describe('SpecRunnerHeaderOpenMode', { viewportHeight: 500 }, () => { cy.findByTestId('select-browser').contains('Fake Browser') - cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.generic) - + cy.get('[data-cy="select-browser"] > button svg').eq(0).children().verifyBrowserIconSvg(cyGeneralGlobeX16.data) cy.findByTestId('viewport').contains('500x500') }) diff --git a/packages/app/src/runner/SpecRunnerHeaderOpenMode.vue b/packages/app/src/runner/SpecRunnerHeaderOpenMode.vue index 5c74700bf3d2..df1435a01b8f 100644 --- a/packages/app/src/runner/SpecRunnerHeaderOpenMode.vue +++ b/packages/app/src/runner/SpecRunnerHeaderOpenMode.vue @@ -63,11 +63,11 @@ :disabled="autStore.isRunning" > diff --git a/packages/app/src/runner/SpecRunnerHeaderRunMode.cy.tsx b/packages/app/src/runner/SpecRunnerHeaderRunMode.cy.tsx index e534f6e83ed2..7359c6a0e30a 100644 --- a/packages/app/src/runner/SpecRunnerHeaderRunMode.cy.tsx +++ b/packages/app/src/runner/SpecRunnerHeaderRunMode.cy.tsx @@ -1,6 +1,6 @@ import SpecRunnerHeaderRunMode from './SpecRunnerHeaderRunMode.vue' import { useAutStore } from '../store' -import { allBrowsersIcons } from '@packages/frontend-shared/src/assets/browserLogos' +import { cyGeneralGlobeX16, cyBrowserChromeX16 } from '@cypress-design/icon-registry' const browser = { displayName: 'Chrome', @@ -70,7 +70,7 @@ describe('SpecRunnerHeaderRunMode', { viewportHeight: 500 }, () => { cy.mount() - cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.Chrome) + cy.get('[data-cy="select-browser"] > button svg').eq(0).children().verifyBrowserIconSvg(cyBrowserChromeX16.data) cy.get('[data-cy="select-browser"] > button').should('be.disabled') }) }) @@ -86,7 +86,7 @@ describe('SpecRunnerHeaderRunMode', { viewportHeight: 500 }, () => { cy.mount() - cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.generic) + cy.get('[data-cy="select-browser"] > button svg').eq(0).children().verifyBrowserIconSvg(cyGeneralGlobeX16.data) cy.get('[data-cy="select-browser"] > button').should('be.disabled') }) }) diff --git a/packages/app/src/runner/SpecRunnerHeaderRunMode.vue b/packages/app/src/runner/SpecRunnerHeaderRunMode.vue index 8f9a53ca796f..ed2ba4781733 100644 --- a/packages/app/src/runner/SpecRunnerHeaderRunMode.vue +++ b/packages/app/src/runner/SpecRunnerHeaderRunMode.vue @@ -29,12 +29,12 @@ :disabled="autStore.isRunning" > { it('should render', () => { @@ -50,7 +50,7 @@ describe('AutomationMissing', () => { }, }) - cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.generic) + cy.get('[data-cy="select-browser"] > button svg').eq(0).children().verifyBrowserIconSvg(cyGeneralGlobeX16.data) cy.percySnapshot() }) }) diff --git a/packages/app/src/runner/automation/AutomationMissing.vue b/packages/app/src/runner/automation/AutomationMissing.vue index ed57e91d5d11..405669b4b6c4 100644 --- a/packages/app/src/runner/automation/AutomationMissing.vue +++ b/packages/app/src/runner/automation/AutomationMissing.vue @@ -19,10 +19,10 @@ data-cy="select-browser" > diff --git a/packages/app/src/runs/RunCard.vue b/packages/app/src/runs/RunCard.vue index a40a19a72a88..1dac4f95d8a6 100644 --- a/packages/app/src/runs/RunCard.vue +++ b/packages/app/src/runs/RunCard.vue @@ -122,7 +122,7 @@ :aria-label="t(props.debugEnabled ? 'runs.card.debugDescription' : 'runs.card.noDebugAvailable', { runNumber: run.runNumber })" @click="onDebugClick" > -