-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS] Fix two failing analytics tests #16083
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
When I run tests locally, `sendReceipt_tracks_failure_with_eligible_for_pos_receipt` and `sendReceipt_tracks_success_with_eligible_for_pos_receipt` would always fail on the check for `#expect(analyticsProvider.receivedProperties[indexOfEvent]["eligible_for_pos_receipt”] == {value})`.
It’s using index 1, because index 0 was an `order_created` event, which has no properties. That meant that the arrays for properties and events didn’t line up.
When we expected index 1, the tests crashed because of the index being out of range.
I don’t know yet why these aren’t blocking CI.
To fix it, we simply reset the saved events before the `When` in each test.
|
|
|
Here's some output from CI's unit tests from before the fix, taken from this run: And then a little further down So it seems like the |
|
And even with the fix, making the tests pass locally, they still fail on CI. It just doesn't mark the tests as failed. |
|
Only one review needed. Nothe that this comes before #16088 – that's where I've fixed the CI reporting of the tests. |
|
Version |
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.
Thanks for taking a look and disabling the cha-ching sound! Feel free to merge after checking if CI passes after the suggested changes.
WooCommerce/WooCommerceTests/POS/Controllers/PointOfSaleOrderControllerTests.swift
Show resolved
Hide resolved
WooCommerce/WooCommerceTests/POS/Controllers/PointOfSaleOrderControllerTests.swift
Show resolved
Hide resolved
Co-authored-by: Jaclyn Chen <[email protected]>

Description
When I run tests locally,
sendReceipt_tracks_failure_with_eligible_for_pos_receiptandsendReceipt_tracks_success_with_eligible_for_pos_receiptwould always fail on the check for#expect(analyticsProvider.receivedProperties[indexOfEvent]["eligible_for_pos_receipt”] == {value}).It’s using index 1, because index 0 was an
order_createdevent, which has no properties. That meant that the arrays for properties and events didn’t line up.When we expected index 1, the tests crashed because of the index being out of range.
I don’t know yet why these aren’t blocking CI.
To fix it, we simply reset the saved events before the
Whenin each test.I also stopped the order tests from making the
cha-chingsoundSteps to reproduce
PointOfSaleOrderControllerTestslocallyRELEASE-NOTES.txtif necessary.