2024-08-05 09:14:29 +02:00
|
|
|
import 'cypress-network-idle'
|
|
|
|
|
2023-10-12 01:51:47 +02:00
|
|
|
import { urls } from 'scenes/urls'
|
|
|
|
|
2023-09-18 15:00:03 +02:00
|
|
|
describe('insights date picker', () => {
|
2023-10-12 01:51:47 +02:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit(urls.insightNew())
|
2024-08-05 09:14:29 +02:00
|
|
|
cy.waitForNetworkIdle(300)
|
2023-10-12 01:51:47 +02:00
|
|
|
})
|
|
|
|
|
2023-09-18 15:00:03 +02:00
|
|
|
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()
|
2023-10-12 01:51:47 +02:00
|
|
|
cy.get('[data-attr=interval-filter] .LemonButton__content').should('contain', 'hour')
|
2023-09-18 15:00:03 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Can set a custom rolling date range', () => {
|
|
|
|
cy.get('[data-attr=date-filter]').click()
|
2024-06-14 00:43:25 +02:00
|
|
|
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()
|
2023-09-18 15:00:03 +02:00
|
|
|
cy.get('.RollingDateRangeFilter__popover > div').contains('days').should('exist').click()
|
2024-06-14 00:43:25 +02:00
|
|
|
cy.get('.Popover .RollingDateRangeFilter__label').should('contain', 'In the last').click()
|
2023-09-18 15:00:03 +02:00
|
|
|
|
|
|
|
// Test that the button shows the correct formatted range
|
2023-10-12 01:51:47 +02:00
|
|
|
cy.get('[data-attr=date-filter]').get('.LemonButton__content').contains('Last 5 days').should('exist')
|
2023-09-18 15:00:03 +02:00
|
|
|
})
|
|
|
|
})
|