WordPress-iOS icon indicating copy to clipboard operation
WordPress-iOS copied to clipboard

Assert tests with localized values

Open dvdchr opened this issue 1 year ago β€’ 5 comments

Hi @momo-ozawa and @hassaanelgarem πŸ‘‹πŸΌ , I'm assigning y'all as reviewers based on GitHub recommendations.

Some of the unit test cases failed locally because the assertions expected the code to use , as the thousands separator and . as the decimal separator. However, in my locale en_ID, it is the other way around (e.g. 10.000, 1,25M).

This PR addresses the issue by using the abbreviatedString(forHeroNumber:) for the expected value so it adjusts properly in different locales.

Alternatively, we can also force all local test runs to run in the UTC timezone and use en_US locale, but I'm not sure if this is the best way. πŸ€” cc-ing @mokagio in case you have thoughts on this.

To test

  • Go to WordPressUnitTests.xctestplan > Configuration.
  • In the Localization > Application Region field, select Indonesia.
  • πŸ”Ž Run DashboardStatsViewModelTests.testReturnedDataIsFormattedCorrectly() and BlazeCampaignViewModelTests.testViewModel() and verify that they are passing.
  • πŸ”Ž Re-run the tests in your local region, and ensure that they are also passing.

Regression Notes

  1. Potential unintended areas of impact Should be none.

  2. What I did to test those areas of impact (or what existing automated tests I relied on) Ran the tests in both local and US locale.

  3. What automated tests I added (or what prevented me from doing so) N/A.

PR submission checklist:

  • [x] I have completed the Regression Notes.
  • [x] I have considered adding unit tests for my changes.
  • [x] I have considered adding accessibility improvements for my changes.
  • [x] I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

Not applicable.

  • [ ] Portrait and landscape orientations.
  • [ ] Light and dark modes.
  • [ ] Fonts: Larger, smaller and bold text.
  • [ ] High contrast.
  • [ ] VoiceOver.
  • [ ] Languages with large words or with letters/accents not frequently used in English.
  • [ ] Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • [ ] iPhone and iPad.
  • [ ] Multi-tasking: Split view and Slide over. (iPad)

dvdchr avatar Nov 06 '23 13:11 dvdchr

WordPress AlphaπŸ“² You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr21982-e0240de
Version23.6
Bundle IDorg.wordpress.alpha
Commite0240de4552b48e21c91fcf512f28723b102ff9f
App Center BuildWPiOS - One-Offs #7720
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

wpmobilebot avatar Nov 06 '23 13:11 wpmobilebot

Jetpack AlphaπŸ“² You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr21982-e0240de
Version23.6
Bundle IDcom.jetpack.alpha
Commite0240de4552b48e21c91fcf512f28723b102ff9f
App Center Buildjetpack-installable-builds #6736
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

wpmobilebot avatar Nov 06 '23 13:11 wpmobilebot

Thanks for addressing this!

momo-ozawa avatar Nov 07 '23 13:11 momo-ozawa

Hey, a quick update. As per @mokagio and @hassaanelgarem 's inputs, I tried updating the WordPressUnitTests.xctestplan configuration to use the English language and United States as the location but found additional new tests failing under this setting.

Unfortunately, I'll need to put this on hold this week as I need to wrap up my project work. I'll take another look at my downtime during the meetup. In the meantime, I'll clear the milestone target and set this to Draft for now.

dvdchr avatar Nov 10 '23 11:11 dvdchr

Thank you for the update @dvdchr

mokagio avatar Nov 14 '23 03:11 mokagio