Commit 146518d
test: SDKE-632 Add New Integration Tests (#461)
* refactor: Remove specific line numbers from test comments
- Made comments more maintainable by removing hardcoded line references
- Comments now reference source methods without specific line numbers
* Add integration test for getUserAudiences API
- Tests retrieving user audience memberships via Identity API
- Covers successful audience retrieval with mock data
- Verifies getAudiencesWithCompletionHandler method
- Includes enabled AudienceAPI flag in config for testing
* Add integration test for timed events
- Add testLogTimedEvent function to test begin/end timed event flow
- Test uses fixed 2-second delay for deterministic behavior
- Add WireMock recordings for timed event API call
- Verify event duration is properly calculated and sent
* Add integration test for logError
- Tests error logging with custom event info dictionary
- Verifies error events are properly sent with attributes (cause: slippery floor)
- Covers error severity level and exception handling attributes
- Adds iba (instruction base address) and el (event length) to dynamic fields list
- Fixes timed event mapping to ignore variable event length values
* Add integration test for logException
- Tests NSException logging functionality
- Covers exception name, reason, and SDK handling
- Based on ViewController.m logException method
- Fixes dynamic 'is' field in mapping-log-error.json to use ${json-unit.ignore}
* feat: Pass API keys via environment variables in integration tests
- Read MPARTICLE_API_KEY and MPARTICLE_API_SECRET from environment variables in main.swift
- Pass environment variables to simulator using SIMCTL_CHILD_ prefix in common.sh
- Add documentation for required environment variables in README.md
- Validate that environment variables are set before launching tests
* Add integration test for setUserAttribute
- Tests setting predefined user attributes (Age, Gender)
- Covers custom user attributes (Achieved Level)
- Verifies attributes are properly sent in events batch
- Related to SDKE-632
* Add integration test for incrementUserAttribute
- Tests incrementing a numeric user attribute by a specified value
- Covers setting initial attribute value and incrementing it
- Verifies both SET and INCREMENT operations are properly handled
- Related to user attribute management functionality
* - decrease timeout
* Add mapping for Rokt identify request
* Auto-create/remove proxy mappings in recorder/verification scripts
- Add create_proxy_mappings() function to common.sh
- Add remove_proxy_mappings() function to common.sh
- Call create_proxy_mappings in run_wiremock_recorder.sh
- Call remove_proxy_mappings in run_clean_integration_tests.sh
- Remove static proxy mapping files (now generated dynamically)
* Allow running verification tests without API keys
- Use fake keys (us1-00000000...) when env vars not set
- Real keys only required for recording mode
- Update README.md to document this behavior
- Add key validation in run_wiremock_recorder.sh
* Add integration test for setSessionAttribute
- Test sets session attribute 'Station' with value 'Classic Rock'
- Session attributes are sent in session end message (dt: se)
- Calls endSession() to trigger sending the attribute
- Added corresponding WireMock mapping and body files
* Add integration test for incrementSessionAttribute
- Test increments session attribute 'Song Count' by 1 (initial value 5 → 6)
- Requires beginSession() since previous test ends session
- Session attributes are sent in session end message (dt: se)
- Added two mappings: session start (ss) and session end (se)
- Based on ViewController.m lines 348-351
* Add integration test for CCPA consent state
Test 14: Toggle CCPA Consent
- Sets CCPA consent state on current user with all fields (consented, document, timestamp, location, hardwareId)
- Logs event to trigger upload that includes consent data in request body
- Verifies CCPA data is transmitted in 'con.ccpa.data_sale_opt_out' field
Based on ViewController.m toggleCCPAConsent method (lines 357-386)
* Add integration test for toggleGDPRConsent
- Test sets GDPR consent state on the current user
- Based on ViewController.m toggleGDPRConsent method (lines 388-416)
- Creates MPGDPRConsent with consented=true, document, timestamp, location, hardwareId
- Adds GDPR consent with purpose 'My GDPR Purpose' to MPConsentState
- Preserves existing CCPA consent state
- Logs event to trigger upload with consent state in 'con' field
- Uses static timestamp for deterministic testing
* Add integration test for logIDFA (modify iOS Advertiser ID)
- Test modifies user identity to add/update the iOS Advertiser ID via Identity API
- Uses static IDFA value for deterministic testing
- Based on ViewController.m logIDFA method (lines 418-429)
- Added corresponding WireMock mapping and body files
* Add integration test for setATTStatus (App Tracking Transparency)
- Test sets ATT status to 'authorized' with static timestamp
- Based on ViewController.m requestIDFA method (lines 431-476)
- ATT status is sent in device info ('atts' field)
- ATT timestamp is sent in device info ('attt' field)
- Added corresponding WireMock mapping and body files1 parent ad4b0c5 commit 146518d
File tree
39 files changed
+2044
-28
lines changed- IntegrationTests
- Sources
- wiremock-recordings
- __files
- mappings
39 files changed
+2044
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
13 | 28 | | |
14 | 29 | | |
15 | 30 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
| |||
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
174 | | - | |
| 186 | + | |
175 | 187 | | |
176 | 188 | | |
177 | 189 | | |
| |||
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
| |||
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
26 | 36 | | |
27 | 37 | | |
28 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments