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

test: [M3-9143] - Cypress test for Service Transfers fetch error #11607

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

cliu-akamai
Copy link
Contributor

Description 📝

Add test to check an error message is displayed in both in both the Received and Sent tables when the request fails to fetch Service Transfers.

Major Changes 🔄

  • Add mockGetEntityTransfersError function
  • Add test can display an error message when the request fails to fetch service transfer

How to test 🧪

yarn cy:run -s "cypress/e2e/core/account/service-transfer.spec.ts"

@cliu-akamai cliu-akamai requested a review from a team as a code owner February 4, 2025 15:38
@cliu-akamai cliu-akamai requested review from jdamore-linode and removed request for a team February 4, 2025 15:38
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 500 passing tests on test run #1 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing500 Passing2 Skipped105m 15s

Copy link

github-actions bot commented Feb 4, 2025

Coverage Report:
Base Coverage: 78.94%
Current Coverage: 79.27%

@cliu-akamai cliu-akamai requested a review from a team as a code owner February 4, 2025 18:41
@cliu-akamai cliu-akamai requested review from bnussman-akamai and hana-akamai and removed request for a team February 4, 2025 18:41
Comment on lines +506 to +520
// Confirm that an error message is displayed in "Received Service Transfers" panel.
cy.get('[data-qa-panel="Received Service Transfers"]')
.should('be.visible')
.within(() => {
cy.get('[data-testid="KeyboardArrowDownIcon"]').click();
assertServiceTransfersError(serviceTransferErrorMessage);
});

// Confirm that an error message is displayed is in "Sent Service Transfers" panel.
cy.get('[data-qa-panel="Sent Service Transfers"]')
.should('be.visible')
.within(() => {
cy.get('[data-testid="KeyboardArrowDownIcon"]').click();
assertServiceTransfersError(serviceTransferErrorMessage);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove the assertServiceTransfersError function and simplify this to something like:

['Received Service Transfers', 'Sent Service Transfers'].forEach((transfer) => {
  cy.get(`[data-qa-panel="${transfer}"]`)
  .should('be.visible')
  .within(() => {
    cy.get('[data-testid="KeyboardArrowDownIcon"]').click();
    // Error Icon should shows up.
    cy.findByTestId('ErrorOutlineIcon').should('be.visible');
    // Error message should be visible.
    cy.findByText(serviceTransferErrorMessage, { exact: false }).should('be.visible');
  });
})

/*
* - Confirms that an error message is displayed in both the Received and Sent tables when the requests to fetch service transfers fail.
*/
it('can display an error message when the request fails to fetch service transfer', () => {
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
it('can display an error message when the request fails to fetch service transfer', () => {
it('should display an error message when the request fails to fetch service transfer', () => {

@hana-akamai
Copy link
Contributor

Looks like there's also some merge conflicts that need to be addressed

Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

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

Thanks @cliu-akamai!

+1 to Hana's suggestions, but aside from that and the merge conflict this looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants