Skip to content

Commit

Permalink
fix cy
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Aug 6, 2020
1 parent 8e30a53 commit ab9f2a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Dashboard edit mode', () => {
cy.server();
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
cy.get('.dashboard-header').contains('Edit dashboard').click();
cy.get('.dashboard-header [data-test=pencil]').click();
});

it('remove, and add chart flow', () => {
Expand All @@ -38,11 +38,12 @@ describe('Dashboard edit mode', () => {
cy.get('.grid-container .box_plot').should('not.exist');
});

// open charts list
cy.get('.component-layer').contains('Your charts & filters').click();
cy.get('.tabs-components .nav-tabs li a').contains('Charts').click();

// find box plot is available from list
cy.get('.slices-layer').find('.chart-card-container').contains('Box plot');
cy.get('.tabs-components')
.find('.chart-card-container')
.contains('Box plot');

// drag-n-drop
const dataTransfer = { data: {} };
Expand All @@ -62,14 +63,14 @@ describe('Dashboard edit mode', () => {
cy.get('.grid-container .box_plot').should('be.exist');

// should show Save changes button
cy.get('.dashboard-header .button-container').contains('Save changes');
cy.get('.dashboard-header .button-container').contains('Save');

// undo 2 steps
cy.get('.dashboard-header .undo-action').click().click();

// no changes, can switch to view mode
cy.get('.dashboard-header .button-container')
.contains('Switch to view mode')
.contains('Discard Changes')
.click();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,18 @@ describe('Dashboard save action', () => {
cy.get('.grid-container .box_plot', { timeout: 5000 }); // wait for 5 secs

// remove box_plot chart from dashboard
cy.get('.dashboard-header')
.contains('Edit dashboard')
.trigger('click', { force: true });
cy.get('.dashboard-header [data-test=pencil]').click();
cy.get('.fa.fa-trash').last().trigger('click', { force: true });
cy.get('.grid-container .box_plot').should('not.exist');

cy.route('POST', '/superset/save_dash/**/').as('saveRequest');
cy.get('.dashboard-header')
.contains('Save changes')
.contains('Save')
.trigger('click', { force: true });

// go back to view mode
cy.wait('@saveRequest');
cy.get('.dashboard-header').contains('Edit dashboard');
cy.get('.dashboard-header [data-test=pencil]').click();
cy.get('.grid-container .box_plot').should('not.exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BuilderComponentPane extends React.PureComponent {
renderTabs(height) {
const { isSticky } = this.props;
return (
<Tabs className="m-t-10">
<Tabs className="m-t-10 tabs-components">
<Tab eventKey={1} title={t('Components')}>
<NewTabs />
<NewRow />
Expand All @@ -56,7 +56,7 @@ class BuilderComponentPane extends React.PureComponent {
<NewMarkdown />
<NewDivider />
</Tab>
<Tab eventKey={2} title={t('Charts')}>
<Tab eventKey={2} title={t('Charts')} className="tab-charts">
<SliceAdder
height={height + (isSticky ? SUPERSET_HEADER_HEIGHT : 0)}
/>
Expand Down

0 comments on commit ab9f2a3

Please sign in to comment.