From 5d44df4ea9f92321891532592e02b29a28a62714 Mon Sep 17 00:00:00 2001 From: amehta265 <65267668+amehta265@users.noreply.github.com> Date: Tue, 22 Nov 2022 09:45:32 -0500 Subject: [PATCH 01/40] feat: IATR-M0 Page Header (#24722) Closes https://github.com/cypress-io/cypress/issues/24442 --- packages/app/cypress/e2e/runs.cy.ts | 3 +- packages/app/src/debug/DebugPageHeader.cy.tsx | 54 ++++++ packages/app/src/debug/DebugPageHeader.vue | 155 ++++++++++++++++++ packages/app/src/debug/DebugResults.cy.tsx | 23 +++ packages/app/src/debug/DebugResults.vue | 62 +++++++ .../src/components/ResultCounts.cy.tsx | 40 +++++ .../src/components/ResultCounts.vue | 73 ++++++--- 7 files changed, 382 insertions(+), 28 deletions(-) create mode 100644 packages/app/src/debug/DebugPageHeader.cy.tsx create mode 100644 packages/app/src/debug/DebugPageHeader.vue create mode 100644 packages/app/src/debug/DebugResults.cy.tsx create mode 100644 packages/app/src/debug/DebugResults.vue diff --git a/packages/app/cypress/e2e/runs.cy.ts b/packages/app/cypress/e2e/runs.cy.ts index 9ce00b553bae..ff847405df59 100644 --- a/packages/app/cypress/e2e/runs.cy.ts +++ b/packages/app/cypress/e2e/runs.cy.ts @@ -922,7 +922,8 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { completeNext(1) }) - itSkipIfWindows('should fetch newer runs and maintain them when navigating', () => { + // TODO: unskip https://github.com/cypress-io/cypress/issues/24575 + it.skip('should fetch newer runs and maintain them when navigating', () => { cy.get('[data-cy="run-card-icon-RUNNING"]').should('have.length', RUNNING_COUNT).should('be.visible') cy.remoteGraphQLIntercept(async (obj) => { diff --git a/packages/app/src/debug/DebugPageHeader.cy.tsx b/packages/app/src/debug/DebugPageHeader.cy.tsx new file mode 100644 index 000000000000..14ebb3bb5edd --- /dev/null +++ b/packages/app/src/debug/DebugPageHeader.cy.tsx @@ -0,0 +1,54 @@ +import { DebugPageFragmentDoc } from '../generated/graphql-test' +import DebugPageHeader from './DebugPageHeader.vue' + +const defaults = [ + { attr: 'debug-header-branch', text: 'Branch Name: feature/DESIGN-183' }, + { attr: 'debug-header-commitHash', text: 'Commit Hash: b5e6fde' }, + { attr: 'debug-header-author', text: 'Commit Author: cypressDTest' }, + { attr: 'debug-header-createdAt', text: 'Run Total Duration: 60000 (an hour ago) ' }, +] + +describe('', { + viewportWidth: 1032, +}, +() => { + it('renders with passed in gql props', () => { + cy.mountFragment(DebugPageFragmentDoc, { + onResult (result) { + if (result) { + if (result.commitInfo) { + result.commitInfo.summary = 'Adding a hover state to the button component' + result.commitInfo.branch = 'feature/DESIGN-183' + result.commitInfo.authorName = 'cypressDTest' + } + } + }, + render: (gqlVal) => { + return ( + + ) + }, + }) + + cy.findByTestId('debug-header').children().should('have.length', 2) + cy.findByTestId('debug-test-summary') + .should('have.text', 'Adding a hover state to the button component') + + cy.findByTestId('debug-runCommit-info').children().should('have.length', 3) + cy.findByTestId('debug-runNumber') + .should('have.text', ' Run #468') + .should('have.css', 'color', 'rgb(90, 95, 122)') + + cy.findByTestId('debug-commitsAhead') + .should('have.text', 'You are 2 commits ahead') + .should('have.css', 'color', 'rgb(189, 88, 0)') + + cy.findByTestId('debug-results').should('be.visible') + + defaults.forEach((obj) => { + cy.findByTestId(obj.attr) + .should('have.text', obj.text) + .children().should('have.length', 2) + }) + }) +}) diff --git a/packages/app/src/debug/DebugPageHeader.vue b/packages/app/src/debug/DebugPageHeader.vue new file mode 100644 index 000000000000..f84e9e667612 --- /dev/null +++ b/packages/app/src/debug/DebugPageHeader.vue @@ -0,0 +1,155 @@ + + + diff --git a/packages/app/src/debug/DebugResults.cy.tsx b/packages/app/src/debug/DebugResults.cy.tsx new file mode 100644 index 000000000000..c6447c49faf7 --- /dev/null +++ b/packages/app/src/debug/DebugResults.cy.tsx @@ -0,0 +1,23 @@ +import DebugResults from './DebugResults.vue' +import { defaultMessages } from '@cy/i18n' +import { CloudRunStubs } from '@packages/graphql/test/stubCloudTypes' + +describe('', () => { + it('shows the failed icon and the number of passed, skipped, pending, failed tests passed through gql props', () => { + const cloudRuns = Object.values(CloudRunStubs) + + cy.mount(() => cloudRuns.map((cloudRun, i) => ())) + + cloudRuns.forEach((cloudRun, i) => { + cy.findByTestId(`run-result-${i}`).within(() => { + cy.get(`[title=${defaultMessages.runs.results.passed}]`).should('contain.text', cloudRun.totalPassed) + cy.get(`[title=${defaultMessages.runs.results.failed}]`).should('contain.text', cloudRun.totalFailed) + cy.get(`[title=${defaultMessages.runs.results.skipped}]`).should('contain.text', cloudRun.totalSkipped) + cy.get(`[title=${defaultMessages.runs.results.pending}]`).should('contain.text', cloudRun.totalPending) + cy.findByTestId('icon-prefix').should('exist') + }) + }) + + cy.percySnapshot() + }) +}) diff --git a/packages/app/src/debug/DebugResults.vue b/packages/app/src/debug/DebugResults.vue new file mode 100644 index 000000000000..ddb2f4599fe9 --- /dev/null +++ b/packages/app/src/debug/DebugResults.vue @@ -0,0 +1,62 @@ + + + diff --git a/packages/frontend-shared/src/components/ResultCounts.cy.tsx b/packages/frontend-shared/src/components/ResultCounts.cy.tsx index 65608cd61337..e8fb154c89ac 100644 --- a/packages/frontend-shared/src/components/ResultCounts.cy.tsx +++ b/packages/frontend-shared/src/components/ResultCounts.cy.tsx @@ -49,4 +49,44 @@ describe('', () => { cy.percySnapshot() }) + + it('changes order of status signs with the order prop', () => { + cy.mount(() => ( + + )) + + cy.get('[data-cy=result-count]').children().then((status) => { + expect(status[0]).to.contain(6) + expect(status[1]).to.contain(3) + expect(status[2]).to.contain(4) + expect(status[3]).to.contain(5) + }) + }) + + const slotContent = { + prefix: () =>
Prefix
, + } + + it('tests if the prefix slot shows up in the Result counts', () => { + cy.mount(() => ( + + )) + + cy.findByText('Prefix').should('be.visible') + }) }) diff --git a/packages/frontend-shared/src/components/ResultCounts.vue b/packages/frontend-shared/src/components/ResultCounts.vue index bbe5a211657e..939d3974d8c1 100644 --- a/packages/frontend-shared/src/components/ResultCounts.vue +++ b/packages/frontend-shared/src/components/ResultCounts.vue @@ -1,5 +1,9 @@