forked from PostHog/posthog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(exports): Dashboard / Insight exporting (PostHog#9830)
* Adds chromium / selenium for image exporting * Added uploading of downloads folder to artefacts * Adds ExportButton to generate desired asset
- Loading branch information
1 parent
e821341
commit 57874f9
Showing
74 changed files
with
1,711 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
|
||
|
||
## Testing Feature Flags | ||
|
||
The Cypress tests run with a PostHog instance that has no feature flags set up. | ||
|
||
To test feature flags you can intercept the call to the `decide` endpoint | ||
|
||
```javascript | ||
// sometimes the system under test calls `/decide` | ||
// and sometimes it calls https://app.posthog.com/decide | ||
cy.intercept(/.*\/decide\/.*/, (req) => | ||
req.reply( | ||
decideResponse({ | ||
// add feature flags here, for e.g. | ||
// 'feature-flag-key': true, | ||
}) | ||
) | ||
) | ||
``` | ||
// sometimes the system under test calls `/decide` | ||
// and sometimes it calls https://app.posthog.com/decide | ||
cy.intercept('https://app.posthog.com/decide/*', (req) => | ||
req.reply( | ||
decideResponse({ | ||
// add feature flags here, for e.g. | ||
// 'feature-flag-key': true, | ||
}) | ||
) | ||
) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { urls } from 'scenes/urls' | ||
|
||
import { decideResponse } from '../fixtures/api/decide' | ||
|
||
// NOTE: As the API data is randomly generated, we are only really testing here that the overall output is correct | ||
// The actual graph is not under test | ||
describe('Exporting Insights', () => { | ||
beforeEach(() => { | ||
cy.intercept('https://app.posthog.com/decide/*', (req) => | ||
req.reply( | ||
decideResponse({ | ||
'export-dashboard-insights': true, | ||
}) | ||
) | ||
) | ||
cy.visit(urls.insightNew()) | ||
// apply filter | ||
cy.get('[data-attr=trends-filters-add-filter-group]').click() | ||
cy.get('[data-attr=property-select-toggle-0]').click() | ||
cy.get('[data-attr=taxonomic-filter-searchfield]').click() | ||
cy.get('[data-attr=expand-list-event_properties]').click() | ||
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true }) | ||
cy.get('[data-attr=prop-val] input').type('not-applicable') | ||
cy.get('[data-attr=prop-val] input').type('{enter}') | ||
|
||
// Save | ||
cy.get('[data-attr="insight-save-button"]').click() | ||
}) | ||
|
||
it('Export an Insight to png', () => { | ||
cy.get('[data-attr=more-button]').click() | ||
cy.get('[data-attr=export-button]').click() | ||
cy.get('[data-attr=export-button-png]').click() | ||
|
||
const expecteFileName = 'export-pageview-count.png' | ||
cy.task('compareToReferenceImage', { | ||
source: expecteFileName, | ||
reference: `../data/exports/${expecteFileName}`, | ||
diffThreshold: 0.01, | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.