From fd9d1b550c2f93388f6d1a12c57ca731a246f6b5 Mon Sep 17 00:00:00 2001 From: Sander Hautvast Date: Thu, 18 Feb 2021 21:08:19 +0100 Subject: [PATCH] updated cypress version and the test --- cypress/integration/console.spec.js | 10 ++++++++-- cypress/plugins/index.js | 7 +++++++ cypress/support/index.js | 2 ++ package-lock.json | 30 +++++++++++++++++++++++++---- package.json | 4 ++-- src/js/index.js | 2 -- 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 cypress/plugins/index.js create mode 100644 cypress/support/index.js diff --git a/cypress/integration/console.spec.js b/cypress/integration/console.spec.js index 180e270..3fa6b3a 100644 --- a/cypress/integration/console.spec.js +++ b/cypress/integration/console.spec.js @@ -2,9 +2,15 @@ describe('draw a vector', () => { it('adds the svg vector', () => { cy.visit('http://localhost:8080'); - cy.get('#command_input').type("a = vector(0,0,1,1){enter}"); - cy.get('#0').invoke('attr','d').should('eq','M550 350 L650 250'); + cy.get('#command_input').type("a = vector(0,0,0.5,0.5){enter}"); + cy.get('#0').invoke('attr','d').should('eq','M550 350 L600 300'); cy.get('#0').invoke('attr','class').should('eq','vector'); cy.get('#0').invoke('attr','marker-end').should('eq','url(#arrow)'); + + cy.get('#command_input').type("b = vector(0,0,-1,1){enter}"); + cy.get('#1').invoke('attr','d').should('eq','M550 350 L450 250'); + + cy.get('#command_input').type("c = a + b{enter}"); + cy.get('#2').invoke('attr','d').should('eq','M550 350 L500 200'); }) }) diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js new file mode 100644 index 0000000..5bfdbc4 --- /dev/null +++ b/cypress/plugins/index.js @@ -0,0 +1,7 @@ +/** + * @type {Cypress.PluginConfig} + */ +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config +} diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 0000000..eab9d66 --- /dev/null +++ b/cypress/support/index.js @@ -0,0 +1,2 @@ +// import './commands' + diff --git a/package-lock.json b/package-lock.json index e095584..2a86706 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1507,14 +1507,15 @@ "dev": true }, "cypress": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.4.0.tgz", - "integrity": "sha512-SrsPsZ4IBterudkoFYBvkQmXOVxclh1/+ytbzpV8AH/D2FA+s2Qy5ISsaRzOFsbQa4KZWoi3AKwREmF1HucYkg==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.5.0.tgz", + "integrity": "sha512-ol/yTAqHrQQpYBjxLlRSvZf4DOb9AhaQNVlwdOZgJcBHZOOa52/p/6/p3PPcvzjWGOMG6Yq0z4G+jrbWyk/9Dg==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "^0.4.1", "@cypress/request": "^2.88.5", "@cypress/xvfb": "^1.2.4", + "@types/node": "12.12.50", "@types/sinonjs__fake-timers": "^6.0.1", "@types/sizzle": "^2.3.2", "arch": "^2.1.2", @@ -1527,7 +1528,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.9.3", - "debug": "^4.1.1", + "debug": "4.3.2", "eventemitter2": "^6.4.2", "execa": "^4.0.2", "executable": "^4.1.1", @@ -1553,12 +1554,27 @@ "yauzl": "^2.10.0" }, "dependencies": { + "@types/node": { + "version": "12.12.50", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.50.tgz", + "integrity": "sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==", + "dev": true + }, "commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "dev": true }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "execa": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", @@ -1613,6 +1629,12 @@ "universalify": "^2.0.0" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/package.json b/package.json index a21247b..a72e8b3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "MatRepl is a Matrix * and a REPL. The Print part does operations on vectors and matrices in a visual environment.", "main": "src/js/index.js", "scripts": { - "test": "jest --config=jest.config.js", + "test": "cypress open", "build": "webpack build", "watch": "webpack --watch", "start": "webpack serve --open --host 0.0.0.0 --port 8080" @@ -21,7 +21,7 @@ "homepage": "https://github.com/shautvast/matrepl#readme", "devDependencies": { "css-loader": "^5.0.2", - "cypress": "^6.4.0", + "cypress": "^6.5.0", "eslint": "^7.20.0", "eslint-loader": "^4.0.2", "eslint-plugin-cypress": "^2.11.2", diff --git a/src/js/index.js b/src/js/index.js index 7ae7091..782ad84 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,5 +1,3 @@ -import './scanner.js'; -import './parser.js'; import {update_lazy_objects} from "./console"; /**