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

28 lines
1.2 KiB
TypeScript

import 'cypress-network-idle'
import { urls } from 'scenes/urls'
describe('insights date picker', () => {
beforeEach(() => {
cy.visit(urls.insightNew())
cy.waitForNetworkIdle(300)
})
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('.Popover [data-attr=rolling-date-range-input]').type('{selectall}5{enter}')
cy.get('.Popover [data-attr=rolling-date-range-date-options-selector]').click()
cy.get('.RollingDateRangeFilter__popover > div').contains('days').should('exist').click()
cy.get('.Popover .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')
})
})