-
Notifications
You must be signed in to change notification settings - Fork 135
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
🧪 Update browser matrix for tests #2884
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2884 +/- ##
==========================================
+ Coverage 93.65% 93.67% +0.01%
==========================================
Files 268 268
Lines 7584 7584
Branches 1686 1687 +1
==========================================
+ Hits 7103 7104 +1
+ Misses 481 480 -1 ☔ View full report in Codecov by Sentry. |
13b2419
to
8bb6673
Compare
getSpy: spyOnProperty(document, 'cookie', 'get').and.callFake(() => cookie), | ||
setSpy: spyOnProperty(document, 'cookie', 'set').and.callFake((newCookie) => (cookie = newCookie)), |
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.
fix for Firefox 67
@@ -46,7 +46,7 @@ describe('sanitize', () => { | |||
const symbolFunction: (description: string) => any = (window as any).Symbol | |||
if (typeof symbolFunction === 'function') { | |||
const symbol = symbolFunction('description') | |||
expect(sanitize(symbol)).toEqual('[Symbol] description') | |||
expect(sanitize(symbol)).toMatch(/\[Symbol\] (?:Symbol\()?description\)?/) |
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 match better the implementation:
return `[Symbol] ${(value as symbolWithDescription).description || value.toString()}
which will return [Symbol] foo
if Symbol.description is supported and [Symbol] Symbol(foo)
otherwise
@@ -77,7 +77,7 @@ export function instrumentMethod<TARGET extends { [key: string]: any }, METHOD e | |||
let original = targetPrototype[method] | |||
|
|||
if (typeof original !== 'function') { | |||
if (startsWith(method, 'on')) { | |||
if (method in targetPrototype && startsWith(method, 'on')) { |
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.
if the event is not supported (e.g 'onunhandledrejection' in window) we should replace it.
let onunhandledrejectionSpy: jasmine.Spy | ||
|
||
beforeEach(() => { | ||
onunhandledrejectionSpy = jasmine.createSpy() | ||
window.onunhandledrejection = onunhandledrejectionSpy | ||
|
||
registerCleanupTask(() => { | ||
window.onunhandledrejection = null | ||
}) | ||
}) | ||
|
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.
unused
window.onunhandledrejection = (ev: PromiseRejectionEvent) => { | ||
throw new Error(`unhandled rejected promise \n ${ev.reason as string}`) | ||
} |
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.
unused
8bb6673
to
0ecbfef
Compare
1ab31a8
to
612c73e
Compare
0ecbfef
to
7e10985
Compare
7e10985
to
c051ad0
Compare
/to-staging |
🚂 Branch Integration: starting soon, median merge time is 11m Commit 111f94454a will soon be integrated into staging-30. Use |
🚨 Branch Integration: This merge request has conflicts We couldn't automatically merge the commit 111f94454a into staging-30! You can use this resolution PR: #2898 to fix the conflicts. If you need support, contact us on Slack #devflow with those details! |
@@ -138,5 +137,5 @@ function slidingSessionWindow() { | |||
* Check whether `layout-shift` is supported by the browser. | |||
*/ | |||
export function isLayoutShiftSupported() { | |||
return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) | |||
return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window |
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.
We used WeakRef
to avoid memory leak when tracking CLS vital and assumed that browsers supporting layout-shift where also supporting WeakRef. Unfortunately that's not true and there is a few browsers versions that does support layout shift but not WeakRef. Unfortunately we were never testing on such browsers :(
This bug affect the following browsers:
- Chrome 77 to 83
- Edge 79 to 83
- Opera 64 to 69
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.
Not sure how this is communicated, but it's worth mentioning in our documentation I guess
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 agree, although currently there is a lot of gaps on how we document the features supported by browsers and does not includes version.
My RFC around dropping IE11 proposes to remediates to this issue:
Additionally we can update the feature support by browser to also include specific version numbers.
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.
👏 Praise: Thanks for the cleanup
@@ -138,5 +137,5 @@ function slidingSessionWindow() { | |||
* Check whether `layout-shift` is supported by the browser. | |||
*/ | |||
export function isLayoutShiftSupported() { | |||
return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) | |||
return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window |
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.
Not sure how this is communicated, but it's worth mentioning in our documentation I guess
🚂 Branch Integration: starting soon, median merge time is 11m Commit 111f94454a will soon be integrated into staging-30. |
🚨 Branch integration failed Have a look at the resolution PR #2898 for more information. |
🚂 Branch Integration: starting soon, median merge time is 11m Commit 111f94454a will soon be integrated into staging-30. |
🚨 Branch integration failed Have a look at the resolution PR #2898 for more information. |
fdc61b0
to
fe33e68
Compare
fe33e68
to
58b2726
Compare
/to-staging |
🚂 Branch Integration: starting soon, median merge time is 0s Commit efe8b8cd27 will soon be integrated into staging-31. Use |
…ng-31 Integrated commit sha: efe8b8c Co-authored-by: Thomas Lebeau <thomas.lebeau@datadoghq.com>
🚂 Branch Integration: This commit was successfully integrated Commit efe8b8cd27 has been merged into staging-31 in merge commit 367f4caa30. Check out the triggered pipeline on Gitlab 🦊 |
test/browsers.unit.conf.js
Outdated
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.
Suggestion:
- move
browsers.e2e.conf.js
toe2e/browsers.conf.js
- move
browsers.unit.conf.js
tounit/browsers.conf.js
- remove unnecessary entries from browsers used by e2e tests (see
browser-sdk/test/e2e/wdio.bs.conf.ts
Lines 12 to 19 in efe8b8c
.filter( (configuration) => configuration.sessionName !== 'IE' && // Safari mobile on iOS <= 14.0 does not support // the way we flush events on page change // TODO check newer version on browserstack configuration.sessionName !== 'Safari mobile' )
Motivation
Until now we're testing only on somewhat recent version off different browsers. However, as we're defining a new browser support matrix I thought it would be better to test on the actual minimum version of the browsers we're supporting.
This PR only focus on unit tests. I'll investigate separately for e2e tests as it's a bit more complicated.
Changes
onunhandledrejection
to handle the case where it's not supported (Firefox 67 & 68)Testing
I have gone over the contributing documentation.