Skip to content

Commit

Permalink
feat: add cypress-real-events library and update related tests for im…
Browse files Browse the repository at this point in the history
…proved event handling
  • Loading branch information
tnrich committed Dec 3, 2024
1 parent b1f2972 commit 7c7158b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"chance": "^1.1.11",
"concurrently": "^8.2.2",
"cypress": "^13.14.1",
"cypress-real-events": "^1.13.0",
"cypress-vite": "^1.4.0",
"esbuild": "^0.21.3",
"eslint": "~8.53.0",
Expand Down
1 change: 1 addition & 0 deletions packages/ove/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "cypress-real-events";
import { isString } from "lodash-es";
import toRegexRange from "to-regex-range";
import insertSequenceDataAtPositionOrRange from "@teselagen/sequence-utils/src/insertSequenceDataAtPositionOrRange";
Expand Down
1 change: 1 addition & 0 deletions packages/ove/src/AutoAnnotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ FRT GAAGTTCCTATTCTCTAGAAAGTATAGGAACTTC misc_recomb orchid pink 0 0`,
<div>
<DataTable
isInfinite
formName={"customAnnsTable"}
schema={
annotationType === "feature"
? customAnnsSchema
Expand Down
14 changes: 6 additions & 8 deletions packages/ui/cypress/e2e/EditableCellTable.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from "path";
import os from "os";

describe("EditableCellTable.spec", () => {
it(`cell checkboxes and the header checkbox should work`, () => {
Expand Down Expand Up @@ -241,20 +240,19 @@ describe("EditableCellTable.spec", () => {
);
});
it(`undo/redo should work`, () => {
const IS_LINUX = os.platform().toLowerCase().search("linux") > -1;
const undoCmd = IS_LINUX ? `{alt}z` : "{meta}z";
const redoCmd = IS_LINUX ? `{alt}{shift}z` : "{meta}{shift}z";
const undoCmd = [`Meta`, `z`];
const redoCmd = [`Meta`, `Shift`, `z`];
cy.visit("#/DataTable%20-%20EditableCellTable");
cy.get(`.rt-td:contains(tom88)`).dblclick();
cy.focused().type("{selectall}tasty55{enter}");
cy.get(`.rt-td:contains(tasty55)`).dblclick();
cy.focused().type("{selectall}delishhh{enter}");
cy.get(`.rt-td:contains(delishhh)`);
cy.focused().type(undoCmd);
cy.focused().type(undoCmd);
cy.realPress(undoCmd);
cy.realPress(undoCmd);
cy.get(`.rt-td:contains(tom88)`);
cy.focused().type(redoCmd);
cy.focused().type(redoCmd);
cy.realPress(redoCmd);
cy.realPress(redoCmd);
cy.get(`.rt-td:contains(delishhh)`);
});
it(`deleting should work, default val should get reapplied`, () => {
Expand Down
1 change: 1 addition & 0 deletions packages/ui/cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
// cypress/support/index.js
import "cypress-real-events";
const { isString } = require("lodash-es");

Cypress.Commands.add("tgToggle", (type, onOrOff = true) => {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5817,6 +5817,11 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==

cypress-real-events@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.13.0.tgz#6b7cd32dcac172db1493608f97a2576c7d0bd5af"
integrity sha512-LoejtK+dyZ1jaT8wGT5oASTPfsNV8/ClRp99ruN60oPj8cBJYod80iJDyNwfPAu4GCxTXOhhAv9FO65Hpwt6Hg==

cypress-vite@^1.4.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/cypress-vite/-/cypress-vite-1.5.0.tgz#471ecc1175c7ab51b3b132c595dc3c7e222fe944"
Expand Down

0 comments on commit 7c7158b

Please sign in to comment.