2023-03-18 11:32:22 +01:00
|
|
|
import { urls } from 'scenes/urls'
|
|
|
|
import { insight } from '../productAnalytics'
|
|
|
|
import { decideResponse } from '../fixtures/api/decide'
|
|
|
|
|
|
|
|
// For tests related to trends please check trendsElements.js
|
|
|
|
describe('Insights (with data exploration on)', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.intercept('https://app.posthog.com/decide/*', (req) =>
|
|
|
|
req.reply(
|
|
|
|
decideResponse({
|
|
|
|
'data-exploration-query-tab': true,
|
|
|
|
'data-exploration-insights': true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
cy.visit(urls.insightNew())
|
|
|
|
})
|
|
|
|
|
|
|
|
it('shows the edit as json button', () => {
|
2023-03-18 18:38:11 +01:00
|
|
|
insight.newInsight('TRENDS', true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can shows the query editor', () => {
|
|
|
|
insight.newInsight('TRENDS', true)
|
|
|
|
cy.get('[aria-label="Edit code"]').click()
|
|
|
|
cy.get('[data-attr="query-editor"]').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can edit an insight using the query editor', () => {
|
|
|
|
insight.newInsight('TRENDS', true)
|
|
|
|
cy.get('[aria-label="Edit code"]').click()
|
|
|
|
cy.get('[data-attr="query-editor"]').should('exist')
|
2023-03-18 11:32:22 +01:00
|
|
|
})
|
|
|
|
})
|