Skip to content

test [M3-10073]: Linode alerts tab based on region and linode.alerts - #12511

Merged
dmcintyr-akamai merged 42 commits into
linode:developfrom
dmcintyr-akamai:M3-10073_alerts_prefs
Jul 22, 2025
Merged

test [M3-10073]: Linode alerts tab based on region and linode.alerts#12511
dmcintyr-akamai merged 42 commits into
linode:developfrom
dmcintyr-akamai:M3-10073_alerts_prefs

Conversation

@dmcintyr-akamai

@dmcintyr-akamai dmcintyr-akamai commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

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):

  1. Legacy alerts = 0, Beta alerts = [] (empty arrays or no values at all) => legacy disabled
  2. Legacy alerts > 0, Beta alerts = [] (empty arrays or no values at all) => legacy enabled
  3. Legacy alerts = 0, Beta alerts has values (either system, user, or both), => beta enabled
  4. Legacy alerts > 0, Beta alerts has values (either system, user, or both), => beta enabled

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

  1. Legacy alerts = 0, Beta alerts > 0, => legacy disabled
  2. Legacy alerts > 0, Beta alerts = 0, => legacy disabled

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


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@dmcintyr-akamai
dmcintyr-akamai requested review from bnussman-akamai, jdamore-linode and pmakode-akamai and removed request for a team July 15, 2025 11:40
Comment thread packages/manager/cypress/e2e/core/linodes/alerts-edit.spec.ts
Comment thread packages/manager/cypress/e2e/core/linodes/alerts-edit.spec.ts Outdated
Comment thread packages/manager/cypress/e2e/core/linodes/alerts-edit.spec.ts Outdated
Comment thread packages/manager/cypress/e2e/core/linodes/alerts-edit.spec.ts Outdated
Comment thread packages/manager/cypress/support/intercepts/linodes.ts Outdated
@linode-gh-bot

Copy link
Copy Markdown

Cloud Manager UI test results

🎉 689 passing tests on test run #15 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing689 Passing4 Skipped123m 22s

@pmakode-akamai pmakode-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All tests pass ✅

thank you!

Screenshot 2025-07-22 at 3 23 51 PM

* 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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([])
// );
// });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to remove these comments?

cy.get('[data-reach-tab-panels]')
.should('be.visible')
.within(() => {
cy.contains('Alerts').should('be.visible');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional: We've added an assertion to verify the Beta chip on the Alerts tab. Similarly, could we also add an assertion to verify the Beta chip next to the 'Alerts' text inside the tab?
Screenshot 2025-07-22 at 3 14 19 PM

});
});

it('Legacy alerts > 0, Beta alerts > 0, => beta enabled. can downgrade to legacy enabled', function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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();
// });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here: Do we need these comments?

@github-project-automation github-project-automation Bot moved this from Review to Approved in Cloud Manager Jul 22, 2025
@pmakode-akamai pmakode-akamai added ACLP Integration CI (Cloud Interfaces) Support for CC (Core Compute) CloudPulse Integration Testing Approved Multiple approvals and ready to merge! labels Jul 22, 2025
@dmcintyr-akamai
dmcintyr-akamai merged commit 9c888c8 into linode:develop Jul 22, 2025
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Cloud Manager Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ACLP Integration CI (Cloud Interfaces) Support for CC (Core Compute) CloudPulse Integration Approved Multiple approvals and ready to merge! Testing

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants