Skip to content

Commit

Permalink
chore: remove more low value percy snapshots [run ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanpowell88 committed Jun 5, 2023
1 parent 46c72a4 commit e006730
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 94 deletions.
12 changes: 7 additions & 5 deletions packages/app/src/components/Blank.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ describe('initial', () => {
})

describe('testIsolationBlankPage', () => {
it('works', () => {
beforeEach(() => {
getContainerEl()!.innerHTML = testIsolationBlankPage()

cy.get('[data-cy="cypress-logo"]')
cy.get('[data-cy="text"]').should('have.text', 'Default blank page')
cy.get('[data-cy="subtext"]').should('have.text', 'This page was cleared by navigating to about:blank.All active session data (cookies, localStorage and sessionStorage) across all domains are cleared.')
})

it('works', () => {
cy.percySnapshot()
})

it('works with small viewport', () => {
cy.viewport(200, 500)
getContainerEl()!.innerHTML = testIsolationBlankPage()

cy.percySnapshot()
})
Expand All @@ -35,13 +35,15 @@ describe('testIsolationBlankPage', () => {
describe('visitFailure', () => {
it('works', () => {
getContainerEl()!.innerHTML = visitFailure({ url: 'http://foo.cypress.io' })

cy.percySnapshot()
})

it('works with details', () => {
getContainerEl()!.innerHTML = visitFailure({ url: 'http://foo.cypress.io', status: 404, statusText: 'Not Found', contentType: 'text/html' })

cy.get('p').contains('Sorry, we could not load:')
cy.get('a').contains('http://foo.cypress.io').should('have.attr', 'href', 'http://foo.cypress.io')
cy.get('p').contains('404 - Not Found (text/html)')

cy.percySnapshot()
})
})
56 changes: 41 additions & 15 deletions packages/app/src/debug/DebugRunStates.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,60 @@ describe('Debug page states', () => {
it('renders', () => {
cy.mount(<DebugPassed />)

cy.percySnapshot()
cy.contains('Well Done!')
cy.contains('All your tests passed')
})
})

context('errored', () => {
it('renders for single spec', () => {
cy.mount(<DebugErrored errors={[mockError]} totalSkippedSpecs={1} totalSpecs={1} />)

cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Incomplete')
cy.contains(mockError)
cy.contains('1 of 1 spec skipped').should('be.visible')

cy.percySnapshot()
})

it('renders for plural specs', () => {
cy.mount(<DebugErrored errors={[mockError]} totalSkippedSpecs={4} totalSpecs={50} />)

cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Incomplete')
cy.contains(mockError)
cy.contains('4 of 50 specs skipped').should('be.visible')

cy.percySnapshot()
})
})

context('no tests', () => {
it('renders', () => {
cy.mount(<DebugNoTests />)

cy.percySnapshot()
cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Incomplete')
cy.contains('Run has no tests')
})
})

context('timed out', () => {
it('renders without CI information', () => {
cy.mount(<DebugTimedout totalSkippedSpecs={4} totalSpecs={50} />)

cy.percySnapshot()
cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Incomplete')
cy.contains('The run started but never completed. This can happen when the run is cancelled from CI or when Cypress crashes while running tests. Archive this run to remove it from the runs list and analytics.')
cy.contains('4 of 50 specs skipped')
})

it('renders with CI information', () => {
cy.mount(<DebugTimedout
ci={{ id: '123', url: 'https://circleci.com/', formattedProvider: 'CircleCI', ciBuildNumberFormatted: '12345' }} totalSkippedSpecs={4} totalSpecs={50} />)

cy.percySnapshot()
cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Incomplete')
cy.contains('The run started but never completed. This can happen when the run is cancelled from CI or when Cypress crashes while running tests. Check your CircleCI #12345 logs for more information. Archive this run to remove it from the runs list and analytics.')
cy.findByTestId('external').contains('CircleCI #12345').should('have.attr', 'href', 'https://circleci.com/')
cy.contains('4 of 50 specs skipped')
})
})

Expand All @@ -87,7 +99,9 @@ describe('Debug page states', () => {
/>,
)

cy.percySnapshot()
cy.contains('You\'ve reached your monthly test result limit')
cy.contains('Your Free Cypress Cloud plan includes 100 monthly recorded test results. Contact your Cypress Cloud admin to upgrade your plan and view more test results.')
cy.findByTestId('external').contains('Contact admin')
})

it('displays messaging for plan admins', () => {
Expand All @@ -103,7 +117,9 @@ describe('Debug page states', () => {
/>,
)

cy.percySnapshot()
cy.contains('You\'ve reached your monthly test result limit')
cy.contains('Your Free Cypress Cloud plan includes 100 monthly recorded test results. Upgrade your plan now to view more test results.')
cy.findByTestId('external').contains('Upgrade plan')
})
})

Expand All @@ -121,7 +137,9 @@ describe('Debug page states', () => {
/>,
)

cy.percySnapshot()
cy.contains('Beyond data retention')
cy.contains('Your data retention limit is 30 days and these tests ran 60 days ago. Upgrade your plan to increase your data retention limit.')
cy.findByTestId('external').contains('Contact admin')
})

it('displays messaging for plan admins', () => {
Expand All @@ -137,7 +155,9 @@ describe('Debug page states', () => {
/>,
)

cy.percySnapshot()
cy.contains('Beyond data retention')
cy.contains('Your data retention limit is 30 days and these tests ran 60 days ago. Upgrade your plan to increase your data retention limit.')
cy.findByTestId('external').contains('Upgrade plan')
})
})

Expand All @@ -158,16 +178,22 @@ describe('Debug page states', () => {
/>,
)

cy.percySnapshot()
cy.contains('You\'ve reached your monthly test result limit')
cy.contains('Your Free Cypress Cloud plan includes 30 monthly recorded test results. Upgrade your plan now to view more test results.')
cy.findByTestId('external').contains('Upgrade plan')
})
})
})

