Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Create UI tests for CurrencyDropdown widget #287

Closed
Tracked by #298
ethan-tbd opened this issue Sep 5, 2024 · 7 comments · Fixed by #312
Closed
Tracked by #298

Create UI tests for CurrencyDropdown widget #287

ethan-tbd opened this issue Sep 5, 2024 · 7 comments · Fixed by #312

Comments

@ethan-tbd
Copy link
Contributor

ethan-tbd commented Sep 5, 2024

  • using the existing test suite as an example, create UI tests to stress-test the CurrencyDropdown widget
  • the CurrencyDropdown widget is responsible for:
    • reading the passed in PaymentAmountState to render a list of PFI offerings to choose from
    • updating the passed in PaymentAmountState when a new offering is selected from the "Select currency" modal
@mohitrajsinha
Copy link
Contributor

.take

Copy link

github-actions bot commented Oct 7, 2024

Thanks for taking this issue! Let us know if you have any questions!

@mohitrajsinha
Copy link
Contributor

Hey @ethan-tbd , I’ve created a few tests, but I’m running into an issue with the second one—it keeps failing. Do you have any suggestions on how I might resolve this?

Here’s the commit link with the code: Commit 149c5b22e57b481c21d66da96c90c3ad6f6f5591

Thanks for any insights you can provide!

@blackgirlbytes
Copy link

Hey @mohitrajsinha maybe it would help if you open a PR? That way ethan or me could check it out and suggest changes to help you get your test working!

@ethan-tbd
Copy link
Contributor Author

@mohitrajsinha there are two problems that are contributing to the failing test case:

  1. follow the structure of the existing test suite by using WidgetHelpers.testableWidget() (this will take care of the localized string errors)
  2. if you take a look at ModalSelectCurrency, you will see that if offeringsMap in PaymentAmountState is null, then an empty container is rendered. in your setUp function, make sure to initialize offeringsMap (hint: look at the TestData class).

@ethan-tbd
Copy link
Contributor Author

@mohitrajsinha also some nits:

  1. make sure the name of the test file ends in _test
  2. instead of using find.byKey(), you can just use find.text('USD') since you are setting the testCurrency value to USD

@mohitrajsinha
Copy link
Contributor

Yeah ,it was great to work on this issue. It was my first time working on a flutter tests.

Thanks for your suggestions.

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

Successfully merging a pull request may close this issue.

3 participants