-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
chore: make git message warnings remain dismissable #26812
Conversation
...TestingPreferences | ||
...SpecRunner_Preferences |
There was a problem hiding this comment.
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
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.`) | ||
}) |
There was a problem hiding this comment.
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.
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') | ||
}) |
There was a problem hiding this comment.
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
cli/CHANGELOG.md
Outdated
- 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
...TestingPreferences | ||
...SpecRunner_Preferences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
fbe6624
to
c510ac1
Compare
packages/types/src/config.ts
Outdated
@@ -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', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 6e5dfc2
27 flaky tests on run #47050 ↗︎Details:
|
Test | Artifacts | |
---|---|---|
network stubbing > intercepting request > can delay and throttle a StaticResponse |
Output
|
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox
Test | Artifacts | |
---|---|---|
... > correctly returns currentRetry |
Output
|
|
... > correctly returns currentRetry |
Output
|
|
... > correctly returns currentRetry |
Output
|
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-chrome
Test | Artifacts | |
---|---|---|
network stubbing > intercepting request > can delay and throttle a StaticResponse |
Output
Video
|
e2e/origin/commands/navigation.cy.ts • 1 flaky test • 5x-driver-chrome
Test | Artifacts | |
---|---|---|
cy.origin navigation > #consoleProps > .go() |
Output
Video
|
create-from-component.cy.ts • 1 flaky test • app-e2e
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.
080336b
to
99e734f
Compare
context('when eventData is undefined', () => { | ||
it('should not record event', () => { | ||
cy.mount({ | ||
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={true} eventData={undefined} />, |
There was a problem hiding this comment.
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?
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={true} eventData={undefined} />, | |
render: () => <TrackedBanner bannerId="test-banner" hasBannerBeenShown={false} eventData={undefined} />, |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
Jordan updated the change log and addressed the original concerns.
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Additional details
Steps to test
How has the user experience changed?
If a user dismissed either the
Git Repository Not Detected
orNo Runs Found For Your Branch
Warnings it will no longer displayPR Tasks
cypress-documentation
?type definitions
?