From 7bb785b48e34cba5885e63801c1a6996599447fb Mon Sep 17 00:00:00 2001 From: Ron Valstar Date: Fri, 28 Dec 2018 22:44:02 +0100 Subject: [PATCH] moved spec files, adjusted Cypress config, added/refined some tests --- cypress.json | 3 +- cypress/integration/pi_page_home.js | 66 ------- cypress/integration/pi_page_project.js | 171 ------------------ cypress/integration/unit/model/client.spec.js | 77 -------- cypress/plugins/index.js | 62 +++++-- cypress/support/commands.js | 108 +++++++++++ cypress/support/index.js | 20 ++ package-lock.json | 117 +++++++----- package.json | 5 +- src/components/Footer.spec.js | 26 +++ src/components/Notification.vue | 7 +- src/config/index.js | 2 +- src/model/client.spec.js | 89 +++++++++ .../unit => src}/model/config.spec.js | 4 +- src/model/index.js | 13 +- .../unit => src}/model/project.spec.js | 4 +- .../service/interpolationService.spec.js | 0 src/service/storage.js | 7 +- src/service/storageDrive.js | 6 +- src/util/signal.js | 1 + src/views/Copy.vue | 2 +- src/views/Home.spec-ee.js | 61 +++++++ src/views/Project.spec-ee.js | 168 +++++++++++++++++ src/views/Settings.spec-ee.js | 75 ++++++++ .../views/generic.spec-ee.js | 0 .../pi_pages.js => src/views/pages.spec-ee.js | 0 {cypress/integration => src/views}/pi.js | 2 +- 27 files changed, 694 insertions(+), 402 deletions(-) delete mode 100644 cypress/integration/pi_page_home.js delete mode 100644 cypress/integration/pi_page_project.js delete mode 100644 cypress/integration/unit/model/client.spec.js create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/index.js create mode 100644 src/components/Footer.spec.js create mode 100644 src/model/client.spec.js rename {cypress/integration/unit => src}/model/config.spec.js (93%) rename {cypress/integration/unit => src}/model/project.spec.js (98%) rename {cypress/integration/unit => src}/service/interpolationService.spec.js (100%) create mode 100644 src/views/Home.spec-ee.js create mode 100644 src/views/Project.spec-ee.js create mode 100644 src/views/Settings.spec-ee.js rename cypress/integration/pi_generic.js => src/views/generic.spec-ee.js (100%) rename cypress/integration/pi_pages.js => src/views/pages.spec-ee.js (100%) rename {cypress/integration => src/views}/pi.js (98%) diff --git a/cypress.json b/cypress.json index 5901f33..5983a9e 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,6 @@ { "projectId": "projectInvoice", "video": false, - "ignoreTestFiles": ["pi.js","example_spec.js"] + "ignoreTestFiles": ["components/*.spec*.js","!*.spec*.js"], + "integrationFolder": "src" } diff --git a/cypress/integration/pi_page_home.js b/cypress/integration/pi_page_home.js deleted file mode 100644 index 065311e..0000000 --- a/cypress/integration/pi_page_home.js +++ /dev/null @@ -1,66 +0,0 @@ -import { - toPage - ,basics - ,toCurrentPage - ,assertPathname - ,describeResponsive -} from './pi' - -describeResponsive('Home',()=>{ - - beforeEach(toPage) - - // context('...',()=>toPage()) - // before(toPage) - // beforeEach(toCurrentPage) - - context('Basics',basics.bind(null,'Project Invoice','',false)) - - context('Jumbotron',()=>{ - it('should have link to about',()=>{ - cy.get('.jumbotron a').contains('read more').click() - assertPathname('/about') - }) - it('should have button for closing',()=>{ - cy.get('.jumbotron').should('exist') - cy.get('.jumbotron button').contains('hide message').click() - cy.get('.jumbotron').should('not.exist') - toCurrentPage() - cy.get('.jumbotron').should('not.exist') - }) - }) - - context('Buttons',()=>{ - it('should create a new client',()=>{ - cy.get('section:first-child *').contains('new client').click() - assertPathname('/client/34') - }) - it('should create a new project for latest client',()=>{ - cy.get('section:first-child *').contains('Create project').click() - assertPathname('/client/22/2') - }) - it('should clone the latest project',()=>{ - cy.get('section:first-child *').contains('Clone project').click() - assertPathname('/client/22/2') - }) - it('should go to current quarter',()=>{ - cy.get('section:first-child *').contains('current quarter').click() - assertPathname('/overview/quarter') - }) - }) - - context('Open invoices project list',()=>{ - it('should have the correct headers',()=>{ - ['paid','date','description','totalIncDiscounted','actions'] - .forEach(id=>cy.get(`section:nth-child(2) .th-${id}`).should('exist')) - }) - }) - - context('Draft projects list',()=>{ - it('should have the correct headers',()=>{ - ['clientName','description','totalIncDiscounted','actions'] - .forEach(id=>cy.get(`section:nth-child(3) .th-${id}`).should('exist')) - }) - }) - -}) \ No newline at end of file diff --git a/cypress/integration/pi_page_project.js b/cypress/integration/pi_page_project.js deleted file mode 100644 index 783cbfe..0000000 --- a/cypress/integration/pi_page_project.js +++ /dev/null @@ -1,171 +0,0 @@ -import { - toPage - ,basics - ,getTitle - ,isDirty - ,describeResponsive - ,assertPathname -} from './pi' - -describeResponsive('Project page',()=>{ - - beforeEach(toPage.bind(null,'/client/22/1')) - - context('Basics',basics.bind(null,getTitle('Project'),'Project: Unbranded Metal Keyboard',true)) - - context('Main properties',()=>{ - - it('should navigate to project',()=>{ - cy.title().should('include','Project') - cy.get('h1').should('contain','Project: Unbranded Metal Keyboard') - }) - - it('should change name field',()=>{ - cy.get('.saveable-buttons>div>:nth-child(1)') - .should('be.disabled') - cy.get('dt').contains('description') - .find('+dd>input') - .focus() - // .type('{rightarrow}{ctrl}{shift}{leftarrow}{backspace}Arms') - //.type('{backspace}{backspace}{backspace}{backspace}{backspace}Arms') - .type('{backspace}'.repeat('Keyboard'.length) + 'Arms') - cy.get('h1') - .should('contain','Project: Unbranded Metal Arms') - cy.get('.saveable-buttons>div>:nth-child(1)') - .should('not.be.disabled') - }) - - it('should change price indication when hourly rate is set',()=>{ - isDirty(false) - cy.get('label[for=projectProperties]').click() - cy.get('dt').contains('hourly rate').find('+dd input[type=number]').focus().type('300') - cy.get('.discount > .input').should('contain','255') - isDirty(true) - }) - - it('should not change price indication when discount is set',()=>{ - isDirty(false) - cy.get('label[for=projectProperties]').click() - cy.get('dt').contains('discount').find('+dd input').focus().type('10') - cy.get('tbody > :nth-child(1) div.input.mono').should('contain','0') - isDirty(true) - }) - - it('should not change price indication when discount is set',()=>{ - isDirty(false) - cy.get('label[for=projectProperties]').click() - cy.get('dt').contains('paid').find('+dd label').click() - isDirty(true) - }) - - }) - - context('Lines',()=>{ - - it('should add lines',()=>{ - isDirty(false) - cy.get('tbody > tr').should('have.length',7) - cy.get('button').contains('add line').scrollIntoView().click() - isDirty(true) - cy.get('tbody > tr').should('have.length',8) - }) - - it('should affect hourly rate indicator when hours are changed',()=>{ - isDirty(false) - cy.get('tbody > tr').should('have.length',7) - cy.get('tbody > tr:first-child button').scrollIntoView().click() - isDirty(true) - cy.get('tbody > tr').should('have.length',6) - }) - - it('should delete lines',()=>{ - isDirty(false) - cy.get('tbody > tr').should('have.length',7) - cy.get('tbody > tr:first-child button').scrollIntoView().click() - isDirty(true) - cy.get('tbody > tr').should('have.length',6) - }) - - it('should display the correct totals',()=>{ - const totals = [] - cy.get('tbody tr') - .each(tr=>{ - const amount = parseInt(tr.find('td:nth-child(5) > input').val(), 10) - const vat = parseInt(tr.find('td:nth-child(6) > select').val(), 10) - totals.push([amount,vat]) - }) - .then(()=>cy.get('tfoot tr:first-child :nth-child(5) > .input').should('have.text', totals.map(a=>a[0]).reduce((a,b)=>a+b,0).toFixed(2))) - }) - - }) - - context('invoices',()=>{ - - const header = ()=>cy.get('.tabs').next().next() - - it('should add invoices',()=>{ - header().scrollIntoView() - header().find('li').should('have.length',4) - header().find('header>button').click() - cy.get('[type="submit"]').click() - header().find('li').should('have.length',5) - }) - - it('should not be dirty when invoices are added',()=>{ - isDirty(false) - header().scrollIntoView() - header().find('header>button').click() - cy.get('[type="submit"]').click() - isDirty(false) - }) - - it('should be dirty when date is changed',()=>{ - isDirty(false) - cy.get(':nth-child(1) > .text-align-right > button') - header().find('li:first-child button').click() - cy.get('dialog input[type=date]').focus().type('2017-05-05') - cy.get('[type="submit"]').click() - isDirty(true) - }) - - it('should be dirty when checkboxes are changed',()=>{ - isDirty(false) - cy.get(':nth-child(1) > .text-align-right > button') - header().find('li:nth-child(2) button').click() - cy.get('dialog .checkbox').click() - cy.get('[type="submit"]').click() - isDirty(true) - }) - - it('should delete invoices',()=>{ - isDirty(false) - header().scrollIntoView() - header().find('li').should('have.length',4) - header().find('li:last-child() button:first-child').click() - header().find('li').should('have.length',3) - isDirty(true) - }) - - it('should have no checkboxes on first invoice',()=>{ - header().find('li:nth-child(1) button').click() - cy.get('dialog .checkbox').should('have.length',0) - }) - - it('should have one checkbox on second invoice',()=>{ - header().find('li:nth-child(2) button').click() - cy.get('dialog .checkbox').should('have.length',1) - }) - - it('should have two checkboxes on third invoice and up',()=>{ - header().find('li:nth-child(3) button').click() - cy.get('dialog .checkbox').should('have.length',2) - }) - - it('should link to invoice print page',()=>{ - header().find('li:first-child a').click() - assertPathname('/client/22/1/invoice') - }) - - }) - -}) diff --git a/cypress/integration/unit/model/client.spec.js b/cypress/integration/unit/model/client.spec.js deleted file mode 100644 index 70c7d06..0000000 --- a/cypress/integration/unit/model/client.spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import {create} from '../../../../src/model/client' -import data from '../../../../src/data/data' - -const fixtureLsData = 'cypress/fixtures/localStorageData.json' - -describe('project',() => { - - beforeEach(() => { - cy.readFile(fixtureLsData).then(json => { - global.client = create(json.clients[0],{ - config:data.config,personal: data.personal,get projects() { - return client.projects.slice(0) - } - }) - }) - }) - - describe('create',() => { - it('should have a custom prototype',() => { - assert.notEqual(Object.getPrototypeOf(client),Object.getPrototypeOf({})) - }) - it('should not have enumerable circular references',() => { - let pass; - try { - JSON.stringify(client) - pass = true - } catch (err) { - pass = false - } - assert(pass) - }) - }) - - describe('clone',() => { - it('should clone',() => { - const duplicate = client.clone() - assert(!!duplicate) - assert.notEqual(duplicate,client) - }) - }) - - describe('uri',() => { - it('should exist',() => { - assert.equal(client.uri,'/client/1') - }) - }) - - describe('createProject',() => { - it('should',() => { - assert.equal(client.projects.length,3) - client.createProject() - assert.equal(client.projects.length,4) - }) - }) - - describe('getProject',() => { - it('should get a project by index',() => { - assert.strictEqual(client.getProject(1),client.projects[1]) - }) - }) - - describe('deleteProject',() => { - it('should be able to delete projects by instance',() => { - assert.equal(client.projects.length,3) - const project = client.getProject(1) - client.deleteProject(project) - assert.equal(client.projects.length,2) - }) - }) - - describe('toString',() => { - it('should show name',() => { - assert.equal(client.toString(),'[object client \'Jaskolski, Mertz and O\'Hara\']') - }) - }) - -}) \ No newline at end of file diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 9efb990..85efef6 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,23 +1,47 @@ -// cypress/plugins/index.js +// tests/e2e/plugins/index.js + +// webpack import const webpack = require('@cypress/webpack-preprocessor') -const webpackOptions = { - module: { - rules: [ - { - test: /\.vue$/, - loader: 'vue-loader' - } - ] - } -} -const options = { - // send in the options from your webpack.config.js, so it works the same - // as your app's code - webpackOptions, - watchOptions: {} +module.exports = (on, config) => { + on( + 'file:preprocessor', + webpack({ + webpackOptions: require('@vue/cli-service/webpack.config'), + watchOptions: {} + }) + ) + + return Object.assign({}, config, { + // fixturesFolder: 'tests/e2e/fixtures', + // integrationFolder: 'tests/e2e/specs', + // screenshotsFolder: 'tests/e2e/screenshots', + // videosFolder: 'tests/e2e/videos', + // supportFile: 'tests/e2e/support/index.js' + }) } -module.exports = on => { - on('file:preprocessor', webpack(options)) -} \ No newline at end of file + +// // cypress/plugins/index.js +// const webpack = require('@cypress/webpack-preprocessor') +// const webpackOptions = { +// module: { +// rules: [ +// { +// test: /\.vue$/, +// loader: 'vue-loader' +// } +// ] +// } +// } +// +// const options = { +// // send in the options from your webpack.config.js, so it works the same +// // as your app's code +// webpackOptions, +// watchOptions: {} +// } +// +// module.exports = on => { +// on('file:preprocessor', webpack(options)) +// } \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 0000000..012f0c2 --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,108 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add("login", (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This is will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) + +const base = 'http://localhost:8080' +const fixtureLsData = 'cypress/fixtures/localStorageData.json' +const asLive = [] + +Cypress.Commands.add('getListElements', () => cy.get('@list').find('li')) +Cypress.Commands.add('updateListElements', () => cy.get('@list').find('li').as('listElements')) + +/** + * Use regex to find alias name + * @param {string} selector + * @returns {string} + */ +function getAliasName(selector){ + return (selector.match(/^@(.*)$/)||[])[1] +} + +/** + * Remove an item from an array + * @param {array} array + * @param {object} item + * @returns {boolean} + */ +function removeFromArray(array,item){ + const index = array.indexOf(item) + const isInArray = index!==-1 + isInArray&&array.splice(index, 1) + return isInArray +} + +/** + * Return the element itself if it does not have a documentElement reference + * @param {HTMLElement} elm + * @returns {HTMLElement} + */ +function getDocumentElement(elm) { + return elm.documentElement||elm +} + +Cypress.Commands.add('updateAlias', (domAlias, options) => { + const aliasName = getAliasName(domAlias) + return aliasName&&cy.get(domAlias,{ignoreLive:true}).then($result => { + const tree = [$result] + while (tree[0].prevObject) tree.unshift(tree[0].prevObject) + return tree.reduce(((cy,o)=>cy.find(o.selector)),cy.wrap(getDocumentElement(tree.shift().get(0)))).as(aliasName) + })||cy.get(domAlias, options) +}) + +Cypress.Commands.overwrite('get', (orig, selector, options={}) => { + const {update, ignoreLive} = options + const aliasName = getAliasName(selector) + const isLive = aliasName && !ignoreLive && asLive.includes(aliasName) + return aliasName&&(update||isLive)?cy.updateAlias(selector,options):orig(selector, options) +}) + +Cypress.Commands.overwrite('as', (orig, value, name, options={}) => { + options&&options.live&&!asLive.includes(name)&&asLive.push(name)||options&&options.live===false&&removeFromArray(asLive,name) + return orig(value, name) +}) + +Cypress.Commands.add('path',pathname => cy + .location().should(location => expect(location.pathname).to.eq(pathname)) +) + +Cypress.Commands.add('visitPage',(path = '', options={}) => cy.readFile(fixtureLsData).then(json => cy + .wrap(base + path).as('currentPage').then(url => cy + .visit(url,Object.assign({},options,{ + onBeforeLoad: win => { + win.localStorage.setItem('data',JSON.stringify(json)) + // console.log('aaaaaaaaaaaaaaaaaaaaaaarfgh',!!options.onBeforeLoad) + options.onBeforeLoad&&options.onBeforeLoad(win) + } + })) + ) +)) + +Cypress.Commands.add('toCurrentPage',() => cy + .get('@currentPage').then(cy.visit) +) + +Cypress.Commands.add('isDirty',is => cy + .get('.saveable-buttons>div>:nth-child(1)').should(is?'not.be.disabled':'be.disabled') +) diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 0000000..d68db96 --- /dev/null +++ b/cypress/support/index.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/package-lock.json b/package-lock.json index 1ceab34..ddc6a02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ProjectInvoice", - "version": "2.3.26", + "version": "2.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -813,7 +813,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -845,7 +845,7 @@ }, "onetime": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, @@ -861,7 +861,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -932,6 +932,12 @@ "postcss": "^7.0.0" } }, + "@kazupon/vue-i18n-loader": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@kazupon/vue-i18n-loader/-/vue-i18n-loader-0.3.0.tgz", + "integrity": "sha512-M2280E9PMxetu6mOdtyh1d6Dif7LwH4gvxD2dgsu7HOyzR26AUNok8DxZ1Y5YAexJvPfbBXC75Llui2myO05Hg==", + "dev": true + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -977,9 +983,9 @@ } }, "@types/jquery": { - "version": "3.2.16", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.2.16.tgz", - "integrity": "sha512-q2WC02YxQoX2nY1HRKlYGHpGP1saPmD7GN0pwCDlTz35a4eOtJG+aHRlXyjCuXokUukSrR2aXyBhSW3j+jPc0A==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.6.tgz", + "integrity": "sha512-403D4wN95Mtzt2EoQHARf5oe/jEPhzBOBNrunk+ydQGW8WmkQ/E8rViRAEB1qEt/vssfGfNVD6ujP4FVeegrLg==", "dev": true }, "@types/lodash": { @@ -1527,7 +1533,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -3398,7 +3404,7 @@ }, "babel-plugin-syntax-jsx": { "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=", "dev": true }, @@ -4281,7 +4287,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -4326,7 +4332,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -4696,9 +4702,9 @@ } }, "ci-info": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.5.1.tgz", - "integrity": "sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", "dev": true }, "cipher-base": { @@ -4883,10 +4889,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } + "dev": true } } }, @@ -5885,9 +5888,9 @@ "dev": true }, "cypress": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-3.1.0.tgz", - "integrity": "sha512-UqLbXgHvM8Y6Y+roHrepZMWcyMN5u4KcjpTbJTZi0d5O2Prvtqmnpoky7a4C65q4oRQXeSc6cBZUhxJkhU4pbQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-3.1.3.tgz", + "integrity": "sha512-ZusTQffKBVrLDvcxEinymTH0iCUL7hM1m6q9X+557wDtpd6S4et330QQE1IW10Pnyp+vYIHpkWxDm43B9G14nA==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "0.4.1", @@ -5896,7 +5899,7 @@ "@types/bluebird": "3.5.18", "@types/chai": "4.0.8", "@types/chai-jquery": "1.1.35", - "@types/jquery": "3.2.16", + "@types/jquery": "3.3.6", "@types/lodash": "4.14.87", "@types/minimatch": "3.0.3", "@types/mocha": "2.2.44", @@ -5922,7 +5925,7 @@ "lodash": "4.17.10", "log-symbols": "2.2.0", "minimist": "1.2.0", - "progress": "1.1.8", + "moment": "2.22.2", "ramda": "0.24.1", "request": "2.87.0", "request-progress": "0.3.1", @@ -5994,20 +5997,20 @@ "dev": true }, "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" }, "dependencies": { "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "dev": true, "requires": { "delayed-stream": "~1.0.0" @@ -6044,7 +6047,7 @@ }, "is-ci": { "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", + "resolved": "http://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", "integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", "dev": true, "requires": { @@ -6059,14 +6062,14 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=", "dev": true }, "request": { @@ -6134,6 +6137,28 @@ } } }, + "cypress-vue-unit-test": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/cypress-vue-unit-test/-/cypress-vue-unit-test-1.11.0.tgz", + "integrity": "sha512-siCNZPS9sKXrbPvjVbRsEZBRe8uTS3h57x7ajsgZgs8C2TzknO5YFRjFR2KVYuU+SMU60QOqkxXtOR85kwQ+yg==", + "dev": true, + "requires": { + "@cypress/webpack-preprocessor": "2.0.1", + "@kazupon/vue-i18n-loader": "0.3.0", + "common-tags": "1.7.2" + }, + "dependencies": { + "common-tags": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.7.2.tgz", + "integrity": "sha512-joj9ZlUOjCrwdbmiLqafeUSgkUM74NqhLsZtSqDmhKudaIY197zTrb8JMl31fMnCUuxwFT23eC/oWvrZzDLRJQ==", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0" + } + } + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -6441,7 +6466,7 @@ }, "dom-converter": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.1.4.tgz", + "resolved": "http://registry.npmjs.org/dom-converter/-/dom-converter-0.1.4.tgz", "integrity": "sha1-pF71cnuJDJv/5tfIduexnLDhfzs=", "dev": true, "requires": { @@ -7023,7 +7048,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -7950,7 +7975,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -9265,7 +9290,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -11166,7 +11191,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -11213,13 +11238,13 @@ }, "onetime": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, "ora": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/ora/-/ora-0.2.3.tgz", + "resolved": "http://registry.npmjs.org/ora/-/ora-0.2.3.tgz", "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", "dev": true, "requires": { @@ -11241,7 +11266,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -11286,7 +11311,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -11324,7 +11349,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { diff --git a/package.json b/package.json index b9371ce..4a65b4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ProjectInvoice", - "version": "2.4.1", + "version": "2.4.2", "private": true, "scripts": { "serve": "npm run i18n & vue-cli-service serve", @@ -53,7 +53,8 @@ "body-parser": "^1.18.2", "commander": "^2.14.1", "crypto-js": "^3.1.9-1", - "cypress": "^3.1.0", + "cypress": "^3.1.3", + "cypress-vue-unit-test": "^1.11.0", "eslint-plugin-html": "^4.0.2", "express": "^4.16.3", "faker": "^4.1.0", diff --git a/src/components/Footer.spec.js b/src/components/Footer.spec.js new file mode 100644 index 0000000..e25509b --- /dev/null +++ b/src/components/Footer.spec.js @@ -0,0 +1,26 @@ +// const mountVue = require('cypress-vue-unit-test') +// +// describe('My Vue', () => { +// beforeEach(mountVue(/* my Vue code */, /* options */)) +// it('renders', () => { +// // Any Cypress command +// // Cypress.vue is the mounted component reference +// }) +// }) + +import Footer from './Footer.vue' +const mountVue = require('cypress-vue-unit-test') + +describe('Footer', () => { + const template = `
+
+
` + const components = { Footer, footer:Footer } + beforeEach(mountVue({ template, components })) + + describe('create',() => { + it('should parse', () => { + cy.get('div').should('contain', '123') + }) + }) +}) \ No newline at end of file diff --git a/src/components/Notification.vue b/src/components/Notification.vue index 31328cf..27aa7cf 100644 --- a/src/components/Notification.vue +++ b/src/components/Notification.vue @@ -21,13 +21,14 @@