context('cancelled', () => {
it('renders', () => {
cy.mount(<DebugCancelledAlert totalSpecs={5} totalSkippedSpecs={2} cancellation={{ cancelledAt: '2019-01-25T02:00:00.000Z', cancelledBy: { email: '[email protected]', fullName: 'Test Tester' } }} />)

cy.percySnapshot()
cy.findByTestId('collapsible').should('be.visible')
cy.get('h3').contains('Manually cancelled')
cy.contains('2 of 5 specs skipped')
cy.findByTestId('cancelled-by-user-avatar').should('have.attr', 'style', 'background-image: url("https://s.gravatar.com/avatar/402f6cafb6c02371c2c23c5215ae3d85?size=48&default=mm");')
cy.contains('Test Tester')
cy.contains('Jan 24, 2019 9:00 PM')
})
})
})
2 changes: 0 additions & 2 deletions packages/app/src/debug/StatsMetadata.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,5 @@ describe('<StatsMetadata />', () => {
cy.findByTestId(testingOrder[index]).should('be.visible')
}
})

cy.percySnapshot()
})
})
4 changes: 0 additions & 4 deletions packages/app/src/runner/SnapshotToggle.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,25 @@ describe('<SnapshotToggle/>', () => {

cy.mount(() => (<SnapshotToggle class="m-20" messages={messages} />))

cy.percySnapshot('before')
.get('body')
.findByText('2')
.click()
.parent()
.findByText('1')
.click()
.percySnapshot('after')
})

it('renders longer text', () => {
const messages = [{ text: 'Request', id: '1' }, { text: 'Response', id: '2' }]

cy.mount(() => (<SnapshotToggle class="m-20" messages={messages} />))

cy.percySnapshot('before')
.get('body')
.findByText('Request')
.click()
.parent()
.findByText('Response')
.click()
.percySnapshot('after')
})

it('emits a select event with the active message', () => {
Expand Down
7 changes: 2 additions & 5 deletions packages/app/src/runner/SpecRunnerHeaderRunMode.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ describe('SpecRunnerHeaderRunMode', { viewportHeight: 500 }, () => {
cy.contains('The viewport determines').should('not.exist')
cy.contains('Chrome 1').click()
cy.contains('Firefox').should('not.exist')

cy.percySnapshot()
})
})

Expand All @@ -72,9 +70,8 @@ describe('SpecRunnerHeaderRunMode', { viewportHeight: 500 }, () => {

cy.mount(<SpecRunnerHeaderRunMode />)

cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.Chrome)
cy.get('[data-cy="select-browser"] > button').should('be.disabled')

cy.percySnapshot()
})
})

Expand All @@ -90,7 +87,7 @@ describe('SpecRunnerHeaderRunMode', { viewportHeight: 500 }, () => {
cy.mount(<SpecRunnerHeaderRunMode />)

cy.get('[data-cy="select-browser"] > button img').should('have.attr', 'src', allBrowsersIcons.generic)
cy.percySnapshot()
cy.get('[data-cy="select-browser"] > button').should('be.disabled')
})
})
})
12 changes: 0 additions & 12 deletions packages/app/src/runs/RunCard.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {

cy.contains(CloudRunStubs.allPassing.commitInfo.branch as string)
.should('be.visible')

cy.percySnapshot()
})
})

