jsketcher/test/cypress/support/commands.js
2020-05-19 01:48:19 -07:00

38 lines
988 B
JavaScript

import modellerUISubject from "../../coreTests/subjects/modellerTPI";
Cypress.Commands.add("openModeller", () => {
return cy.visit("http://localhost:3000?test&LOG.PICK=true");;
});
Cypress.Commands.add("getActionButton", (actionId) => {
return cy.get(`[data-action-id='${actionId}']`);
});
Cypress.Commands.add("getActiveWizardField", (fieldName) => {
return cy.get(`.wizard [data-field-name='${fieldName}']`);
});
Cypress.Commands.add("selectRaycasting", (from, to) => {
return cy.window().then(win => {
win.__CAD_APP.services.pickControl.simulatePickFromRay(from, to);
win.__DEBUG__.AddSegment3(from, to);
});
});
Cypress.Commands.add("openSketcher", () => {
return cy.getModellerTPI().then(tpi => tpi.openSketcher());
});
Cypress.Commands.add("commitSketch", () => {
return cy.getModellerTPI().then(tpi => tpi.commitSketch());
});
Cypress.Commands.add("getModellerTPI", () => {
return cy.window().then(win => modellerUISubject(win.__CAD_APP));
});