Skip to content

Commit

Permalink
Merge pull request #2317 from concord-consortium/geometry-update
Browse files Browse the repository at this point in the history
Geometry update
  • Loading branch information
bgoldowsky authored Jul 10, 2024
2 parents 9441489 + 047680f commit 70de892
Show file tree
Hide file tree
Showing 106 changed files with 3,812 additions and 2,358 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ on:
- functional/tile_tests/drawing_tool_spec.js
- functional/tile_tests/duplicate_tile_spec.js
- functional/tile_tests/expression_tool_spec.js
- functional/tile_tests/graph_table_integraton_test_spec.js
- functional/tile_tests/graph_tool_spec.js
- functional/tile_tests/geometry_tool_spec.js
- functional/tile_tests/geometry_table_integraton_test_spec.js
- functional/tile_tests/image_tool_spec.js
- functional/tile_tests/numberline_tool_spec.js
- functional/tile_tests/shared_dataset_spec.js
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/functional/document_tests/canvas_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ context('Test Canvas', function () {
geometryToolTile.getGeometryTile().should('exist');
// clueCanvas.exportTileAndDocument('geometry-tool-tile');
// in case we created a point while exporting
cy.get('.primary-workspace .geometry-toolbar .button.delete').click({ force: true });
// cy.get('.primary-workspace .geometry-toolbar .button.delete').click({ force: true });

cy.log('adds an image tool');
clueCanvas.addTile('image');
Expand Down Expand Up @@ -290,7 +290,6 @@ context('Test Canvas', function () {
clueCanvas.deleteTile('draw');
clueCanvas.deleteTile('table');
clueCanvas.deleteTile('text');
clueCanvas.deleteTile('text');
textToolTile.getTextTile().should('not.exist');
geometryToolTile.getGeometryTile().should('not.exist');
drawToolTile.getDrawTile().should('not.exist');
Expand Down
11 changes: 5 additions & 6 deletions cypress/e2e/functional/document_tests/copy_doc_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ context('Copy Document', () => {

cy.log('Add geometry tile');
clueCanvas.addTile('geometry');
cy.get('.spacer').click();
textTile.deleteTextTile();
geometryTile.getGeometryTile().last().click();
geometryTile.addPointToGraph(5, 5);
geometryTile.addPointToGraph(10, 5);
geometryTile.addPointToGraph(10, 10);
geometryTile.getGraphPoint().should('have.length', 3);
clueCanvas.clickToolbarButton('geometry', 'point');
geometryTile.clickGraphPosition(5, 5);
geometryTile.clickGraphPosition(10, 5);
geometryTile.clickGraphPosition(10, 10);
geometryTile.getGraphPoint().should('have.length', 4);

cy.log('Add drawing tile');
clueCanvas.addTile("drawing");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ function setupTest(studentIndex) {
});
clueCanvas.addTile('geometry');
cy.get('.spacer').click();
textToolTile.deleteTextTile();
geometryToolTile.getGeometryTile().last().click();
geometryToolTile.addPointToGraph(5, 5);
geometryToolTile.addPointToGraph(10, 5);
geometryToolTile.addPointToGraph(10, 10);
geometryToolTile.getGraphPoint().should('have.length', 3);
clueCanvas.clickToolbarButton('geometry', 'point');
geometryToolTile.clickGraphPosition(5, 5);
geometryToolTile.clickGraphPosition(10, 5);
geometryToolTile.clickGraphPosition(10, 10);
geometryToolTile.getGraphPoint().should('have.length', 4); // including phantom point
clueCanvas.addTile("drawing");
drawToolTile.getDrawToolRectangle().click();
drawToolTile.getDrawTile()
Expand Down
12 changes: 5 additions & 7 deletions cypress/e2e/functional/document_tests/tiles_copy_test_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ClueCanvas from '../../../support/elements/common/cCanvas';
import TextToolTile from '../../../support/elements/tile/TextToolTile';
import Canvas from '../../../support/elements/common/Canvas';
import TableToolTile from '../../../support/elements/tile/TableToolTile';
import GeometryToolTile from '../../../support/elements/tile/GeometryToolTile';
Expand All @@ -16,7 +15,6 @@ const student5 = `${Cypress.config("qaUnitStudent5")}`;
const student6 = `${Cypress.config("qaUnitStudent6")}`;

let clueCanvas = new ClueCanvas,
textToolTile = new TextToolTile,
tableToolTile = new TableToolTile,
geometryToolTile = new GeometryToolTile,
drawToolTile = new DrawToolTile,
Expand Down Expand Up @@ -146,12 +144,12 @@ context('Test copy tiles from one document to other document', function () {
cy.log('Add graph tile');
clueCanvas.addTile('geometry');
cy.get('.spacer').click();
textToolTile.deleteTextTile();
geometryToolTile.getGeometryTile().last().click();
geometryToolTile.addPointToGraph(5, 5);
geometryToolTile.addPointToGraph(10, 5);
geometryToolTile.addPointToGraph(10, 10);
geometryToolTile.getGraphPoint().should('have.length', 3);
clueCanvas.clickToolbarButton('geometry', 'point');
geometryToolTile.clickGraphPosition(5, 5);
geometryToolTile.clickGraphPosition(10, 5);
geometryToolTile.clickGraphPosition(10, 10);
geometryToolTile.getGraphPoint().should('have.length', 4);

cy.log('Add drawing tile');
clueCanvas.addTile("drawing");
Expand Down
25 changes: 15 additions & 10 deletions cypress/e2e/functional/tile_tests/arrow_annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,23 @@ context('Arrow Annotations (Sparrows)', function () {
aa.getAnnotationArrows().should("have.length", 4);
});

it("can add arrows to geometry tiles", () => {
it("can add arrows to geometry tiles", { scrollBehavior: 'nearest'}, () => {
beforeTest(queryParams);
clueCanvas.addTile("geometry");

cy.log("Annotation buttons appear for points, polygons, and segments");
clueCanvas.clickToolbarButton('geometry', 'polygon');
aa.clickArrowToolbarButton(); // sparrow mode on
aa.getAnnotationLayer().should("have.class", "editing");
aa.getAnnotationButtons().should("not.exist");

aa.clickArrowToolbarButton(); // sparrow mode off
// For some reason adding the first point is ignored, so we add four but get three to make a triangle
geometryToolTile.addPointToGraph(5, 5);
geometryToolTile.addPointToGraph(10, 5);
geometryToolTile.addPointToGraph(15, 10);
geometryToolTile.addPointToGraph(20, 5);
geometryToolTile.getGraphPoint().last().dblclick({ force: true });
geometryToolTile.getGeometryTile().click(); // select tile
geometryToolTile.clickGraphPosition(10, 5);
geometryToolTile.clickGraphPosition(15, 10);
geometryToolTile.clickGraphPosition(20, 5);
geometryToolTile.clickGraphPosition(10, 5); // close polygon

aa.clickArrowToolbarButton(); // sparrow mode on
// 3 points + 3 segments + 1 polygon = 7
aa.getAnnotationButtons().should("have.length", 7);
Expand All @@ -261,14 +263,17 @@ context('Arrow Annotations (Sparrows)', function () {
aa.getAnnotationButtons().eq(6).click();
aa.getAnnotationArrows().should("have.length", 1);
aa.getAnnotationDeleteButtons().eq(0).click();

// Remove all the points and polygons
aa.clickArrowToolbarButton(); // sparrow mode off
geometryToolTile.getGeometryTile().click(); // select tile
clueCanvas.clickToolbarButton('geometry', 'select'); // switch to select mode
geometryToolTile.getGraphPoint().eq(2).click();
geometryToolTile.deleteGraphElement();
clueCanvas.clickToolbarButton('geometry', 'delete');
geometryToolTile.getGraphPoint().eq(1).click();
geometryToolTile.deleteGraphElement();
clueCanvas.clickToolbarButton('geometry', 'delete');
geometryToolTile.getGraphPoint().eq(0).click();
geometryToolTile.deleteGraphElement();
clueCanvas.clickToolbarButton('geometry', 'delete');
aa.getAnnotationButtons().should("have.length", 0);
aa.getAnnotationArrows().should("have.length", 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import Canvas from '../../../support/elements/common/Canvas';
import ClueCanvas from '../../../support/elements/common/cCanvas';
import GeometryToolTile from '../../../support/elements/tile/GeometryToolTile';
import TableToolTile from '../../../support/elements/tile/TableToolTile';
import TextToolTile from '../../../support/elements/tile/TextToolTile';

let resourcesPanel = new ResourcesPanel;
const canvas = new Canvas;
const clueCanvas = new ClueCanvas;
const geometryToolTile = new GeometryToolTile;
const tableToolTile = new TableToolTile;
const textToolTile = new TextToolTile;

const x = ['3', '7', '6', '0'];
const y = ['2.5', '5', '1', '0'];
Expand Down Expand Up @@ -40,7 +38,6 @@ context('Geometry Table Integration', function () {
tableToolTile.getTableCell().eq(17).click();
});
clueCanvas.addTile('geometry');
textToolTile.deleteTextTile();

cy.log('verify correct geometry tile names appear in selection list');
tableToolTile.getTableTile().click();
Expand All @@ -61,13 +58,12 @@ context('Geometry Table Integration', function () {
geometryToolTile.getGeometryTile().siblings(clueCanvas.linkIconEl()).children('svg').attribute('data-indicator-width').should('exist');
geometryToolTile.getGraph().should('have.class', 'is-linked');

cy.log('verify points added has label in table and geometry');
cy.log('verify points added not labeled by default');
tableToolTile.getIndexNumberToggle().should('exist').click({ force: true });
tableToolTile.getTableIndexColumnCell().first().should('contain', '1');
geometryToolTile.getGraphPointLabel().contains('A').should('exist');
geometryToolTile.getGraphPointLabel().contains('B').should('exist');
geometryToolTile.getGraphPointLabel().contains('C').should('exist');
geometryToolTile.getGraphPointLabel().contains('D').should('exist');
geometryToolTile.getGeometryTile().click();
geometryToolTile.getGraphPointLabel().should('have.length', 2); // just x and y labels
geometryToolTile.getGraphPointLabel().contains('A').should('not.exist');

cy.log('verify table can be linked to two geometry tiles');
clueCanvas.addTile('geometry');
Expand All @@ -80,7 +76,7 @@ context('Geometry Table Integration', function () {
geometryToolTile.getGraph().last().should('not.have.class', 'is-linked');

cy.log('verify point no longer has p1 in table and geometry');
geometryToolTile.getGraphPointLabel().contains('A').should('have.length', 1);
geometryToolTile.getGraphPointLabel().contains('A').should('not.exist');

clueCanvas.deleteTile('geometry');
});
Expand Down Expand Up @@ -152,10 +148,10 @@ context('Geometry Table Integration', function () {
cy.log('normal geometry interactions');
cy.log('will add a polygon directly onto the geometry');
geometryToolTile.getGeometryTile().click();
geometryToolTile.addPointToGraph(10, 10); //not sure why this isn't appearing
geometryToolTile.addPointToGraph(10, 10);
geometryToolTile.addPointToGraph(15, 10);
geometryToolTile.addPointToGraph(10, 5);
geometryToolTile.clickGraphPosition(10, 10); //not sure why this isn't appearing
geometryToolTile.clickGraphPosition(10, 10);
geometryToolTile.clickGraphPosition(15, 10);
geometryToolTile.clickGraphPosition(10, 5);
geometryToolTile.getGraphPoint().last().click({ force: true }).click({ force: true });

cy.log('will add an angle to a point created from a table');
Expand Down Expand Up @@ -186,7 +182,6 @@ context('Geometry Table Integration', function () {
tableToolTile.getTableCell().eq(9).click();
});
clueCanvas.addTile('geometry');
textToolTile.deleteTextTile();
cy.linkTableToTile('Table Data 1', "Shapes Graph 1");

// Open the document on the left, then create a new document on the right
Expand Down
Loading

0 comments on commit 70de892

Please sign in to comment.