Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't display run passing status if Cloud org is over run limit #26533

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _Released 04/25/2023 (PENDING)_
**Bugfixes:**

- Fixed an issue where setting `videoCompression` to `0` would cause the video output to be broken. `0` is now treated as false. Addresses [#5191](https://github.com/cypress-io/cypress/issues/5191) and [#24595](https://github.com/cypress-io/cypress/issues/24595).
- Fixed an issue on the [Debug page](https://on.cypress.io/debug-page) where the passing run status would appear even if the Cypress Cloud organization was over its monthly test result limit. Addresses [#26528](https://github.com/cypress-io/cypress/issues/26528).

## 12.10.0

Expand Down
14 changes: 12 additions & 2 deletions packages/app/src/debug/DebugContainer.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,28 @@ describe('<DebugContainer />', () => {
it('handled usage exceeded', () => {
mountTestRun('overLimit')

cy.findByRole('link', { name: 'Contact admin' }).should('have.attr', 'href', 'http://localhost:3000?utmMedium=Debug+Tab&utmSource=Binary%3A+Launchpad')
cy.findByRole('link', { name: 'Contact admin' }).should('be.visible').should('have.attr', 'href', 'http://localhost:3000?utmMedium=Debug+Tab&utmSource=Binary%3A+Launchpad')

cy.percySnapshot()
})

it('handles retention exceeded', () => {
mountTestRun('overLimitRetention')

cy.findByRole('link', { name: 'Contact admin' }).should('have.attr', 'href', 'http://localhost:3000?utmMedium=Debug+Tab&utmSource=Binary%3A+Launchpad')
cy.findByRole('link', { name: 'Contact admin' }).should('be.visible').should('have.attr', 'href', 'http://localhost:3000?utmMedium=Debug+Tab&utmSource=Binary%3A+Launchpad')

cy.percySnapshot()
})

it('does not show passing message if run is hidden', () => {
mountTestRun('overLimitPassed')

cy.contains('Well Done!').should('not.exist')

cy.contains('All your tests passed.').should('not.exist')

cy.findByRole('link', { name: 'Contact admin' }).should('be.visible').should('have.attr', 'href', 'http://localhost:3000?utmMedium=Debug+Tab&utmSource=Binary%3A+Launchpad')
})
})

context('cancelled', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/debug/DebugPageDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
v-if="['PASSED', 'OVERLIMIT'].includes(status) || isHidden"
class="flex flex-col flex-grow w-full p-12 justify-center items-center align-middle "
>
<DebugPassed v-if="status === 'PASSED'" />
<DebugPassed v-if="status === 'PASSED' && !isHidden" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to take look to find out what constitutes isHidden - looks like this comes from the Cloud, going to assume that this value is correctly calculated (validating it is outside the scope of this repo and PR).

Do you have any context/knowledge of how this is calculated?

Code looks good!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have switched the order with the DebugOverLimit below and then added a v-else-if="status === 'PASSED'", but this works just fine.

<DebugOverLimit
v-if="isHidden"
:over-limit-reasons="reasonsRunIsHidden"
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/test/stubCloudTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ export const CloudRunStubs = {
timedOutWithoutCi: createCloudRun({ status: 'TIMEDOUT', specs: skippedSpecs }),
overLimit: createCloudRun({ status: 'OVERLIMIT', overLimitActionType: 'CONTACT_ADMIN', overLimitActionUrl: 'http://localhost:3000', isHidden: true, reasonsRunIsHidden: [{ __typename: 'UsageLimitExceeded', monthlyTests: 100 }] }),
overLimitRetention: createCloudRun({ status: 'OVERLIMIT', overLimitActionType: 'CONTACT_ADMIN', overLimitActionUrl: 'http://localhost:3000', isHidden: true, reasonsRunIsHidden: [{ __typename: 'DataRetentionLimitExceeded', dataRetentionDays: 10 }] }),
overLimitPassed: createCloudRun({ status: 'PASSED', overLimitActionType: 'CONTACT_ADMIN', overLimitActionUrl: 'http://localhost:3000', isHidden: true, reasonsRunIsHidden: [{ __typename: 'UsageLimitExceeded', monthlyTests: 100 }] }),
cancelled: createCloudRun({ status: 'CANCELLED', cancelledAt: '2019-01-25T02:00:00.000Z', specs: skippedSpecs, cancelledBy: { id: '123', fullName: 'Test Tester', email: '[email protected]', __typename: 'CloudUser', userIsViewer: true } }),
} as Record<string, Required<CloudRun>>

Expand Down