-
Notifications
You must be signed in to change notification settings - Fork 264
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
[tests] In App Messaging tests basic infrastructure #1538
Open
nan-li
wants to merge
9
commits into
main
Choose a base branch
from
tests_iam_module_v5
base: main
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.
Conversation
This file contains 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
Add Swift `IAMIntegrationTests` test file and check for accessibility of `OSMessagingController` from the test file
* no longer used, dead code
* Aren't called by anything so no need to be on the interface, these are called by the class itself.
* Without a description, the object will return something like `<OSRequestGetInAppMessages: 0x600001798bc0>`. By adding a predictable description, we can operate on the object.
nan-li
force-pushed
the
tests_iam_module_v5
branch
2 times, most recently
from
January 28, 2025 04:51
13233a7
to
8482fcb
Compare
nan-li
force-pushed
the
tests_iam_module_v5
branch
3 times, most recently
from
January 28, 2025 16:42
53c0f79
to
a3cd2c9
Compare
* Re-usable test helpers and mock functionality * Include own swiftlint file * ❗️ After `OneSignalInAppMessagesMocks` was created, I had to then manually "convert to group" or else the CI had build errors about the following: xcodebuild: error: Unable to read project 'OneSignal.xcodeproj' Reason: The project ‘OneSignal’ is damaged and cannot be opened. Examine the project file for invalid edits or unresolved source control conflicts. Exception: didn't find classname for 'isa' key
nan-li
force-pushed
the
tests_iam_module_v5
branch
from
January 28, 2025 17:00
a3cd2c9
to
0768f8d
Compare
* Make a `MockMessagingController` in Objective C to allow us to access internal APIs on the OSMessagingController without needing to make them public. This is needed because Swift code cannot access Objective-C APIs unless they are public. This is a workaround for this limitation.
nan-li
force-pushed
the
tests_iam_module_v5
branch
from
January 28, 2025 17:33
9777cbc
to
ecdd49a
Compare
* This extension on `UIApplication` is only used in the `OneSignalInAppMessages` framework, so there is no need to keep it in the umbrella `OneSignalFramework` framework, which causes errors if only `OneSignalInAppMessages` is tested (without also importing OneSignalFramework).
* Has helper methods for repeating functionality
* Attempt to migrate `testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay` to new tests, but behavior has changed. * It becomes `testPausingIAMs_doesNotCreateMessageQueue`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
One Line Summary
Add basic infrastructure to test the
OneSignalInAppMessages
module.Details
OneSignalInAppMessages
using Swift language. Previously we could access all APIs by importing directly in Objective-C. However, there are limitations to accessing internal Objective-C APIs from Swift - that is, they must all be public.@testable import
in that scenario.Motivation
We need tests!
Scope
Testing only, not changing the shipped SDK, or making any internal APIs public.
Testing
Unit testing
IAMIntegrationTests
and write one integration testtestDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay
to new tests, but behavior has changed. It becomestestPausingIAMs_doesNotCreateMessageQueue
.OneSignalInAppMessagesMocks
for re-usable test helpers and mock functionalityMockMessagingController
in Objective C to allow us to access internal APIs on the OSMessagingController without needing to make them public. This is needed because Swift code cannot access Objective-C APIs unless they are public. This is a workaround for this limitation.ConsistencyManagerTestHelpers
with methods for repeating functionalityManual testing
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is