Skip to content

Commit

Permalink
Use simple textField selection by default; provide more customization…
Browse files Browse the repository at this point in the history
… options (#25)

# Use simple textField selection by default; provide more customization
options

## ♻️ Current situation & Problem
Text entry in UI tests is still not trivial. This package has provided
some great utilities for text entry. However, sometimes there needs to
be more customization with text entry. Further, the "tap from the far
right" for textfield selection is not always ideal or not always needed.
Refer to the release notes for a list of changes.

## ⚙️ Release Notes 
* The new default for textField selection is now simply tapping the text
field. Tapping from the right is now an opt-in option.
* All customization points are now part of the `TextInputOptions` that
are passed to `delete` and `enter` methods.
* `checkIfTextWasEnteredCorrectly` was replaced by the
`skipTextInputValidation` option. This option stays enabled by default.
* `dismissKeyboard` was replaced by the `disableKeyboardDismiss` option.
Keyboard is no longer dismissed before text field selection. Please do
that manually.
* Show the test title in the navigation bar for `TestAppTests`.
* The deprecated `disablePasswordAutofill()` method was removed.

## 📚 Documentation
Documentation was updated.


## ✅ Testing
Tests were slightly updated.

### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg authored Aug 19, 2024
1 parent f543346 commit aad6c16
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 234 deletions.
7 changes: 6 additions & 1 deletion Sources/XCTestApp/TestAppTestsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public struct TestAppTestsView<Tests: TestAppTests>: View {
NavigationLink(test.rawValue, value: test)
}
.navigationDestination(for: Tests.self) { test in
test.view(withNavigationPath: $path)
test
.view(withNavigationPath: $path)
.navigationTitle(test.rawValue)
#if !os(macOS) && !os(tvOS)
.navigationBarTitleDisplayMode(.inline)
#endif
}
.navigationTitle(String(describing: Tests.self))
.toolbar {
Expand Down
2 changes: 1 addition & 1 deletion Sources/XCTestApp/TestAppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct TestAppView: View {
@State private var testState = "Running ..."
private let testCase: any TestAppTestCase


public var body: some View {
Text(testState)
.task {
Expand Down
97 changes: 0 additions & 97 deletions Sources/XCTestExtensions/XCTestCase+DisablePasswordAutofill.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ The `enter(value:)` and `delete(count:)` methods provide the `checkIfTextWasEnte

### Assertions

- ``XCTAssertThrowsErrorAsync``
- ``XCTAssertThrowsErrorAsync(_:_:file:line:_:)``

### Text Entry

- ``XCTest/XCUIElement/enter(value:checkIfTextWasEnteredCorrectly:dismissKeyboard:)``
- ``XCTest/XCUIElement/delete(count:checkIfTextWasDeletedCorrectly:dismissKeyboard:)``
- ``TextInputOptions``
- ``XCTest/XCUIElement/enter(value:options:)``
- ``XCTest/XCUIElement/delete(count:options:)``

### App Interaction

Expand Down
Loading

0 comments on commit aad6c16

Please sign in to comment.