Skip to content
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

🐛 Fix replay visual viewport resize support #2891

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

amortemousque
Copy link
Collaborator

@amortemousque amortemousque commented Jul 24, 2024

Motivation

A regression has been introduced in the PR: the replay visual viewport resize support has been removed.

Changes

  • Call trackVisualViewportResize in records
  • Add tests in records.ts to test that all records types are collected

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque requested a review from a team as a code owner July 24, 2024 08:09
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.77%. Comparing base (92d7ab9) to head (3be0608).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2891      +/-   ##
==========================================
+ Coverage   93.75%   93.77%   +0.01%     
==========================================
  Files         266      267       +1     
  Lines        7575     7577       +2     
  Branches     1685     1685              
==========================================
+ Hits         7102     7105       +3     
+ Misses        473      472       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amortemousque amortemousque force-pushed the aymeric/fix-replay-visual-viewport branch from 55176b3 to 9fb112d Compare July 24, 2024 08:13
Copy link

cit-pr-commenter bot commented Jul 24, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.21 KiB 160.49 KiB 290 B +0.18%
Logs 56.82 KiB 56.82 KiB 0 B 0.00%
Rum Slim 108.78 KiB 108.78 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.001 0.001 0.000
addaction 0.030 0.033 0.002
adderror 0.032 0.034 0.002
addtiming 0.001 0.001 0.000
startview 0.900 1.323 0.423
startstopsessionreplayrecording 0.816 0.987 0.171
logmessage 0.018 0.022 0.003
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 21.45 KiB 20.59 KiB -876 B
addaction 71.97 KiB 72.41 KiB 441 B
adderror 87.07 KiB 88.35 KiB 1.29 KiB
addtiming 19.26 KiB 20.05 KiB 809 B
startview 347.99 KiB 354.96 KiB 6.97 KiB
startstopsessionreplayrecording 14.75 KiB 15.01 KiB 267 B
logmessage 72.89 KiB 71.44 KiB -1489 B

🔗 RealWorld

expect(getEmittedRecords()[0].type).toBe(RecordType.Focus)
})

it('adds a Focus record on when taking a full snapshot', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now covered here:

it('full snapshot records should contain Meta, Focus, FullSnapshot', () => {

expect(getEmittedRecords()[1].type).toBe(RecordType.Focus)
})

it('set has_focus to true if the document has the focus', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already covered here:

expect((getEmittedRecords()[1] as FocusRecord).data.has_focus).toBe(true)
})

it("set has_focus to false if the document doesn't have the focus", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already covered here:

Comment on lines -157 to -182
it('adds an initial Focus record when starting to record', () => {
startRecording()
expect(getEmittedRecords()[1]).toEqual({
type: RecordType.Focus,
timestamp: jasmine.any(Number),
data: {
has_focus: true,
},
})
})

it('adds a Focus record on focus', () => {
startRecording()
emitSpy.calls.reset()

window.dispatchEvent(createNewEvent('focus'))
expect(getEmittedRecords()[0].type).toBe(RecordType.Focus)
})

it('adds a Focus record on blur', () => {
startRecording()
emitSpy.calls.reset()

window.dispatchEvent(createNewEvent('blur'))
expect(getEmittedRecords()[0].type).toBe(RecordType.Focus)
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically covered here:

it('full snapshot records should contain Meta, Focus, FullSnapshot', () => {

Copy link
Member

@BenoitZugmeyer BenoitZugmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@@ -422,6 +369,95 @@ describe('record', () => {
})
})

describe('should collect records', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 praise: ‏looks great

@amortemousque amortemousque merged commit c41d1d1 into main Jul 25, 2024
20 checks passed
@amortemousque amortemousque deleted the aymeric/fix-replay-visual-viewport branch July 25, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants