test [M3-10073]: Linode alerts tab based on region and linode.alerts - #12511
Merged
dmcintyr-akamai merged 42 commits intoJul 22, 2025
Conversation
…nager into M3-10073_alerts_prefs
…nager into M3-10073_alerts_prefs
…nager into M3-10073_alerts_prefs
4 tasks
4 tasks
dmcintyr-akamai
requested review from
bnussman-akamai,
jdamore-linode and
pmakode-akamai
and removed request for
a team
July 15, 2025 11:40
bnussman-akamai
approved these changes
Jul 15, 2025
4 tasks
…nager into M3-10073_alerts_prefs
…nager into M3-10073_alerts_prefs
Cloud Manager UI test results🎉 689 passing tests on test run #15 ↗︎
|
pmakode-akamai
approved these changes
Jul 22, 2025
| * Legacy alerts = 0, Beta alerts = [] (empty arrays or no values at all) => legacy disabled for `beta` stage OR beta disabled for `ga` stage | ||
| * Legacy alerts > 0, Beta alerts = [] (empty arrays or no values at all) => legacy enabled | ||
| * Legacy alerts = 0, Beta alerts has values (either system, user, or both) => beta enabled | ||
| * Legacy alerts > 0, Beta alerts has values (either system, user, or both) => beta enabled |
Contributor
There was a problem hiding this comment.
Suggested change
| * Legacy alerts > 0, Beta alerts has values (either system, user, or both) => beta enabled |
This case -- where both legacy and beta have values -- will no longer occur. We can remove this comment.
Comment on lines
+238
to
+255
| // ui.dialog | ||
| // .findByTitle('Save Alerts?') | ||
| // .should('be.visible') | ||
| // .within(() => { | ||
| // ui.button.findByTitle('Save').should('be.visible') | ||
| // .click(); | ||
| // }); | ||
| // TODO: content of request.body not match prod, 'alerts' attribute missing here | ||
| // cy.wait('@updateLinode').then((xhr) => { | ||
| // // can save changes. new beta alerts added in assertLinodeAlertsEnabled tests | ||
| // const edits = xhr.request.body; | ||
| // expect(JSON.stringify(edits.system)).to.equal( | ||
| // JSON.stringify([]) | ||
| // ); | ||
| // expect(JSON.stringify(edits.user)).to.equal( | ||
| // JSON.stringify([]) | ||
| // ); | ||
| // }); |
Contributor
There was a problem hiding this comment.
Do we need to remove these comments?
| cy.get('[data-reach-tab-panels]') | ||
| .should('be.visible') | ||
| .within(() => { | ||
| cy.contains('Alerts').should('be.visible'); |
Contributor
| }); | ||
| }); | ||
|
|
||
| it('Legacy alerts > 0, Beta alerts > 0, => beta enabled. can downgrade to legacy enabled', function () { |
Contributor
There was a problem hiding this comment.
This case is not expected to occur (or may never occur) -- may be we could just remove this test?
More context mentioned in M3-10348
Comment on lines
+391
to
+406
| // ui.dialog | ||
| // .findByTitle('Are you sure you want to save legacy Alerts?') | ||
| // .should('be.visible') | ||
| // .within(() => { | ||
| // ui.button.findByTitle('Confirm').should('be.visible') | ||
| // .click(); | ||
| // }); | ||
| // TODO: this test passes but modal behavior will change when properly implemented in api (M3-10195) | ||
| // TODO: this test passes but modal behavior may change when properly implemented in api (M3-10195) | ||
| // ui.dialog | ||
| // .findByTitle('Save Alerts?') | ||
| // .should('be.visible') | ||
| // .within(() => { | ||
| // ui.button.findByTitle('Save').should('be.visible') | ||
| // .click(); | ||
| // }); |
Contributor
There was a problem hiding this comment.
Same here: Do we need these comments?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description 📝
I canceled #12442 and recreated the PR bc the previous PR had already been reviewed. The assertions in the tests have not changed much from 12442 but the test setup has changed substantially; isAclpAlertsBeta is deprecated in favor of linode.alerts.
This PR combines the solutions for both M3-10072 and M3-10073, bc the bulk of the setup is for a region being enabled vs disabled for alert support. So the tests are organized by region being enabled/disabled, then by linode.alerts value.
Changes 🔄
No longer relying on isAclpAlertsBeta to determine whether to display legacy vs beta alerts. Instead, rely on logic in the linode.alerts (linode.alerts.system or linode.alerts.user for beta, the legacy linode.alerts attributes are: cpu, io, network_in, network_out, and transfer_quota. The logic for determing whether to display beta vs legacy given the alerts attributes is documented and implemented in useIsLinodeAclpSubscribed.ts
For regions that enable beta alerts, i've added a test for each of the 4 scenarios (given the 'beta' parameter):
NOTE: Here, "disabled" means that all toggles are in the OFF state, but it's still editable (not read-only)
Also added tests in a region where beta alerts are not enabled
I left in some commented-out code and tests along w/ a TODO, bc while these tests currently pass, Purvesh says that the functionality of the Save Dialog is not properly implemented by the api, and these tests will break when the feature is properly implemented in M3-10195. Jira ticket https://jira.linode.com/browse/M3-10325 created as a placeholder for this task.
I also refactored some of the strings in the banner and buttons that are used repeatedly in the e2e tests as well as the unit tests. The only tests that i added in this pr are in linode-alerts.spec.ts
How to test 🧪
pnpm run cy:run -s cypress/e2e/core/linodes/linode-alerts.spec.ts
Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