-
Notifications
You must be signed in to change notification settings - Fork 1
Test/scan prompt test form #242
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
Conversation
Code Review: E2E Manual QR Entry FeatureOverviewThis PR adds a test-only feature to manually enter QR code strings during E2E testing, mirroring Android functionality. The implementation is clean and well-scoped to E2E builds only. ✅ Strengths
🔍 Issues & Suggestions1. Missing
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an E2E testing helper that allows manual QR code string entry during automated tests, mirroring existing Android functionality. The feature is gated behind Env.isE2E to ensure it only appears in test builds, not production. This enables the previously disabled @settings_10 iOS E2E test to run.
Key changes:
- Added manual entry UI components to scanner screens for E2E testing
- Implemented
handleManualEntrymethod inScannerManagerto process manual input - Enabled
@settings_10test by removing exclusion filter in CI workflow
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Bitkit/Views/Scanner/ScannerSheet.swift | Added E2E-only manual QR entry button, state management, and sheet presentation |
| Bitkit/Views/Scanner/ScannerScreen.swift | Added E2E-only manual QR entry button, state management, and sheet presentation (parallel to ScannerSheet) |
| Bitkit/Views/Scanner/ManualScanPrompt.swift | New reusable prompt component for manual QR code string input with proper accessibility identifiers |
| Bitkit/Managers/ScannerManager.swift | Added handleManualEntry method to process manually entered QR strings |
| Bitkit/Components/TabBar/ScanButton.swift | Added accessibility identifier for E2E test targeting |
| .github/workflows/e2e-tests.yml | Removed exclusion of @settings_10 test to enable previously disabled iOS test |
9b4e4b1 to
5256919
Compare
Code Review for PR #242: E2E Test Helper for QR Code String EntryOverviewThis PR adds an E2E-only manual QR code entry form to enable automated testing without requiring actual QR code scanning. This mirrors the Android implementation and enables the @settings_10 iOS test. ✅ Strengths
🔍 Code Quality Observations1. Minor Inconsistency in Button Titles
Recommendation: Standardize to "Enter QR Code String" in both files. 2. Redundant MainActor.run in handleManualEntryLocation: await MainActor.run {
onSuccess()
}Since Recommendation: Simplify to: onSuccess()3. Empty String HandlingLocation: The empty string guard is good, but it fails silently. Consider providing user feedback when an empty string is submitted. Recommendation: guard !trimmed.isEmpty else {
app?.toast(
type: .warning,
title: "Empty Input",
description: "Please enter a QR code string"
)
await MainActor.run { onSuccess() } // Still close the sheet
return
}🏗️ Architecture & Best Practices✅ Follows SwiftUI Patterns
✅ Proper Async/Await Usage
🔒 Security Considerations✅ No Security Concerns
🧪 Testing Considerations✅ Good Test Support
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
5256919 to
668f8d2
Compare
PR Review: E2E Manual QR Entry FeatureOverviewThis PR adds an E2E-only manual QR code entry form, mirroring Android functionality. The implementation is clean and focused, enabling the ✅ Strengths
🐛 Issues Found1. Inconsistent Button Title (Minor)
Recommendation: Standardize to // ScannerSheet.swift:48
title: "Enter QR Code String", // Add space between "QR" and "Code"2. Missing Input Validation Feedback (Moderate)The Recommendation: Add user feedback for empty/invalid input: func handleManualEntry(
_ value: String,
context: ScannerContext,
onSuccess: @MainActor () -> Void
) async {
let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)
guard \!trimmed.isEmpty else {
await MainActor.run {
app?.toast(
type: .warning,
title: "Invalid Input",
description: "Please enter a valid QR code string"
)
}
return
}
await handleScan(trimmed, context: context)
await MainActor.run {
onSuccess()
}
}3. Redundant
|
| Aspect | Rating | Notes |
|---|---|---|
| Code Style | ⭐⭐⭐⭐⭐ | Follows SwiftFormat conventions |
| Architecture | ⭐⭐⭐⭐⭐ | Proper SwiftUI patterns, good separation |
| Error Handling | ⭐⭐⭐☆☆ | Missing feedback for empty input |
| Security | ⭐⭐⭐⭐⭐ | E2E-only, no security concerns |
| Accessibility | ⭐⭐⭐⭐⭐ | All E2E identifiers present |
| Performance | ⭐⭐⭐⭐☆ | Minor redundancy with MainActor.run |
| Testability | ⭐⭐⭐⭐⭐ | Enables E2E tests effectively |
🔍 Additional Observations
-
Sheet Presentation: The
.presentationDetents([.fraction(0.35)])is well-chosen for the simple input form. -
State Management: Proper cleanup of
manualEntrystate on cancel/submit prevents stale data. -
Context Handling: Both
ScannerScreen(dynamic context based on navigation) andScannerSheet(fixed.maincontext) are handled correctly. -
Workflow Changes: The E2E workflow improvement (removing
@settings_10exclusion) is a positive outcome. The regex simplification is clean.
🧪 Test Coverage Recommendations
Since this is for E2E testing, consider:
- Testing empty string submission (currently silent failure)
- Testing various QR payload formats (addresses, invoices, LNURLs)
- Testing cancel behavior
🔐 Security Considerations
✅ No security concerns – This is E2E-only code properly gated behind Env.isE2E, which evaluates to true only when:
- Compiled with
E2E_BUILDflag, OR - Environment variable
E2E=trueis set
✨ Suggestions for Future Enhancement (Optional)
- Multi-line support: For longer payloads, consider
TextEditorinstead ofTextField - Paste button: Quick paste from clipboard within the dialog
- Recent entries: E2E test payload history (if needed for test efficiency)
📝 Summary
This is a solid, well-implemented feature that successfully brings parity with Android E2E testing capabilities. The code is clean, follows project conventions, and introduces no regressions.
Recommended Actions Before Merge:
- ✅ Fix inconsistent button title ("QRCode" → "QR Code")
⚠️ Consider adding empty input feedback (optional but recommended)- ✅ Remove redundant
MainActor.runwrapper
Approval Status: ✅ Approved with minor suggestions
Great work on the implementation! 🚀
ovitrif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utAck
…st-form Test/scan prompt test form
Description
The PR adds an E2E-only "Enter QR Code String" helper form (mirroring Android) so
settingsandlnurle2e specs can inject manual "QR" payloads. As a result the @settings_10 iOS test in the current suite is enabled.Linked Issues/Tasks
Add any links to GitHub issues or Asana tasks that are relevant to this pull request.
Screenshot / Video