Skip to content

Commit

Permalink
Add test for vertical layout
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoldowsky committed Sep 11, 2024
1 parent 6865b74 commit d8acf33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
29 changes: 20 additions & 9 deletions cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ context('Bar Graph Tile', function () {
it('Can link data ', function () {
beforeTest();

clueCanvas.addTile('bargraph');
barGraph.getTiles().click();
barGraph.getYAxisLabel().should('have.text', 'Counts');
barGraph.getXAxisPulldown().should('have.text', 'Categories');
barGraph.getYAxisTickLabel().should('not.exist');
barGraph.getXAxisTickLabel().should('not.exist');
barGraph.getLegendArea().should('not.exist');
barGraph.getBar().should('not.exist');

// Table dataset for testing:
// 4 instances of X / Y / Z
// 2 instances of XX / Y / Z
Expand All @@ -88,16 +97,8 @@ context('Bar Graph Tile', function () {
['X', 'Y', 'Z'],
]);

clueCanvas.addTile('bargraph');
barGraph.getTiles().click();
barGraph.getYAxisLabel().should('have.text', 'Counts');
barGraph.getXAxisPulldown().should('have.text', 'Categories');
barGraph.getYAxisTickLabel().should('not.exist');
barGraph.getXAxisTickLabel().should('not.exist');
barGraph.getLegendArea().should('not.exist');
barGraph.getBar().should('not.exist');

cy.log('Link bar graph');
barGraph.getTile().click();
clueCanvas.clickToolbarButton('bargraph', 'link-tile');
cy.get('select').select('Table Data 1');
cy.get('.modal-button').contains("Graph It!").click();
Expand All @@ -111,6 +112,16 @@ context('Bar Graph Tile', function () {
barGraph.getSortByMenuButton().should('have.text', 'None');
barGraph.getSecondaryValueName().should('have.length', 1).and('have.text', 'x');

cy.log('Legend should move to bottom when tile is narrow');
barGraph.getTileContent().should('have.class', 'horizontal').and('not.have.class', 'vertical');
clueCanvas.addTileByDrag('table', 'right');
clueCanvas.addTileByDrag('table', 'right');
barGraph.getTileContent().should('have.class', 'vertical').and('not.have.class', 'horizontal');
clueCanvas.getUndoTool().click(); // undo add table
clueCanvas.getUndoTool().click(); // undo add table
tableTile.getTableTile().should('have.length', 1);
barGraph.getTileContent().should('have.class', 'horizontal').and('not.have.class', 'vertical');

cy.log('Change Sort By');
barGraph.getSortByMenuButton().click();
barGraph.getChakraMenuItem().should('have.length', 3);
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/elements/tile/BarGraphTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class BarGraphTile {
return this.getTile(tileIndex, workspaceClass).find(`.editable-tile-title-text`);
}

getTileContent(tileIndex = 0, workspaceClass) {
return this.getTile(tileIndex, workspaceClass).find(`[data-testid="bar-graph-content"]`);
}

getChakraMenuItem(tileIndex = 0, workspaceClass) {
return cy.get(`body .chakra-portal button`).filter(':visible');
}
Expand Down

0 comments on commit d8acf33

Please sign in to comment.