-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
316-Fix-BasicCarMaintenanceUITests #348
base: dev
Are you sure you want to change the base?
316-Fix-BasicCarMaintenanceUITests #348
Conversation
This is my first ever open source contribution, and first time working with XCTest, so naturally I have many questions: The error I was getting said that it was failing to scroll. I thought it may have something to do with the 'Thanks for using this app' popup so I found a way to dismiss it. Dismissing the popup allowed the test to pass. But the test isn't actually asserting anything. Is that right for a UI test? A successful tap of the 'add' button is a successful test? Should I be asserting that a new vehicle has been added? It looks like I set up firebase correctly for when I run the app, but the data doesn't go away each time I run the tests, have I missed a step or is that working as expected? Should I edit the test to fill in the rest of the inputs? Thanks
sounds like a good solution, does this work though when the test is run multiple times? Like the TipKit popup shows up every time the UI test is run?
Technically yes, but because this codebase is still pretty new, the testing coverage and functionality isn't the best, that's something I want to improve over time or possibly after Hacktoberfest. Also one component of this, is if the Firebase emulator is being set up correctly for running UI or unit tests. Like it's set up for development, but is that the same setup for testing? (I'm not sure)
yes that's fine!
This is because of how Firebase emulator is used with this command: if you didn't use
Not in this PR, but make a new issue for this! (which will probably also include checking that all the data was added correctly I'd love in the future to have all the UI tests be used to create localized screenshots, and have those run automatically with Fastlane! that would be really cool, but I think we're still a little ways away from that |
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.
|
||
extension XCUIApplication { | ||
func dismissPopup() { | ||
otherElements["dismiss popup"].tap() |
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.
change this function to dismissTipKitPopup
but before that, question, does this only work for TipKit, or what other "popups" would this function be used for? if it's specific to this test, I would actually move it so it's in the BasicCarMaintenanceUITests
class
@@ -18,6 +18,8 @@ final class BasicCarMaintenanceUITests: XCTestCase { | |||
} | |||
|
|||
func testAddVehicle() { |
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.
This doesn't pass for me, I get this error.
I erased the simulator, and deleted all the data from the emulator
Running tests...
Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric
Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics
t = nans Interface orientation changed to Portrait
Test Suite 'BasicCarMaintenanceUITests' started at 2024-10-27 16:26:30.306.
Test Case '-[Basic_Car_Maintenance_UITests.BasicCarMaintenanceUITests testAddVehicle]' started.
t = 0.00s Start Test at 2024-10-27 16:26:30.307
t = 0.13s Set Up
t = 0.13s Open com.icyappstudio.Basic-Car-Maintenance
t = 0.13s Launch com.icyappstudio.Basic-Car-Maintenanc
warning: (arm64) /Users/mikaelacaron/Library/Developer/Xcode/DerivedData/Basic-Car-Maintenance-hasiwwufjtgocfeyrzxbvwqlinjv/Build/Products/Debug-iphonesimulator/Basic-Car-Maintenance.app/Basic-Car-Maintenance empty dSYM file detected, dSYM was created with an executable with no debug info.
e
t = 1.58s Setting up automation session
t = 2.48s Wait for com.icyappstudio.Basic-Car-Maintenance to idle
t = 3.97s Tap "dismiss popup" Other
t = 3.97s Wait for com.icyappstudio.Basic-Car-Maintenance to idle
t = 4.35s Find the "dismiss popup" Other
t = 5.47s Find the "dismiss popup" Other (retry 1)
t = 6.55s Find the "dismiss popup" Other (retry 2)
t = 6.61s Requesting snapshot of accessibility hierarchy for app with pid 7176
/Users/mikaelacaron/Documents/Apps/Basic-Car-Maintenance/Basic-Car-Maintenance-UITests/Extensions/XCUIApplication-dismissPopup.swift:13: error: -[Basic_Car_Maintenance_UITests.BasicCarMaintenanceUITests testAddVehicle] : Failed to tap "dismiss popup" Other: No matches found for Elements matching predicate '"dismiss popup" IN identifiers' from input {(
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other, label: 'Dismiss',
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other, label: 'Filter',
Other, identifier: 'plus', label: 'Add',
Other,
Other,
Other,
Other,
Other,
Other,
Other,
Other, label: 'Vertical scroll bar, 1 page', value: 0%,
Other
)}
Possibly caused by runtime issues:
Automation type mismatch: computed Other from legacy attributes vs ActivityIndicator from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 36;
"XC_kAXXCAttributeElementBaseType" = UIResponder;
"XC_kAXXCAttributeElementType" = "SwiftUI.AccessibilityNode";
"XC_kAXXCAttributeTraits" = 8589935104;
}
Automation type mismatch: computed Other from legacy attributes vs StaticText from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 48;
"XC_kAXXCAttributeElementBaseType" = UILabel;
"XC_kAXXCAttributeElementType" = UILabel;
"XC_kAXXCAttributeTraits" = 8590000128;
}
See test report attachments for more detail.
t = 6.83s Tear Down
Test Case '-[Basic_Car_Maintenance_UITests.BasicCarMaintenanceUITests testAddVehicle]' failed (7.091 seconds).
Test Suite 'BasicCarMaintenanceUITests' failed at 2024-10-27 16:26:37.398.
Executed 1 test, with 1 failure (0 unexpected) in 7.091 (7.092) seconds
What it Does
BasicCarMaintenanceUITests
testAddVehicle
Fails #316testAddVehicle()
passes ✅How I Tested
BasicCarMaintenanceUITests
func testAddVehicle() {
Notes
This is my first ever open source contribution, and first time working with XCTest, so naturally I have many questions:
The error I was getting said that it was failing to scroll. I thought it may have something to do with the
Thanks for using this app
popup so I found a way to dismiss it.Dismissing the popup allowed the test to pass. But the test isn't actually asserting anything. Is that right for a UI test? A successful tap of the
Add
button is a successful test? Should I be asserting that a new vehicle has been added?Is the pattern I used for the Extension folder and file inside good? is there a better pattern that Should be used?
It looks like I set up firebase correctly for when I run the app, but the data doesn't go away each time I run the tests, have I missed a step or is that working as expected?
Should I edit the test to fill in the rest of the inputs?