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: add automated Cypress test for card number input validation #796

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

Conversation

aritro2002
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

add automated Cypress test for card number input validation.

How did you test it?

Screen.Recording.2024-11-14.at.3.00.55.PM.mov

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@aritro2002 aritro2002 added the Ready for Review PR with label Ready for Review should only be reviewed. label Nov 14, 2024
Copy link

semanticdiff-com bot commented Nov 14, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  cypress-tests/cypress/e2e/card-number-validation-test.cy.ts  0% smaller

@aritro2002 aritro2002 added the Testing Add this label if the PR contains Testing related changes label Nov 14, 2024
@aritro2002 aritro2002 linked an issue Nov 14, 2024 that may be closed by this pull request
Comment on lines 30 to 42
it("should complete the card payment successfully", () => {
const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards.successCard;

getIframeBody().find('[data-testid=cardNoInput]').type(cardNo);
getIframeBody().find('[data-testid=expiryInput]').type(card_exp_month);
getIframeBody().find('[data-testid=expiryInput]').type(card_exp_year);
getIframeBody().find('[data-testid=cvvInput]').type(cvc);

getIframeBody().get("#submit").click();

cy.wait(3000);
cy.contains("Thanks for your order!").should("be.visible");
});
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("should complete the card payment successfully", () => {
const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards.successCard;
getIframeBody().find('[data-testid=cardNoInput]').type(cardNo);
getIframeBody().find('[data-testid=expiryInput]').type(card_exp_month);
getIframeBody().find('[data-testid=expiryInput]').type(card_exp_year);
getIframeBody().find('[data-testid=cvvInput]').type(cvc);
getIframeBody().get("#submit").click();
cy.wait(3000);
cy.contains("Thanks for your order!").should("be.visible");
});

Copy link
Contributor

Choose a reason for hiding this comment

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

This is already being tested in an existing test case, please remove this


getIframeBody().get("#submit").click();

cy.wait(3000);
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
cy.wait(3000);


getIframeBody().get("#submit").click();

cy.wait(3000);
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
cy.wait(3000);


getIframeBody().get("#submit").click();

cy.wait(3000);
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
cy.wait(3000);


getIframeBody().get("#submit").click();

cy.wait(3000);
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
cy.wait(3000);

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a test suite to verify that when a user enters a value in the card input field and then clears it, no error message is displayed as long as the focus remains on the card input field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Review PR with label Ready for Review should only be reviewed. Testing Add this label if the PR contains Testing related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add automated Cypress test for card number input validation
3 participants