diff --git a/cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js b/cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js index 829558e4ae..57a15d2fe2 100644 --- a/cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js +++ b/cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js @@ -3,6 +3,9 @@ import Canvas from '../../../support/elements/common/Canvas'; import BarGraphTile from '../../../support/elements/tile/BarGraphTile'; import TableToolTile from '../../../support/elements/tile/TableToolTile'; +import { LogEventName } from "../../../../src/lib/logger-types"; + + let clueCanvas = new ClueCanvas, barGraph = new BarGraphTile, tableTile = new TableToolTile; @@ -10,6 +13,8 @@ let clueCanvas = new ClueCanvas, // eslint-disable-next-line unused-imports/no-unused-vars const canvas = new Canvas; +const workspaces = ['.primary-workspace', '.read-only-local-workspace', '.read-only-remote-workspace']; + function textMatchesList(selector, expected) { selector.should('have.length', expected.length); selector.each(($el, index) => { @@ -20,6 +25,9 @@ function textMatchesList(selector, expected) { function beforeTest() { const url = "/editor/?appMode=qa&unit=./demo/units/qa/content.json"; cy.visit(url); + cy.window().then(win => { + cy.stub(win.ccLogger, "log").as("log"); + }); } context('Bar Graph Tile', function () { @@ -28,59 +36,136 @@ context('Bar Graph Tile', function () { beforeTest(); clueCanvas.addTile('bargraph'); - barGraph.getTiles().should('have.length', 1); - barGraph.getTile() - .should('be.visible') - .and('have.class', 'bar-graph-tile') - .and('not.have.class', 'read-only'); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 1); + barGraph.getTile(workspace, 0) + .should('be.visible') + .and('have.class', 'bar-graph-tile'); + barGraph.getTileTitle(workspace).should("be.visible").and('have.text', 'Bar Graph 1'); + barGraph.getYAxisLabel(workspace).should('have.text', 'Counts'); + barGraph.getXAxisPulldownButton(workspace).should('have.text', 'Categories'); + } + barGraph.getTile(workspaces[0]).should('not.have.class', 'readonly'); + barGraph.getTile(workspaces[1]).should('have.class', 'readonly'); + barGraph.getTile(workspaces[2]).should('have.class', 'readonly'); - barGraph.getTileTitle().should("be.visible").and('have.text', 'Bar Graph 1'); - barGraph.getYAxisLabel().should('have.text', 'Counts'); - barGraph.getXAxisPulldownButton(0).should('have.text', 'Categories'); + cy.get("@log") + .should("have.been.been.calledWith", LogEventName.CREATE_TILE, Cypress.sinon.match.object) + .its("firstCall.args.1").should("deep.include", { objectType: "BarGraph" }); + + // Undo/redo tile creation + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 0); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 1); + } cy.log('Change Y axis label'); barGraph.getYAxisLabelEditor().should('not.exist'); barGraph.getYAxisLabelButton().click(); barGraph.getYAxisLabelEditor().should('be.visible').type(' of something{enter}'); barGraph.getYAxisLabelEditor().should('not.exist'); + for (const workspace of workspaces) { + barGraph.getYAxisLabel(workspace).should('have.text', 'Counts of something'); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.BARGRAPH_TOOL_CHANGE); + cy.get("@log").its("lastCall.args.1").should("deep.include", { operation: "setYAxisLabel", text: "Counts of something" }); + + // Undo/redo label change + clueCanvas.getUndoTool().click(); + barGraph.getYAxisLabel().should('have.text', 'Counts'); + clueCanvas.getRedoTool().click(); + barGraph.getYAxisLabel().should('have.text', 'Counts of something'); + + // ESC key should cancel the edit + barGraph.getYAxisLabelButton().click(); + barGraph.getYAxisLabelEditor().should('be.visible').type(' abandon this{esc}'); + barGraph.getYAxisLabelEditor().should('not.exist'); barGraph.getYAxisLabel().should('have.text', 'Counts of something'); + // Should not be able to change Y axis label in read-only views + barGraph.getYAxisLabelButton(workspaces[1]).click(); + barGraph.getYAxisLabelEditor(workspaces[1]).should('not.exist'); + barGraph.getYAxisLabelButton(workspaces[2]).click(); + barGraph.getYAxisLabelEditor(workspaces[2]).should('not.exist'); + cy.log('Duplicate tile'); clueCanvas.getDuplicateTool().click(); - barGraph.getTiles().should('have.length', 2); - barGraph.getTile(0) - .should('be.visible') - .and('have.class', 'bar-graph-tile') - .and('not.have.class', 'read-only'); - barGraph.getTileTitle(0).should("be.visible").and('have.text', 'Bar Graph 1'); - barGraph.getYAxisLabel(0).should('have.text', 'Counts of something'); - barGraph.getXAxisPulldownButton(0).should('have.text', 'Categories'); - - barGraph.getTile(1) - .should('be.visible') - .and('have.class', 'bar-graph-tile') - .and('not.have.class', 'read-only'); - barGraph.getTileTitle(1).should("be.visible").and('have.text', 'Bar Graph 2'); - barGraph.getYAxisLabel(1).should('have.text', 'Counts of something'); - barGraph.getXAxisPulldownButton(1).should('have.text', 'Categories'); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 2); + barGraph.getTile(workspace, 0) + .should('be.visible') + .and('have.class', 'bar-graph-tile'); + barGraph.getTileTitle(workspace, 0).should("be.visible").and('have.text', 'Bar Graph 1'); + barGraph.getYAxisLabel(workspace, 0).should('have.text', 'Counts of something'); + barGraph.getXAxisPulldownButton(workspace, 0).should('have.text', 'Categories'); + + barGraph.getTile(workspace, 1) + .should('be.visible') + .and('have.class', 'bar-graph-tile'); + barGraph.getTileTitle(workspace, 1).should("be.visible").and('have.text', 'Bar Graph 2'); + barGraph.getYAxisLabel(workspace, 1).should('have.text', 'Counts of something'); + barGraph.getXAxisPulldownButton(workspace, 1).should('have.text', 'Categories'); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.COPY_TILE); + cy.get("@log").its("lastCall.args.1").should("deep.include", { objectType: "BarGraph" }); + + // Undo/redo tile duplication + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 1); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 2); + } cy.log('Delete tile'); clueCanvas.deleteTile('bargraph'); clueCanvas.deleteTile('bargraph'); - barGraph.getTiles().should('have.length', 0); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 0); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.DELETE_TILE); + cy.get("@log").its("lastCall.args.1").should("deep.include", { objectType: "BarGraph" }); + + // Undo/redo tile deletion + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 1); + } + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 2); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 1); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getTiles(workspace).should('have.length', 0); + } }); 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'); + for (const workspace of workspaces) { + barGraph.getYAxisLabel(workspace).should('have.text', 'Counts'); + barGraph.getXAxisPulldown(workspace).should('have.text', 'Categories'); + barGraph.getYAxisTickLabel(workspace).should('not.exist'); + barGraph.getXAxisTickLabel(workspace).should('not.exist'); + barGraph.getLegendArea(workspace).should('not.exist'); + barGraph.getBar(workspace).should('not.exist'); + } // Table dataset for testing: // 4 instances of X / Y / Z @@ -103,55 +188,151 @@ context('Bar Graph Tile', function () { cy.get('select').select('Table Data 1'); cy.get('.modal-button').contains("Graph It!").click(); - barGraph.getXAxisPulldown().should('have.text', 'x'); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'x'); + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['X', 'XX']); + textMatchesList(barGraph.getYAxisTickLabel(workspace), ['0', '1', '2', '3', '4', '5']); + barGraph.getBar(workspace).should('have.length', 2); + barGraph.getDatasetLabel(workspace).should('have.text', 'Table Data 1'); + barGraph.getSortByMenuButton(workspace).should('have.text', 'None'); + barGraph.getSecondaryValueName(workspace).should('have.length', 1).and('have.text', 'x'); + } - textMatchesList(barGraph.getXAxisTickLabel(), ['X', 'XX']); - textMatchesList(barGraph.getYAxisTickLabel(), ['0', '1', '2', '3', '4', '5']); - barGraph.getBar().should('have.length', 2); - barGraph.getDatasetLabel().should('have.text', 'Table Data 1'); - barGraph.getSortByMenuButton().should('have.text', 'None'); - barGraph.getSecondaryValueName().should('have.length', 1).and('have.text', 'x'); + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.TILE_LINK); + cy.get("@log").its("lastCall.args.1").should("nested.include", { "sourceTile.type": "BarGraph", "sharedModel.type": "SharedDataSet" }); + + // Undo/redo linking + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'Categories'); + barGraph.getLegendArea(workspace).should('not.exist'); + barGraph.getBar(workspace).should('not.exist'); + } + + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getDatasetLabel(workspace).should('have.text', 'Table Data 1'); + barGraph.getXAxisPulldown(workspace).should('have.text', 'x'); + barGraph.getBar(workspace).should('have.length', 2); + } 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'); + for (const workspace of workspaces) { + barGraph.getTileContent(workspace).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'); + for (const workspace of workspaces) { + tableTile.getTableTile(workspace).should('have.length', 1); + barGraph.getTileContent(workspace).should('have.class', 'horizontal').and('not.have.class', 'vertical'); + } cy.log('Change Sort By'); + barGraph.getSortByMenuButton().should('have.text', 'None'); + + // Cannot change sort by in read-only views + for (const workspace of workspaces.slice(1)) { + barGraph.getSortByMenuButton(workspace).click(); + barGraph.getChakraMenuItem(workspace).should('have.length', 3); + barGraph.getChakraMenuItem(workspace).eq(1).should('have.text', 'y'); // menu exists + barGraph.getChakraMenuItem(workspace).should('be.disabled'); // all options disabled + barGraph.getSortByMenuButton(workspace).click(); // close menu + } + barGraph.getSortByMenuButton().click(); barGraph.getChakraMenuItem().should('have.length', 3); barGraph.getChakraMenuItem().eq(1).should('have.text', 'y').click(); - textMatchesList(barGraph.getXAxisTickLabel(), ['X', 'XX']); - textMatchesList(barGraph.getYAxisTickLabel(), ['0', '1', '2', '3', '4', '5']); - barGraph.getBar().should('have.length', 3); - barGraph.getDatasetLabel().should('have.text', 'Table Data 1'); - barGraph.getSortByMenuButton().should('have.text', 'y'); - textMatchesList(barGraph.getSecondaryValueName(), ['Y', 'YY']); + for (const workspace of workspaces) { + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['X', 'XX']); + textMatchesList(barGraph.getYAxisTickLabel(workspace), ['0', '1', '2', '3', '4', '5']); + barGraph.getBar(workspace).should('have.length', 3); + barGraph.getDatasetLabel(workspace).should('have.text', 'Table Data 1'); + barGraph.getSortByMenuButton(workspace).should('have.text', 'y'); + textMatchesList(barGraph.getSecondaryValueName(workspace), ['Y', 'YY']); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.BARGRAPH_TOOL_CHANGE); + cy.get("@log").its("lastCall.args.1").should("deep.include", { operation: "setSecondaryAttribute" }); + + // Undo-redo sort by + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getSortByMenuButton(workspace).should('have.text', 'None'); + barGraph.getBar(workspace).should('have.length', 2); + barGraph.getSecondaryValueName(workspace).should('have.text', 'x'); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getSortByMenuButton(workspace).should('have.text', 'y'); + textMatchesList(barGraph.getSecondaryValueName(workspace), ['Y', 'YY']); + barGraph.getBar(workspace).should('have.length', 3); + } cy.log('Change Category'); + + // Cannot change category in read-only views + for (const workspace of workspaces.slice(1)) { + barGraph.getXAxisPulldownButton(workspace).click(); + barGraph.getChakraMenuItem(workspace).should('have.length', 3).and('be.disabled'); + barGraph.getXAxisPulldownButton(workspace).click(); // close menu + } + barGraph.getXAxisPulldownButton().click(); barGraph.getChakraMenuItem().should('have.length', 3); barGraph.getChakraMenuItem().eq(1).should('have.text', 'y').click(); - barGraph.getXAxisPulldown().should('have.text', 'y'); - textMatchesList(barGraph.getXAxisTickLabel(), ['Y', 'YY']); - textMatchesList(barGraph.getYAxisTickLabel(), ['0', '2', '4', '6', '8', '10']); // there are 6 Ys in this view so scale expands. - barGraph.getBar().should('have.length', 2); - barGraph.getDatasetLabel().should('have.text', 'Table Data 1'); - barGraph.getSortByMenuButton().should('have.text', 'None'); - barGraph.getSecondaryValueName().should('have.length', 1).and('have.text', 'y'); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'y'); + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['Y', 'YY']); + textMatchesList(barGraph.getYAxisTickLabel(workspace), ['0', '2', '4', '6', '8', '10']); // there are 6 Ys in this view so scale expands. + barGraph.getBar(workspace).should('have.length', 2); + barGraph.getDatasetLabel(workspace).should('have.text', 'Table Data 1'); + barGraph.getSortByMenuButton(workspace).should('have.text', 'None'); + barGraph.getSecondaryValueName(workspace).should('have.length', 1).and('have.text', 'y'); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.BARGRAPH_TOOL_CHANGE); + cy.get("@log").its("lastCall.args.1").should("deep.include", { operation: "setPrimaryAttribute" }); + + // Undo-redo category change + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'x'); + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['X', 'XX']); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'y'); + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['Y', 'YY']); + } cy.log('Unlink data'); barGraph.getDatasetUnlinkButton().click(); - 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'); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'Categories'); + barGraph.getYAxisTickLabel(workspace).should('not.exist'); + barGraph.getXAxisTickLabel(workspace).should('not.exist'); + barGraph.getLegendArea(workspace).should('not.exist'); + barGraph.getBar(workspace).should('not.exist'); + } + + cy.get("@log").its("lastCall.args.0").should("equal", LogEventName.TILE_UNLINK); + cy.get("@log").its("lastCall.args.1").should("nested.include", { "sourceTile.type": "BarGraph", "sharedModel.type": "SharedDataSet" }); + + // Undo-redo unlink + clueCanvas.getUndoTool().click(); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown().should('have.text', 'y'); + textMatchesList(barGraph.getXAxisTickLabel(workspace), ['Y', 'YY']); + barGraph.getBar(workspace).should('have.length', 2); + } + clueCanvas.getRedoTool().click(); + for (const workspace of workspaces) { + barGraph.getXAxisPulldown(workspace).should('have.text', 'Categories'); + barGraph.getBar(workspace).should('not.exist'); + } }); }); diff --git a/cypress/support/elements/tile/BarGraphTile.js b/cypress/support/elements/tile/BarGraphTile.js index 5fe641923f..d19a3b1d9e 100644 --- a/cypress/support/elements/tile/BarGraphTile.js +++ b/cypress/support/elements/tile/BarGraphTile.js @@ -1,79 +1,79 @@ class BarGraphTile { getTiles(workspaceClass) { - return cy.get(`${workspaceClass || ".primary-workspace"} .canvas-area .bar-graph-tile`); + return cy.get(`${workspaceClass || ".primary-workspace"} .canvas .bar-graph-tile`); } - getTile(tileIndex = 0, workspaceClass) { - return this.getTiles().eq(tileIndex); + getTile(workspaceClass, tileIndex = 0) { + return this.getTiles(workspaceClass).eq(tileIndex); } - getTileTitle(tileIndex = 0, workspaceClass) { - return this.getTile(tileIndex, workspaceClass).find(`.editable-tile-title-text`); + getTileTitle(workspaceClass, tileIndex = 0) { + return this.getTile(workspaceClass, tileIndex).find(`.editable-tile-title-text`); } - getTileContent(tileIndex = 0, workspaceClass) { - return this.getTile(tileIndex, workspaceClass).find(`[data-testid="bar-graph-content"]`); + getTileContent(workspaceClass, tileIndex = 0) { + return this.getTile(workspaceClass, tileIndex).find(`[data-testid="bar-graph-content"]`); } - getChakraMenuItem(tileIndex = 0, workspaceClass) { + getChakraMenuItem(workspaceClass, tileIndex = 0) { return cy.get(`body .chakra-portal button`).filter(':visible'); } - getChartArea(tileIndex = 0, workspaceClass) { - return this.getTile(tileIndex, workspaceClass).find(`svg.bar-graph-svg`); + getChartArea(workspaceClass, tileIndex = 0) { + return this.getTile(workspaceClass, tileIndex).find(`svg.bar-graph-svg`); } - getYAxisLabel(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`.editable-axis-label`); + getYAxisLabel(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`.editable-axis-label`); } - getYAxisLabelButton(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`[data-testid="axis-label-button"]`); + getYAxisLabelButton(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`[data-testid="axis-label-button"]`); } - getYAxisLabelEditor(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`[data-testid="axis-label-editor"] input`); + getYAxisLabelEditor(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`[data-testid="axis-label-editor"] input`); } - getXAxisPulldown(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`[data-testid="category-pulldown"]`); + getXAxisPulldown(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`[data-testid="category-pulldown"]`); } - getXAxisPulldownButton(tileIndex = 0, workspaceClass) { - return this.getXAxisPulldown(tileIndex, workspaceClass).find(`button`); + getXAxisPulldownButton(workspaceClass, tileIndex = 0) { + return this.getXAxisPulldown(workspaceClass, tileIndex).find(`button`); } - getYAxisTickLabel(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`.visx-axis-left text`); + getYAxisTickLabel(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`.visx-axis-left text`); } - getXAxisTickLabel(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`.visx-axis-bottom text`); + getXAxisTickLabel(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`.visx-axis-bottom text`); } - getBar(tileIndex = 0, workspaceClass) { - return this.getChartArea(tileIndex, workspaceClass).find(`.visx-bar`); + getBar(workspaceClass, tileIndex = 0) { + return this.getChartArea(workspaceClass, tileIndex).find(`.visx-bar`); } - getLegendArea(tileIndex = 0, workspaceClass) { - return this.getTile(tileIndex, workspaceClass).find(`.bar-graph-legend`); + getLegendArea(workspaceClass, tileIndex = 0) { + return this.getTile(workspaceClass, tileIndex).find(`.bar-graph-legend`); } - getDatasetLabel(tileIndex = 0, workspaceClass) { - return this.getLegendArea(tileIndex, workspaceClass).find(`.dataset-header .dataset-name`); + getDatasetLabel(workspaceClass, tileIndex = 0) { + return this.getLegendArea(workspaceClass, tileIndex).find(`.dataset-header .dataset-name`); } - getDatasetUnlinkButton(tileIndex = 0, workspaceClass) { - return this.getLegendArea(tileIndex, workspaceClass).find(`.dataset-header .dataset-icon a`); + getDatasetUnlinkButton(workspaceClass, tileIndex = 0) { + return this.getLegendArea(workspaceClass, tileIndex).find(`.dataset-header .dataset-icon a`); } - getSortByMenuButton(tileIndex = 0, workspaceClass) { - return this.getLegendArea(tileIndex, workspaceClass).find(`.sort-by button.chakra-menu__menu-button`); + getSortByMenuButton(workspaceClass, tileIndex = 0) { + return this.getLegendArea(workspaceClass, tileIndex).find(`.sort-by button.chakra-menu__menu-button`); } - getSecondaryValueName(tileIndex = 0, workspaceClass) { - return this.getLegendArea(tileIndex, workspaceClass).find(`.secondary-values .secondary-value-name`); + getSecondaryValueName(workspaceClass, tileIndex = 0) { + return this.getLegendArea(workspaceClass, tileIndex).find(`.secondary-values .secondary-value-name`); } } diff --git a/cypress/support/elements/tile/TableToolTile.js b/cypress/support/elements/tile/TableToolTile.js index 5fa38207e9..68fb922ff9 100644 --- a/cypress/support/elements/tile/TableToolTile.js +++ b/cypress/support/elements/tile/TableToolTile.js @@ -4,10 +4,10 @@ function wsclass(workspaceClass) { class TableToolTile{ getTableTile(workspaceClass) { - return cy.get(`${wsclass(workspaceClass)} .canvas-area .table-tool`); + return cy.get(`${wsclass(workspaceClass)} .canvas .table-tool`); } getTableTitle(workspaceClass){ - return cy.get(`${wsclass(workspaceClass)} .canvas-area .table-title`); + return cy.get(`${wsclass(workspaceClass)} .canvas .table-title`); } getAddColumnButton(){ return cy.get('.add-column-button'); @@ -39,7 +39,7 @@ class TableToolTile{ this.getRemoveRowButton().click(); } getTableRow(){ - return cy.get('.canvas-area .rdg-row'); + return cy.get('.canvas .rdg-row'); } getColumnHeaderText(i){ return cy.get('.column-header-cell .editable-header-cell .header-name').text(); @@ -89,7 +89,7 @@ class TableToolTile{ this.getTableCell().eq(cell).type(num+'{enter}'); } getTableIndexColumnCell(){ - return cy.get('.canvas-area .rdg-cell.index-column'); + return this.getTableTile().find('.rdg-cell.index-column'); } // Fill in a table tile with the given data (a list of lists) // Table tile should in the default state (2 columns, no rows) diff --git a/src/components/doc-editor/doc-editor-app.tsx b/src/components/doc-editor/doc-editor-app.tsx index 2edc3c5f6f..0d47d2509a 100644 --- a/src/components/doc-editor/doc-editor-app.tsx +++ b/src/components/doc-editor/doc-editor-app.tsx @@ -228,13 +228,13 @@ export const DocEditorApp = observer(function DocEditorApp() { { showLocalReadOnly && <>