Skip to content

Commit

Permalink
test: World bank examples (#12161)
Browse files Browse the repository at this point in the history
* add world bank data fixture

* fix fixture cleanup, add fixture to dashboard_tests

* apply world bank fixtures, fix tests

* fix fixture typo, dashboard ids

* fix export dashboard metadata

* fix test_export_dashboard_command_key_order

* fix export dash tests, not add row when no orphans

* debug timeout

* fixes after merge

* fix lint

* run pre-commit

* comment test for debug

* fix save.test.js

Co-authored-by: Karol Kostrzewa <karol.kostrzewa@polidea.com>
  • Loading branch information
kstrz and Karol Kostrzewa committed Jan 13, 2021
1 parent 87ac22b commit 241f380
Show file tree
Hide file tree
Showing 22 changed files with 807 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ describe('Dashboard save action', () => {
cy.server();
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
});

it('should save as new dashboard', () => {
cy.get('#app').then(data => {
const bootstrapData = JSON.parse(data[0].dataset.bootstrap);
const dashboard = bootstrapData.dashboard_data;
Expand All @@ -50,6 +47,14 @@ describe('Dashboard save action', () => {
});
});

it('should save as new dashboard', () => {
cy.wait('@copyRequest').then(xhr => {
expect(xhr.response.body.dashboard_title).to.not.equal(
`World Bank's Data`,
);
});
});

it('should save/overwrite dashboard', () => {
cy.get('[data-test="grid-row-background--transparent"]').within(() => {
cy.get('.box_plot', { timeout: 10000 }).should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Dashboard form data', () => {
it('should apply url params to slice requests', () => {
const aliases = getChartAliases(dashboard.slices);
// wait and verify one-by-one
cy.wait(aliases).then(requests =>
cy.wait(aliases, { timeout: 18000 }).then(requests =>
Promise.all(
requests.map(async xhr => {
expect(xhr.status).to.eq(200);
Expand Down
4 changes: 3 additions & 1 deletion superset/dashboards/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def _export(model: Dashboard) -> Iterator[Tuple[str, str]]:
orphan_charts = {
chart for chart in model.slices if str(chart.uuid) not in referenced_charts
}
payload["position"] = append_charts(payload["position"], orphan_charts)

if orphan_charts:
payload["position"] = append_charts(payload["position"], orphan_charts)

payload["version"] = EXPORT_VERSION

Expand Down
Loading

0 comments on commit 241f380

Please sign in to comment.