Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into record-on-url-trigger
Browse files Browse the repository at this point in the history
richard-better authored Oct 17, 2024
2 parents e0a2e82 + 6d475cc commit c906b94
Showing 23 changed files with 739 additions and 362 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## 1.170.1 - 2024-10-16

- feat: add stack to stacktraceless "exceptions" (#1472)

## 1.170.0 - 2024-10-16

- fix: web vitals delayed capture (#1474)

## 1.169.1 - 2024-10-16

- chore: skip if Array.from is missing (#1475)

## 1.169.0 - 2024-10-15

- feat: report reason for recording start (#1452)
- chore: improve exception autocapture (#1466)

## 1.168.0 - 2024-10-15

- fix(errors): Better define schema, align with python (#1460)
- chore: refactor some cypress setup (#1467)

## 1.167.1 - 2024-10-14

- fix: sanitize set_once properties (#1462)

## 1.167.0 - 2024-10-08

- feat(web experiments): Emit web_experiment_applied event and do not render experiments for bots (#1443)
33 changes: 23 additions & 10 deletions cypress/e2e/error-tracking.cy.ts
Original file line number Diff line number Diff line change
@@ -17,12 +17,11 @@ describe('Exception capture', () => {
cy.phCaptures({ full: true }).then((captures) => {
expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$autocapture', '$exception'])
expect(captures[2].event).to.be.eql('$exception')
expect(captures[2].properties.$exception_message).to.be.eql('wat even am I')
expect(captures[2].properties.$exception_type).to.be.eql('Error')
expect(captures[2].properties.extra_prop).to.be.eql(2)
expect(captures[2].properties.$exception_source).to.eql(undefined)
expect(captures[2].properties.$exception_personURL).to.eql(undefined)
expect(captures[2].properties.$exception_stack_trace_raw).not.to.exist
expect(captures[2].properties.$exception_list[0].value).to.be.eql('wat even am I')
expect(captures[2].properties.$exception_list[0].type).to.be.eql('Error')
})
})

@@ -42,6 +41,22 @@ describe('Exception capture', () => {
cy.wait('@exception-autocapture-script')
})

it('adds stacktrace to captured strings', () => {
cy.get('[data-cy-exception-string-button]').click()

// ugh
cy.wait(1500)

cy.phCaptures({ full: true }).then((captures) => {
expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$autocapture', '$exception'])
expect(captures[2].event).to.be.eql('$exception')
expect(captures[2].properties.$exception_list[0].stacktrace.frames.length).to.be.eq(1)
expect(captures[2].properties.$exception_list[0].stacktrace.frames[0].function).to.be.eq(
'HTMLButtonElement.onclick'
)
})
})

it('autocaptures exceptions', () => {
cy.get('[data-cy-button-throws-error]').click()

@@ -51,11 +66,9 @@ describe('Exception capture', () => {
cy.phCaptures({ full: true }).then((captures) => {
expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$autocapture', '$exception'])
expect(captures[2].event).to.be.eql('$exception')
expect(captures[2].properties.$exception_message).to.be.eql('This is an error')
expect(captures[2].properties.$exception_type).to.be.eql('Error')
expect(captures[2].properties.$exception_source).to.match(
/http:\/\/localhost:\d+\/playground\/cypress\//
)
expect(captures[2].properties.$exception_list[0].value).to.be.eql('This is an error')
expect(captures[2].properties.$exception_list[0].type).to.be.eql('Error')

expect(captures[2].properties.$exception_personURL).to.match(
/http:\/\/localhost:\d+\/project\/test_token\/person\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/
)
@@ -69,8 +82,8 @@ describe('Exception capture', () => {
cy.wait(1500)

cy.phCaptures({ full: true }).then((captures) => {
expect(captures[2].properties.$exception_message).to.be.eql('wat even am I')
expect(captures[2].properties.$exception_stack_trace_raw).to.exist
expect(captures[2].properties.$exception_list).to.exist
expect(captures[2].properties.$exception_list[0].value).to.be.eql('wat even am I')
})
})
})
30 changes: 15 additions & 15 deletions cypress/e2e/opting-out.cy.ts
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ describe('opting out', () => {
cy.get('[data-cy-input]').type('hello world! ')

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': false,
'@session-recording': false,
})
@@ -51,7 +51,7 @@ describe('opting out', () => {
cy.posthogInit({ opt_out_capturing_by_default: true })

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -69,7 +69,7 @@ describe('opting out', () => {
cy.posthogInit({ disable_session_recording: true })

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -87,7 +87,7 @@ describe('opting out', () => {
cy.posthogInit({ opt_out_capturing_by_default: true })

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -101,7 +101,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
@@ -117,7 +117,7 @@ describe('opting out', () => {
cy.posthogInit({ disable_session_recording: true })

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -134,7 +134,7 @@ describe('opting out', () => {
cy.posthog().invoke('startSessionRecording')

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
@@ -163,7 +163,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -177,7 +177,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
@@ -206,7 +206,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -220,7 +220,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
@@ -262,7 +262,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -276,7 +276,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
@@ -323,7 +323,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@recorder-script': false,
'@decide': true,
'@session-recording': false,
})
@@ -337,7 +337,7 @@ describe('opting out', () => {
})

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@recorder-script': true,
'@decide': true,
// no call to session-recording yet
})
Loading

0 comments on commit c906b94

Please sign in to comment.