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

chore: make git message warnings remain dismissable #26812

Merged
merged 17 commits into from
Jun 5, 2023

Conversation

jordanpowell88
Copy link
Contributor

@jordanpowell88 jordanpowell88 commented May 19, 2023

Additional details

Steps to test

How has the user experience changed?

If a user dismissed either the Git Repository Not Detected or No Runs Found For Your Branch Warnings it will no longer display

PR Tasks

Comment on lines 28 to 29
...TestingPreferences
...SpecRunner_Preferences
Copy link
Contributor

Choose a reason for hiding this comment

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

These appear to just be copy/paste from other places. You don't need these fields in this component

Comment on lines 16 to 29
it('can mount', () => {
cy.mount(() => <div class="p-4"><TrackedWarning
data-testid="warning"
title={title}
message={message}
bannerId={bannerId}
/></div>)

cy.contains(title)
cy.get('[data-testid=warning]')
.should('contain.text', 'Hello!')
.and('contain.text', 'This is a markdown formatted message!')
.and('contain.text', `We're going to print out some console.log('cool code') and see how well it formats inside of our warning.`)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to retest the Warning functionality here. Just keep the test around the dismiss functionality.

Comment on lines 57 to 37
it('renders with a Learn more Link', () => {
// eslint-disable-next-line prefer-template
const messagePlusLink = message + '[Learn more](https://on.cypress.io/git-info)'

cy.mount(() => (<div class="p-4"><TrackedWarning
data-testid="warning"
title={title}
message={messagePlusLink}
bannerId={bannerId}
/></div>))

cy.contains('Learn more').should('have.attr', 'href', 'https://on.cypress.io/git-info')
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need this duplicate test from Warning

@jordanpowell88 jordanpowell88 marked this pull request as ready for review May 19, 2023 18:08
@jordanpowell88 jordanpowell88 requested review from warrensplayer and a team May 19, 2023 18:08
cli/CHANGELOG.md Outdated
Comment on lines 8 to 10
- Add Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Fixes [#26680](https://github.com/cypress-io/cypress/issues/26680).

- Never show one of the git-related message on the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) after it has been dismissed. Fixes[26808](https://github.com/cypress-io/cypress/issues/26808)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Add Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Fixes [#26680](https://github.com/cypress-io/cypress/issues/26680).
- Never show one of the git-related message on the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) after it has been dismissed. Fixes[26808](https://github.com/cypress-io/cypress/issues/26808)
- Add Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Addresses [#26680](https://github.com/cypress-io/cypress/issues/26680) and [26808](https://github.com/cypress-io/cypress/issues/26808).

These are the same feature from the user's perspective, no need to have a separate changelog entry. And features should use "addresses" rather than "fixes".

@@ -0,0 +1,62 @@
<template>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we not able to use the existing TrackedBanner and pass a status of warning to get this same behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

☝️ bump @jordanpowell88 . Seems like this is the exact same as TrackedBanner minus the "shown" event being recorded. Couldn't we just add a prop to TrackedBanner to disable those?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mike-plummer I suggested to Jordan to create a new component for this based on TrackedBanner, but looking at it more, I think you are correct. @jordanpowell88 Can you implement Mike's suggestion. If this does not make the release, then it is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed changes which moves this logic to the TrackedBanner @mike-plummer @warrensplayer

Comment on lines 46 to 47
...TestingPreferences
...SpecRunner_Preferences
Copy link
Contributor

Choose a reason for hiding this comment

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

Why removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I removed the wrong ones thanks for catching this

v-if="userProjectStatusStore.cloudStatusMatches('needsRecordedRun') && userProjectStatusStore.project.isUsingGit"
:title="t('runs.empty.noRunsFoundForBranch')"
:message="noRunsForBranchMessage"
banner-id="aci_052023_noRunsFoundForBranch"
Copy link
Contributor

Choose a reason for hiding this comment

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

Add new banner IDs to BannerIds map in packages/types/src/config.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, didn't know these existed. Thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

Import the values from the BannerId variables you added

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done in 6e5dfc2

@jordanpowell88 jordanpowell88 force-pushed the jordanpowell88/git-message-remain-dismissable branch from fbe6624 to c510ac1 Compare May 19, 2023 19:56
@@ -48,6 +48,8 @@ export const BannerIds = {
ACI_082022_CONNECT_PROJECT: 'aci_082022_connectProject',
ACI_082022_RECORD: 'aci_082022_record',
CT_052023_AVAILABLE: 'ct_052023_available',
ACI_052023_No_Runs_Found_For_Branch: 'aci_052023_noRunsFoundForBranch',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but the pattern is the variable names are all caps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6e5dfc2

v-if="!userProjectStatusStore.project.isUsingGit"
:title="t('runs.empty.gitRepositoryNotDetected')"
:message="t('runs.empty.ensureGitSetupCorrectly')"
banner-id="aci_052023_gitNotDetected"
Copy link
Contributor

Choose a reason for hiding this comment

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

Also import this value from BannerIds


cy.get('@warning').should('be.visible')
cy.get(`[aria-label=${defaultMessages.components.alert.dismissAriaLabel}`).first().click()
cy.wrap(onUpdate).should('be.called')
Copy link
Contributor

Choose a reason for hiding this comment

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

This assertion just validates that the event is propagated out of the TrackedWarning. What should be tested is that the settings are saved to the server when the warning is dismissed. See an example for the TrackedBanner here: https://github.com/cypress-io/cypress/blob/develop/packages/app/src/specs/banners/TrackedBanner.cy.tsx#L38-L63.

The cy.stubMutationResolver can track when the GraphQL mutation is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 6e5dfc2

@jordanpowell88 jordanpowell88 changed the title feat: make git message warnings remain dismissable chore: make git message warnings remain dismissable May 22, 2023
@cypress
Copy link

cypress bot commented May 22, 2023

27 flaky tests on run #47050 ↗︎

0 27307 1308 0 Flakiness 27

Details:

Merge branch 'develop' into jordanpowell88/git-message-remain-dismissable
Project: cypress Commit: 42ae2e6710
Status: Passed Duration: 20:58 💡
Started: Jun 5, 2023 4:53 PM Ended: Jun 5, 2023 5:14 PM
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox

View Output Video

Test Artifacts
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output Video
Flakiness  e2e/origin/commands/navigation.cy.ts • 1 flaky test • 5x-driver-chrome

View Output Video

Test Artifacts
cy.origin navigation > #consoleProps > .go() Output Video
Flakiness  create-from-component.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
... > runs generated spec Output Screenshots Video

The first 5 flaky specs are shown, see all 15 specs in Cypress Cloud.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@jordanpowell88 jordanpowell88 force-pushed the jordanpowell88/git-message-remain-dismissable branch from 080336b to 99e734f Compare May 30, 2023 17:31
context('when eventData is undefined', () => {
it('should not record event', () => {
cy.mount({
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={true} eventData={undefined} />,
Copy link
Contributor

Choose a reason for hiding this comment

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

To mimic the scenario being used in this PR, you would want to test with hasBannerBeenShown equal to false, correct?

Suggested change
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={true} eventData={undefined} />,
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={false} eventData={undefined} />,

Copy link
Contributor

@warrensplayer warrensplayer left a comment

Choose a reason for hiding this comment

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

Should the RunsContainer.ct.tsx tests for these banners be updated to test the dismiss buttons?

<Warning
v-if="!online"
:title="t('launchpadErrors.noInternet.header')"
:message="t('launchpadErrors.noInternet.message')"
:dismissible="false"
class="mx-auto mb-[24px]"
/>
<Warning
<TrackedBanner
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice re-use of this existing banner, forgot we had the TrackedBanner abstraction.

@warrensplayer warrensplayer dismissed mike-plummer’s stale review June 5, 2023 17:38

Jordan updated the change log and addressed the original concerns.

@jordanpowell88 jordanpowell88 merged commit d77341e into develop Jun 5, 2023
@jordanpowell88 jordanpowell88 deleted the jordanpowell88/git-message-remain-dismissable branch June 5, 2023 17:40
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 7, 2023

Released in 12.14.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v12.14.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runs page Git messages should remain dismissed
4 participants