-
Notifications
You must be signed in to change notification settings - Fork 4
fix: improve home pull-to-refresh #532
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
Open
pwltr
wants to merge
3
commits into
master
Choose a base branch
from
fix/pull-to-refresh
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+272
−11
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| @testable import Bitkit | ||
| import XCTest | ||
|
|
||
| @MainActor | ||
| final class HomePullRefreshFeedbackTests: XCTestCase { | ||
| func testStopsWaitingWhenRefreshCompletes() async { | ||
| var didRefresh = false | ||
|
|
||
| await HomePullRefreshFeedback.wait( | ||
| refresh: { | ||
| didRefresh = true | ||
| }, | ||
| sleep: { _ in | ||
| try await Task.sleep(for: .seconds(60)) | ||
| } | ||
| ) | ||
|
|
||
| XCTAssertTrue(didRefresh) | ||
| } | ||
|
|
||
| func testTimeoutStopsWaitingWhileRefreshContinues() async { | ||
| let refreshGate = AsyncStream<Void>.makeStream() | ||
| let refreshFinished = expectation(description: "Refresh continued after feedback timeout") | ||
| var didFinishRefresh = false | ||
|
|
||
| await HomePullRefreshFeedback.wait( | ||
| refresh: { | ||
| for await _ in refreshGate.stream {} | ||
| didFinishRefresh = true | ||
| refreshFinished.fulfill() | ||
| }, | ||
| sleep: { _ in } | ||
| ) | ||
|
|
||
| XCTAssertFalse(didFinishRefresh) | ||
| refreshGate.continuation.finish() | ||
| await fulfillment(of: [refreshFinished], timeout: 1) | ||
| XCTAssertTrue(didFinishRefresh) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Improved Home pull-to-refresh feedback and added on-demand exchange-rate updates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <journey name="pull to refresh rates"> | ||
| <description> | ||
| Pulling to refresh on Home also refreshes exchange rates, independently of the wallet and | ||
| activity refresh. Precondition: onboarded dev wallet on Home (id "HomeScrollView" visible) and | ||
| network access to the rates backend. Rates also refresh on app start and every two minutes of | ||
| polling (`Env.fxRateRefreshInterval`), so pull at least 20s after the last "Currency rates | ||
| refreshed successfully" line and well before the next polling tick, or the log check passes for | ||
| the wrong reason. The success line and any error toast are not in `snapshot-ui`; read the app log | ||
| and take a screenshot. Unlike Android, this journey does not assert a separate widget refresh; | ||
| issue #344 only adds an exchange-rate refresh to the iOS Home pull. | ||
| </description> | ||
| <actions> | ||
| <action>Resolve the app group logs for the simulator under test: UDID=<the simulator this journey is running on>; GROUP=$(xcrun simctl get_app_container "$UDID" to.bitkit groups | awk '{print $2}'); ls -t "$GROUP/logs"</action> | ||
| <action>Resolve the app group again, run `grep "Currency rates refreshed" "$GROUP"/logs/*.log`, and note the time of the last line</action> | ||
| <action>Verify the home screen (id "HomeScrollView") is visible</action> | ||
| <action>Run `xcodebuildmcp simulator snapshot-ui`, note the elementRef for "HomeScrollView", then run `xcodebuildmcp ui-automation swipe --within-element-ref <ref> --direction down --distance 0.7` and note the UTC time</action> | ||
| <action>Within about 1s of the pull, take a screenshot and verify a spinner is visible below the header with the wallet content shifted down</action> | ||
| <action>Verify the newest log (list the logs again) gains a "Currency rates refreshed successfully" line within 10s of the pull</action> | ||
|
pwltr marked this conversation as resolved.
|
||
| <action>Do not treat the rates success line as overall refresh completion; wait for wallet and activity synchronization to finish and for the spinner fade-out to complete</action> | ||
| <action>Take another screenshot and verify the spinner and extra space above the wallet content are gone</action> | ||
|
pwltr marked this conversation as resolved.
|
||
| <action>Verify no "Currency rates refresh failed" line was added for the pull</action> | ||
| </actions> | ||
| </journey> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.