0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/cypress/e2e/insights-date-picker.ts

25 lines
1.1 KiB
TypeScript

import { urls } from 'scenes/urls'
describe('insights date picker', () => {
beforeEach(() => {
cy.visit(urls.insightNew())
})
it('Can set the date filter and show the right grouping interval', () => {
cy.get('[data-attr=date-filter]').click()
cy.get('div').contains('Yesterday').should('exist').click()
cy.get('[data-attr=interval-filter] .LemonButton__content').should('contain', 'hour')
})
it('Can set a custom rolling date range', () => {
cy.get('[data-attr=date-filter]').click()
cy.get('[data-attr=rolling-date-range-input]').type('{selectall}5{enter}')
cy.get('[data-attr=rolling-date-range-date-options-selector]').click()
cy.get('.RollingDateRangeFilter__popover > div').contains('days').should('exist').click()
cy.get('.RollingDateRangeFilter__label').should('contain', 'In the last').click()
// Test that the button shows the correct formatted range
cy.get('[data-attr=date-filter]').get('.LemonButton__content').contains('Last 5 days').should('exist')
})
})