From 52d4dba950a7c38fa9799397a4019b170160a2f6 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 11 Mar 2022 17:28:30 +0100 Subject: [PATCH] e2e and unt test runners working --- package.json | 11 ++++------- test/cypress/integration/home.spec.js | 2 +- test/cypress/plugins/index.js | 6 +++--- .../__tests__/{MyButton.spec.ts => MyButton.spec.js} | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) rename test/jest/__tests__/{MyButton.spec.ts => MyButton.spec.js} (94%) diff --git a/package.json b/package.json index f322eba42..0e37483d6 100644 --- a/package.json +++ b/package.json @@ -9,15 +9,12 @@ "lint": "eslint --ext .js,.ts,.vue ./", "format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore", "test": "echo \"See package.json => scripts for available tests.\" && exit 0", - "test:unit": "cypress open-ct", - "test:unit:ci": "cypress run-ct", "test:unit:coverage": "jest --coverage", - "test:unit:watch": "jest --watch", - "test:unit:watchAll": "jest --watchAll", + "test:unit": "jest --watchAll", + "test:e2e": "cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress open --config-file cypress.json\"", + "test:e2e:ci": "cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress run\"", "serve:test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788", - "concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\"", - "test:e2e": "cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress open\"", - "test:e2e:ci": "cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress run\"" + "concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\"" }, "dependencies": { "@quasar/extras": "^1.0.0", diff --git a/test/cypress/integration/home.spec.js b/test/cypress/integration/home.spec.js index a381a94b0..18cdf982d 100755 --- a/test/cypress/integration/home.spec.js +++ b/test/cypress/integration/home.spec.js @@ -10,7 +10,7 @@ describe('Landing', () => { cy.visit('/'); }); it('.should() - assert that is correct', () => { - cy.title().should('include', 'Quasar'); + cy.title().should('include', 'Salix'); }); }); diff --git a/test/cypress/plugins/index.js b/test/cypress/plugins/index.js index 60d26607b..cff29ee8d 100644 --- a/test/cypress/plugins/index.js +++ b/test/cypress/plugins/index.js @@ -25,9 +25,9 @@ const { module.exports = async (on, config) => { // Enable component testing, you can safely remove this // if you don't plan to use Cypress for unit tests - if (config.testingType === 'component') { - await injectDevServer(on, config); - } + // if (config.testingType === 'component') { + // await injectDevServer(on, config); + // } return config; }; diff --git a/test/jest/__tests__/MyButton.spec.ts b/test/jest/__tests__/MyButton.spec.js similarity index 94% rename from test/jest/__tests__/MyButton.spec.ts rename to test/jest/__tests__/MyButton.spec.js index bd8c0dcbf..fce8791de 100644 --- a/test/jest/__tests__/MyButton.spec.ts +++ b/test/jest/__tests__/MyButton.spec.js @@ -19,7 +19,7 @@ describe('MyButton', () => { const wrapper = mount(MyButton); const { vm } = wrapper; - expect((vm.$el as HTMLElement).textContent).toContain('rocket muffin'); + expect((vm.$el).textContent).toContain('rocket muffin'); expect(wrapper.find('.content').text()).toContain('rocket muffin'); });