Skip to content

Commit

Permalink
chore: remove cypress log noise (#1086)
Browse files Browse the repository at this point in the history
* chore: remove cypress log noise

* chore: remove cypress log noise

* reset surveys cypress file
  • Loading branch information
pauldambra authored Mar 15, 2024
1 parent 9df1369 commit 59ac3f2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/capture.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe('Event capture', () => {

// the code below is going to trigger an event capture
// we want to assert on the request
cy.intercept('POST', '**/e/*', async (request) => {
cy.intercept('POST', '/e/*', async (request) => {
expect(request.headers['content-type']).to.eq('text/plain')
const captures = await getGzipEncodedPayload(request)
expect(captures.map(({ event }) => event)).to.deep.equal(['$autocapture', 'custom-event'])
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/opting-out.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assertWhetherPostHogRequestsWereCalled } from '../support/assertions'
describe('opting out', () => {
describe('session recording', () => {
beforeEach(() => {
cy.intercept('POST', '**/decide/*', {
cy.intercept('POST', '/decide/*', {
config: { enable_collect_everything: false },
editorParams: {},
featureFlags: ['session-recording-player'],
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/session-recording.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { _isNull } from '../../src/utils/type-utils'
import { start } from '../support/setup'

function ensureRecordingIsStopped() {
cy.resetPhCaptures()

cy.get('[data-cy-input]')
.type('hello posthog!')
.wait(250)
Expand All @@ -16,6 +18,8 @@ function ensureRecordingIsStopped() {
}

function ensureActivitySendsSnapshots() {
cy.resetPhCaptures()

cy.get('[data-cy-input]')
.type('hello posthog!')
.wait('@session-recording')
Expand Down
34 changes: 25 additions & 9 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@ Cypress.on('window:before:load', (win) => {
})

beforeEach(() => {
cy.intercept('POST', '**/decide/*').as('decide')
cy.intercept('POST', '**/e/*').as('capture')
cy.intercept('POST', '**/ses/*').as('session-recording')
cy.intercept('GET', '**/surveys/*').as('surveys')
cy.intercept('POST', '/decide/*').as('decide')
cy.intercept('POST', '/e/*', { status: 1 }).as('capture')
cy.intercept('POST', '/ses/*', { status: 1 }).as('session-recording')
cy.intercept('GET', '/surveys/*').as('surveys')

cy.readFile('dist/array.full.js').then((body) => {
cy.intercept('**/static/array.full.js', { body })
cy.intercept('/static/array.full.js', { body })
})

cy.readFile('dist/array.js').then((body) => {
cy.intercept('**/static/array.js', { body })
cy.intercept('/static/array.js', { body })
})

cy.readFile('dist/array.full.js.map').then((body) => {
cy.intercept('/static/array.full.js.map', { body })
})

cy.readFile('dist/array.js.map').then((body) => {
cy.intercept('/static/array.js.map', { body })
})

cy.readFile('dist/recorder.js').then((body) => {
cy.intercept('**/static/recorder.js*', { body }).as('recorder')
cy.intercept('**/static/recorder-v2.js*', { body }).as('recorder')
cy.intercept('/static/recorder.js*', { body }).as('recorder')
cy.intercept('/static/recorder-v2.js*', { body }).as('recorder')
})

cy.readFile('dist/recorder.js.map').then((body) => {
cy.intercept('/static/recorder.js.map', { body })
})

cy.readFile('dist/surveys.js').then((body) => {
cy.intercept('**/static/surveys.js*', { body })
cy.intercept('/static/surveys.js*', { body })
})

cy.readFile('dist/surveys.js.map').then((body) => {
cy.intercept('/static/surveys.js.map', { body })
})
})
2 changes: 1 addition & 1 deletion cypress/support/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const start = ({
...decideResponseOverrides,
config: { enable_collect_everything: true, ...decideResponseOverrides.config },
}
cy.intercept('POST', '**/decide/*', decideResponse).as('decide')
cy.intercept('POST', '/decide/*', decideResponse).as('decide')

cy.visit(url)

Expand Down

0 comments on commit 59ac3f2

Please sign in to comment.