feat(integration): ✨ Add Google Analytics integration
This commit is contained in:
36
apps/builder/cypress/tests/integrations/googleAnalytics.ts
Normal file
36
apps/builder/cypress/tests/integrations/googleAnalytics.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { createTypebotWithStep } from 'cypress/plugins/data'
|
||||
import { preventUserFromRefreshing } from 'cypress/plugins/utils'
|
||||
import { IntegrationStepType } from 'models'
|
||||
|
||||
describe('Google Analytics', () => {
|
||||
beforeEach(() => {
|
||||
cy.task('seed')
|
||||
createTypebotWithStep({ type: IntegrationStepType.GOOGLE_ANALYTICS })
|
||||
cy.signOut()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
cy.window().then((win) => {
|
||||
win.removeEventListener('beforeunload', preventUserFromRefreshing)
|
||||
})
|
||||
})
|
||||
|
||||
it.only('can be filled correctly', () => {
|
||||
cy.signIn('test2@gmail.com')
|
||||
cy.visit('/typebots/typebot3/edit')
|
||||
cy.intercept({
|
||||
url: '/g/collect',
|
||||
method: 'POST',
|
||||
}).as('gaRequest')
|
||||
cy.findByTestId('step-step1').click()
|
||||
cy.findByRole('textbox', { name: 'Tracking ID:' }).type('G-VWX9WG1TNS')
|
||||
cy.findByRole('textbox', { name: 'Event category:' }).type('Typebot')
|
||||
cy.findByRole('textbox', { name: 'Event action:' }).type('Submit email')
|
||||
cy.findByRole('button', { name: 'Advanced' }).click()
|
||||
cy.findByRole('textbox', { name: 'Event label Optional :' }).type(
|
||||
'Campaign Z'
|
||||
)
|
||||
cy.findByRole('textbox', { name: 'Event value Optional :' }).type('20')
|
||||
// Not sure how to test if GA integration works correctly in the preview tab
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user