Skip to content

feat: convert thirdparty donation tests to Playwright - #55043

Merged
Sembauke merged 12 commits into
freeCodeCamp:mainfrom
Sembauke:feat/convert-thirdparty-donation-tests-to-playwright
Jun 14, 2024
Merged

Sembauke merged 12 commits into
freeCodeCamp:mainfrom
Sembauke:feat/convert-thirdparty-donation-tests-to-playwright

Conversation

@Sembauke

@Sembauke Sembauke commented May 31, 2024 •

Copy link
Copy Markdown
Member

Checklist:

Closes #XXXXX

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label May 31, 2024
@Sembauke
Sembauke marked this pull request as ready for review May 31, 2024 12:15
@Sembauke
Sembauke requested a review from a team May 31, 2024 12:15
@Sembauke

Copy link
Copy Markdown
Member Author

Alright, the tests should be good to go. It will fail in the Ci because secrets do not work in PR's

@Sembauke
Sembauke marked this pull request as draft June 2, 2024 08:27
@huyenltnguyen huyenltnguyen mentioned this pull request Jun 11, 2024
61 tasks done
@Sembauke
Sembauke marked this pull request as ready for review June 13, 2024 08:36
@huyenltnguyen huyenltnguyen self-assigned this Jun 13, 2024
@huyenltnguyen huyenltnguyen removed their assignment Jun 13, 2024
@huyenltnguyen huyenltnguyen added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Jun 13, 2024
Comment thread e2e/third-party-donation.spec.ts Resolved
@ahmaxed ahmaxed self-assigned this Jun 13, 2024
@ahmaxed

ahmaxed commented Jun 13, 2024

Copy link
Copy Markdown
Member

Thank you for your patience, @Sembauke. I had a chance to look into testing payment elements' (paypal button and stripe elements) best practices.

To test the functionality, all papal and stripe calls should be intercepted and replaced with mock responses for different scenarios. That way we avoid the issues associated testing against external apis.

To test if the payment elements are displayed properly, there are two routes and both have their pros and cons:

  • completely mock the payment elements iframes.
  • pass only the client keys to load the actual elements.

I personally think the hybrid solution of testing actual elements and intercepted api calls would be the way to go, but let's hear from others before proceeding.

@ojeytonwilliams

ojeytonwilliams commented Jun 14, 2024 •

Copy link
Copy Markdown
Contributor

I personally think the hybrid solution of testing actual elements and intercepted api calls would be the way to go, but let's hear from others before proceeding.

Thanks for looking into this, Ahmad. I agree that this strikes the best balance. It makes sure that we've done our part correctly without the issues inherent to testing a third party. Our part being using the PayPal and Stripe libraries correctly in learn.

@raisedadead raisedadead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See prev. review.

@ahmaxed

ahmaxed commented Jun 14, 2024 •

Copy link
Copy Markdown
Member

Here are further considerations:

  • our api is currently mocked. To have an e2e, the calls from our api to stripe should be mocked instead.
  • since we are not passing the secrets, this test could run with other e2e test in the same workflow.

@Sembauke
Sembauke requested a review from raisedadead June 14, 2024 11:51
@Sembauke
Sembauke merged commit 328807a into freeCodeCamp:main Jun 14, 2024
@Sembauke
Sembauke deleted the feat/convert-thirdparty-donation-tests-to-playwright branch June 14, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants