-
Notifications
You must be signed in to change notification settings - Fork 57
test: updated setup for identity tests #1105
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
test: updated setup for identity tests #1105
Conversation
test/karma.config.js
Outdated
| captureConsole, | ||
| mocha: { | ||
| timeout: 5000 // 5 seconds. Increase from default 2 seconds. | ||
| timeout: 10000 // 10 seconds. Increase from default 2 seconds. |
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.
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.
nevermind, may be the comment i left above actually in the utils.js file for waitForCondition instead
test/src/config/utils.js
Outdated
| waitForCondition = function async( | ||
| conditionFn, | ||
| timeout = 200, | ||
| timeout = 2000, |
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.
| await waitForCondition(hasIdentityCallInflightReturned); | ||
| await waitForCondition(() => { |
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 should be either the await you added OR the await that's already here. there isn't really a reason to have both. I'd test again using just the bottom one, because the fetchMock on line 1051 i the reason the current waitForConfition should be working. if the one you added is more reliable though, that's fine
| await waitForCondition(() => { | ||
| const currentUser = mParticle.Identity.getCurrentUser(); | ||
| const userIdentities = currentUser?.getUserIdentities()?.userIdentities; | ||
| return userIdentities && | ||
| userIdentities.customerid === 'customerid1' && | ||
| userIdentities.email === '[email protected]'; | ||
| }); |
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.
I think I see why the waitForCondition for identityCallInFlight === false may not be reliable. because it is set to false BEFORE parsing the identityResponse, which is where a lot of the additional logic about making a new current user, happens. So we can probably remove the waitForCondition and leave yours.
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 can be a future cleanup ticket once we merge everything in, but at the bottom of the parseIdentityResponse, we do log Successfully parsed Identity Response. I wonder if we should be mocking the logger and waiting for this to be called and then this will basically allow us to know that an identity has been fully returned AND completely parsed.
| mParticle.getInstance()._Store.identityCallInFlight === false | ||
| ); | ||
| }); | ||
| // switching back to logged in user should not result in any UIC events |
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.
let's keep this comment
test/src/tests-identity.ts
Outdated
| mParticle.init(apiKey, window.mParticle.config); | ||
|
|
||
| await waitForCondition(hasIdentityCallInflightReturned) | ||
| await waitForCondition(hasIdentityCallInflightReturned); |
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.
| await waitForCondition(hasIdentityCallInflightReturned); | |
| await waitForCondition(hasIdentityCallInflightReturned); |
…o test/SDKE-399-evaluate-identity-related-tests
test/src/tests-identity.ts
Outdated
| .should.have.property('attr', 'value'); | ||
| }); | ||
|
|
||
| // https://go.mparticle.com/work/SDKE-420 |
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.
for future reference - this should be go/j/SDKE-420
the mparticle go link would look for this ticket in the mparticle jira, which doesn't work since we are in rokt jira
|
f833be0
into
test/SDKE-303-evaluate-each-integration-test-setup




Background
What Has Changed
Screenshots/Video
Checklist
Additional Notes
Reference Issue (For employees only. Ignore if you are an outside contributor)