-
Notifications
You must be signed in to change notification settings - Fork 267
chore(tests): Add in app messaging testing infrastructure and tests #1615
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
Open
nan-li
wants to merge
10
commits into
ci/add_code_coverage
Choose a base branch
from
tests/add_iam_tests
base: ci/add_code_coverage
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 hidden or 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
a69c00c to
f828623
Compare
Add Swift `IAMIntegrationTests` test file and check for accessibility of `OSMessagingController` from the test file
* no longer used, dead code
d38abc1 to
72510a5
Compare
* 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.
* 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
* 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.
…alInAppMessages * 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`
72510a5 to
1dee76e
Compare
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
OneSignalInAppMessagesmodule.Details
OneSignalInAppMessagesusing 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 importin that scenario.Motivation
Increase tests, porting over tests.
Scope
Testing only, not changing the shipped SDK, or making any internal APIs public.
Testing
Unit testing
IAMIntegrationTestsand write one integration testtestDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplayto new tests, but behavior has changed. It becomestestPausingIAMs_doesNotCreateMessageQueue.OneSignalInAppMessagesMocksfor re-usable test helpers and mock functionalityMockMessagingControllerin 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.ConsistencyManagerTestHelperswith methods for repeating functionalityManual testing
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is