diff --git a/packages/app/cypress/e2e/sidebar_navigation.cy.ts b/packages/app/cypress/e2e/sidebar_navigation.cy.ts index 86431d2c3582..ea15c74c8ca9 100644 --- a/packages/app/cypress/e2e/sidebar_navigation.cy.ts +++ b/packages/app/cypress/e2e/sidebar_navigation.cy.ts @@ -114,20 +114,20 @@ describe('Sidebar Navigation', () => { cy.findByLabelText('Sidebar').closest('[aria-expanded]').should('have.attr', 'aria-expanded', 'false') cy.get('[data-cy="sidebar-header"').trigger('mouseenter') - cy.contains('#tooltip-target > div', 'todos') + cy.contains('.v-popper--some-open--tooltip', 'todos') cy.percySnapshot() cy.get('[data-cy="sidebar-header"]').trigger('mouseout') cy.get('[data-e2e-href="/runs"]').trigger('mouseenter') - cy.contains('#tooltip-target > div', 'Runs') + cy.contains('.v-popper--some-open--tooltip', 'Runs') cy.get('[data-e2e-href="/runs"]').trigger('mouseout') cy.get('[data-e2e-href="/specs"]').trigger('mouseenter') - cy.contains('#tooltip-target > div', 'Specs') + cy.contains('.v-popper--some-open--tooltip', 'Specs') cy.get('[data-e2e-href="/specs"]').trigger('mouseout') cy.get('[data-e2e-href="/settings"]').trigger('mouseenter') - cy.contains('#tooltip-target > div', 'Settings') + cy.contains('.v-popper--some-open--tooltip', 'Settings') cy.get('[data-e2e-href="/settings"]').trigger('mouseout') }) diff --git a/packages/app/src/layouts/default.vue b/packages/app/src/layouts/default.vue index cf83d10a902c..f25b7ad725a9 100644 --- a/packages/app/src/layouts/default.vue +++ b/packages/app/src/layouts/default.vue @@ -33,7 +33,6 @@ -
- - diff --git a/packages/app/src/runner/selector-playground/SelectorPlayground.vue b/packages/app/src/runner/selector-playground/SelectorPlayground.vue index 739a5d9fe552..182f9b742e72 100644 --- a/packages/app/src/runner/selector-playground/SelectorPlayground.vue +++ b/packages/app/src/runner/selector-playground/SelectorPlayground.vue @@ -84,7 +84,14 @@
- +
@@ -133,9 +147,9 @@ import { useSelectorPlaygroundStore } from '../../store/selector-playground-stor import type { AutIframe } from '../aut-iframe' import type { EventManager } from '../event-manager' import Button from '@packages/frontend-shared/src/components/Button.vue' +import Tooltip from '@packages/frontend-shared/src/components/Tooltip.vue' import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue' import { useElementSize } from '@vueuse/core' -import SelectorPlaygroundTooltip from './SelectorPlaygroundTooltip.vue' import { useI18n } from 'vue-i18n' import { useClipboard } from '@cy/gql-components/useClipboard' diff --git a/packages/app/src/runner/selector-playground/SelectorPlaygroundTooltip.vue b/packages/app/src/runner/selector-playground/SelectorPlaygroundTooltip.vue deleted file mode 100644 index 253ddebbb680..000000000000 --- a/packages/app/src/runner/selector-playground/SelectorPlaygroundTooltip.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - - - diff --git a/packages/frontend-shared/package.json b/packages/frontend-shared/package.json index 0edaf4f693ec..d3318e6563ad 100644 --- a/packages/frontend-shared/package.json +++ b/packages/frontend-shared/package.json @@ -46,6 +46,7 @@ "dayjs": "^1.9.3", "fake-uuid": "^1.0.0", "faker": "5.5.3", + "floating-vue": "2.0.0-beta.12", "fuzzysort": "^1.1.4", "graphql": "^15.5.1", "graphql-relay": "^0.9.0", diff --git a/packages/frontend-shared/src/components/Tooltip.cy.tsx b/packages/frontend-shared/src/components/Tooltip.cy.tsx new file mode 100644 index 000000000000..7218a819295a --- /dev/null +++ b/packages/frontend-shared/src/components/Tooltip.cy.tsx @@ -0,0 +1,24 @@ +import Tooltip from './Tooltip.vue' + +const slotContents = { + popper: () => tooltip, + default: () => hello, +} + +describe('', () => { + it('playground', () => { + cy.mount(() => { + return ( +
+ {/* @ts-ignore */} + +
+ ) + }) + + cy.get('.default-slot') + .realHover() + + cy.contains('tooltip') + }) +}) diff --git a/packages/frontend-shared/src/components/Tooltip.vue b/packages/frontend-shared/src/components/Tooltip.vue new file mode 100644 index 000000000000..001d75ef5c4c --- /dev/null +++ b/packages/frontend-shared/src/components/Tooltip.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/packages/frontend-shared/src/gql-components/HeaderBarContent.cy.tsx b/packages/frontend-shared/src/gql-components/HeaderBarContent.cy.tsx index dcbb6fca659b..3df084205554 100644 --- a/packages/frontend-shared/src/gql-components/HeaderBarContent.cy.tsx +++ b/packages/frontend-shared/src/gql-components/HeaderBarContent.cy.tsx @@ -20,7 +20,7 @@ describe('', { viewportWidth: 1000, viewportHeight: 750 }, ( .should('be.visible') .closest('[data-cy="top-nav-browser-list-item"]') .within(() => { - cy.get('[data-cy="unsupported-browser-tooltip"]') + cy.get('[data-cy="unsupported-browser-tooltip-trigger"]') .should('not.exist') }) @@ -28,7 +28,7 @@ describe('', { viewportWidth: 1000, viewportHeight: 750 }, ( .should('be.visible') .closest('[data-cy="top-nav-browser-list-item"]') .within(() => { - cy.get('[data-cy="unsupported-browser-tooltip"]') + cy.get('[data-cy="unsupported-browser-tooltip-trigger"]') .should('exist') }) @@ -172,12 +172,56 @@ describe('', { viewportWidth: 1000, viewportHeight: 750 }, ( cy.contains(`${defaultMessages.topNav.updateCypress.title} 8.7.0`).should('not.exist') }) - it('displays the active project name', () => { + it('displays the active project name and testing type', () => { cy.mountFragment(HeaderBar_HeaderBarContentFragmentDoc, { render: (gqlVal) =>
, }) cy.contains('test-project').should('be.visible') + cy.contains('e2e testing', { matchCase: false }).should('be.visible') + }) + + it('displays the branch name', () => { + cy.mountFragment(HeaderBar_HeaderBarContentFragmentDoc, { + onResult: (result) => { + if (!result.currentProject) { + return + } + + result.currentProject.branch = 'develop' + }, + render: (gqlVal) => ( +
+ +
+ ), + }) + + cy.contains('develop').should('be.visible') + }) + + it('truncates the branch name if it is long', () => { + cy.mountFragment(HeaderBar_HeaderBarContentFragmentDoc, { + onResult: (result) => { + if (!result.currentProject) { + return + } + + result.currentProject.branch = 'application-program/hard-drive-parse' + }, + render: (gqlVal) => ( +
+ +
+ ), + }) + + cy.get('.truncate').contains('application-program/hard-drive-parse').should('be.visible') + + cy.percySnapshot() + + cy.get('.truncate').realHover() + cy.get('.v-popper__popper--shown').contains('application-program/hard-drive-parse') }) it('the login modal reaches "opening browser" status', () => { diff --git a/packages/frontend-shared/src/gql-components/HeaderBarContent.vue b/packages/frontend-shared/src/gql-components/HeaderBarContent.vue index b089be86f5d4..09f60815a676 100644 --- a/packages/frontend-shared/src/gql-components/HeaderBarContent.vue +++ b/packages/frontend-shared/src/gql-components/HeaderBarContent.vue @@ -1,5 +1,8 @@ @@ -79,7 +82,7 @@ import type { VerticalBrowserListItemsFragment } from '../../generated/graphql' import { computed } from 'vue' import { gql, useMutation } from '@urql/vue' import { allBrowsersIcons } from '@packages/frontend-shared/src/assets/browserLogos' -import UnsupportedBrowserTooltip from './UnsupportedBrowserTooltip.vue' +import Tooltip from '../../components/Tooltip.vue' import sortBrowsers from '@packages/frontend-shared/src/utils/sortBrowsers' const { t } = useI18n() diff --git a/packages/launchpad/cypress/e2e/open-mode.cy.ts b/packages/launchpad/cypress/e2e/open-mode.cy.ts index 2ee3d9b75cc0..939944408c95 100644 --- a/packages/launchpad/cypress/e2e/open-mode.cy.ts +++ b/packages/launchpad/cypress/e2e/open-mode.cy.ts @@ -23,6 +23,7 @@ describe('Launchpad: Open Mode', () => { cy.scaffoldProject('todos') cy.openProject('todos', ['--e2e']) cy.visitLaunchpad() + cy.get('[data-cy=header-bar-content]').contains('e2e testing', { matchCase: false }) // e2e testing is configured for the todo project, so we don't expect an error. cy.get('h1').should('contain', 'Choose a Browser') }) @@ -31,6 +32,7 @@ describe('Launchpad: Open Mode', () => { cy.scaffoldProject('launchpad') cy.openProject('launchpad', ['--component']) cy.visitLaunchpad() + cy.get('[data-cy=header-bar-content]').contains('component testing', { matchCase: false }) // Component testing is not configured for the todo project cy.get('h1').should('contain', 'Project Setup') }) diff --git a/packages/launchpad/src/setup/OpenBrowserList.cy.tsx b/packages/launchpad/src/setup/OpenBrowserList.cy.tsx index 7b8c2d6a7cd4..b8e0ab9b84ff 100644 --- a/packages/launchpad/src/setup/OpenBrowserList.cy.tsx +++ b/packages/launchpad/src/setup/OpenBrowserList.cy.tsx @@ -45,8 +45,10 @@ describe('', () => { ), }) - cy.get('[data-cy-browser="firefox"]:nth(2) [data-cy="unsupported-browser-tooltip"]') + cy.get('[data-cy-browser="firefox"]:nth(2) [data-cy="unsupported-browser-tooltip-trigger"]') .trigger('mouseenter') + + cy.get('.v-popper__popper--shown') .contains('Cypress does not support running Firefox Developer Edition version 69.') cy.percySnapshot() diff --git a/packages/launchpad/src/setup/OpenBrowserList.vue b/packages/launchpad/src/setup/OpenBrowserList.vue index a74ed66bca56..c148501549e1 100644 --- a/packages/launchpad/src/setup/OpenBrowserList.vue +++ b/packages/launchpad/src/setup/OpenBrowserList.vue @@ -26,25 +26,24 @@ 'border-gray-200 before:hocus:cursor-pointer hover:border-indigo-300 hover:ring-2 hover:ring-indigo-100': !browser.disabled && browser.isVersionSupported && !checked && !browserStatus.chosen }" > - - +