Expand All @@ -100,8 +98,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {

// this is the human readable commit time from the stub
cy.contains('an hour ago').should('be.visible')

cy.percySnapshot()
})
})

Expand All @@ -122,8 +118,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {

// this is the human readable commit time from the stub
cy.contains('01:01:01').should('be.visible')

cy.percySnapshot()
})

it('displays mm:ss format for run duration if duration is less than an hour', () => {
Expand All @@ -142,8 +136,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {

// this is the human readable commit time from the stub
cy.contains('01:01').should('be.visible')

cy.percySnapshot()
})
})

Expand All @@ -163,8 +155,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {
})

cy.get('[data-cy="run-tag"]').should('have.length', 2).each(($el, i) => cy.wrap($el).contains(`tag${i}`))

cy.percySnapshot()
})

it('truncates tags if > 2', () => {
Expand All @@ -182,8 +172,6 @@ describe('<RunCard />', { viewportHeight: 400 }, () => {
})

cy.get('[data-cy="run-tag"]').should('have.length', 3).last().contains('+4')

cy.percySnapshot()
})
})
})
14 changes: 10 additions & 4 deletions packages/app/src/runs/RunsErrorRenderer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ describe('<RunsErrorRenderer />', () => {
},
})

cy.percySnapshot()
cy.contains('h2', 'Cannot connect to Cypress Cloud')
cy.contains('p', 'The request times out when trying to retrieve the recorded runs from Cypress Cloud. Please refresh the page to try again and visit out Support page if this behavior continues.')
cy.findByTestId('external').contains('Support page').should('have.attr', 'href', 'https://www.cypressstatus.com/')
cy.contains('button', 'Try again')
})

it('should show a "not found" error and opens reconnect modal', () => {
Expand All @@ -43,7 +46,6 @@ describe('<RunsErrorRenderer />', () => {
cy.contains('button', text.notFound.button).click()

cy.get('@loginConnectSpy').should('have.been.calledWith', { utmMedium: 'Runs Tab' })
cy.percySnapshot()
})

describe('unauthorized', () => {
Expand All @@ -62,7 +64,9 @@ describe('<RunsErrorRenderer />', () => {
},
})

cy.percySnapshot()
cy.contains('h2', 'Request access to view the recorded runs')
cy.contains('p', 'This is a private project that you do not currently have access to. Please request access from the project owner in order to view the list of runs.')
cy.contains('button', 'Request access')
})

it('should display an "access requested" error', () => {
Expand All @@ -81,7 +85,9 @@ describe('<RunsErrorRenderer />', () => {
},
})

cy.percySnapshot()
cy.contains('h2', 'Your access request for this project has been sent.')
cy.contains('p', 'The owner of this project has been notified of your request. We\'ll notify you via email when your access request has been granted.')
cy.contains('button', 'Request Sent').should('be.disabled')
})
})
})
3 changes: 1 addition & 2 deletions packages/app/src/settings/SettingsCard.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ describe('<SettingsCard />', () => {
))

cy.contains(collapsibleSelector, title).focus().type(' ')

cy.percySnapshot()
cy.findByTestId('setting-expanded-container').contains('The body of the content').should('be.visible')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ describe('<ExternalEditorSettings />', () => {
})

cy.findByText(editorText.noEditorSelectedPlaceholder).should('be.visible')

cy.percySnapshot()
})

it('renders the title and description', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/settings/project/CloudSettings.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ describe('<CloudSettings />', () => {
cy.findByText(defaultMessages.settingsPage.projectId.title).should('not.exist')
cy.findByText(defaultMessages.runs.connect.buttonUser).should('be.visible')
cy.findByText(defaultMessages.settingsPage.recordKey.title).should('not.exist')

cy.percySnapshot()
})

it('hides Record Key when not present', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/settings/project/ConfigCode.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ describe('<ConfigCode />', () => {
browser.minSupportedVersion && cy.contains(`minSupportedVersion: ${browser.minSupportedVersion},`)
browser.majorVersion && cy.contains(`majorVersion: ${browser.majorVersion},`)
})

cy.percySnapshot()
} else {
throw new Error('Missing browsers to render')
}
Expand Down
Loading

0 comments on commit e006730

Please sign in to comment.