Skip to content

Fixed sporadic BeginRefundRequestHelperTests failures#1390

Merged
NachoSoto merged 1 commit into
mainfrom
current-scene-tests
Mar 15, 2022
Merged

Fixed sporadic BeginRefundRequestHelperTests failures#1390
NachoSoto merged 1 commit into
mainfrom
current-scene-tests

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

These have began failing on #1387, even though that doesn't change anything that should affect the UIWindowScene or anything related. This could have been a regression from Xcode 13.3.
When the test fails (which isn't always), the scene isn't yet .foregroundActive . To workaround that, this defaults to any scene, though only when running tests, on debug, and on the simulator. So nothing is changed in release or device builds.

This also has a small refactor on BeginRefundRequestHelperTests to move the test data below and make the tests more readable.
Additionally, the MockSK2BeginRefundRequestHelper is recreated for every test. I thought initially that this is what was making the test fail, as the mock expectations and state was being shared across tests. It's not, but now that should remove any potential issues with shared state.

Comment on lines 30 to 38

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.

👍

@NachoSoto NachoSoto force-pushed the http-client-result branch 2 times, most recently from af3f089 to b812108 Compare March 15, 2022 19:56
@NachoSoto NachoSoto force-pushed the current-scene-tests branch from b7dac44 to 44711a7 Compare March 15, 2022 20:04
Base automatically changed from http-client-result to main March 15, 2022 20:17
These have began failing on #1387, even though that doesn't change anything that should affect the `UIWindowScene` or anything related. This could have been a regression from Xcode 13.3.
When the test fails (which isn't always), the scene isn't yet `.foregroundActive` . To workaround that, this defaults to any scene, *though only when running tests, on debug, and on the simulator*. So nothing is changed in release or device builds.

This also has a small refactor on `BeginRefundRequestHelperTests` to move the test data below and make the tests more readable.
Additionally, the `MockSK2BeginRefundRequestHelper` is recreated for every test. I thought initially that this is what was making the test fail, as the mock expectations and state was being shared across tests. It's not, but now that should remove any potential issues with shared state.
@NachoSoto NachoSoto force-pushed the current-scene-tests branch from 44711a7 to 874a168 Compare March 15, 2022 20:17
@NachoSoto NachoSoto merged commit 595f785 into main Mar 15, 2022
@NachoSoto NachoSoto deleted the current-scene-tests branch March 15, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants