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

Add card number character count validation tests #427

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

okhan-okbay-cko
Copy link
Contributor

@okhan-okbay-cko okhan-okbay-cko commented Jul 25, 2023

What does this PR include?

Automates regression test cases to verify that we check the length of the card number even if it's a valid luhn number and belongs to a scheme.

To test this, some mock luhn numbers of different lengths are created. For example, to test if Visa card number length is being checked by our SDK, I added two different luhn numbers:

440000000002 -> Starts with 4 and consists of 12 digits -> Shows error Please enter a valid card number

4400000000008 -> Starts with 4 and consists of 13 digits -> Does not show error even if it's not a valid Visa card number

Visa cards start with 4 and be between 13, 16 or 19 digits. We can't test the upper character limit because the textfields don't allow us to input more than the max limit.

To increase the testing speed

Rather than relaunching the app each and every time, we only change the card number field. The error we see becomes visible after we tap the Done button on the keyboard, so, it's okay to show or hide that error by tapping that button and verifying our test case and switch to the next one.

  1. If current card number after dropping the last 2 characters equals to the previous card number dropping the last character, we get that we're still testing the same card scheme and just delete the last digit and add the new two digits. Refer to the Visa card numbers above to understand this more.

  2. When we switch to a new card scheme, we delete all the card number digits and input again.

If you want to understand this flow better, feel free to run the tests locally and watch the behaviour of UI.

When we come across Amex, which has 4 digits of security code, we delete the security code field completely (if security code is different than the previous one)

@okhan-okbay-cko okhan-okbay-cko force-pushed the feature/regression-tests branch from 58484e0 to d5a9b7a Compare July 26, 2023 14:29
Copy link
Contributor

@ehab-al-cko ehab-al-cko left a comment

Choose a reason for hiding this comment

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

👌

@okhan-okbay-cko okhan-okbay-cko merged commit e8bc067 into develop Jul 27, 2023
okhan-okbay-cko added a commit that referenced this pull request Aug 9, 2023
Add card number character count validation tests
@okhan-okbay-cko okhan-okbay-cko deleted the feature/regression-tests branch September 11, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants