test(vue): run vue e2e and unit tests on ci (#23113)

This commit is contained in:
Liam DeBeasi
2021-03-29 13:37:37 -04:00
committed by GitHub
parent 4bbbf89f43
commit eacd8f6d27
4 changed files with 24132 additions and 1571 deletions

View File

@@ -1,30 +1,32 @@
version: 2.1
orbs:
cypress: cypress-io/cypress@1.27.0
aliases:
- &restore-cache
keys:
- dependency-cache-{{ checksum "package.json" }}-3
- dependency-cache-{{ checksum "package.json" }}-7
- &save-cache
key: dependency-cache-{{ checksum "package.json" }}-3
key: dependency-cache-{{ checksum "package.json" }}-7
paths:
- node_modules
- &restore-cache-core
keys:
- dependency-cache-{{ checksum "core/package.json" }}-3
- dependency-cache-{{ checksum "core/package.json" }}-7
- &save-cache-core
key: dependency-cache-{{ checksum "core/package.json" }}-3
key: dependency-cache-{{ checksum "core/package.json" }}-7
paths:
- core/node_modules
- &restore-cache-core-stencil
keys:
- stencil-cache-2
- stencil-cache-6
- &save-cache-core-stencil
key: stencil-cache-2
key: stencil-cache-6
paths:
- core/.stencil
- core/screenshot/images
@@ -64,7 +66,7 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- node_modules
build-core:
<<: *defaults
@@ -85,7 +87,12 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- core/node_modules
- core/dist
- core/components
- core/css
- core/hydrate
- core/loader
build-angular:
<<: *defaults
@@ -108,7 +115,8 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- angular/node_modules
- angular/dist
build-angular-server:
<<: *defaults
@@ -125,7 +133,7 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- packages/angular-server/dist
build-react:
<<: *defaults
@@ -148,7 +156,10 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- packages/react/node_modules
- packages/react/dist
- packages/react/css
build-react-router:
<<: *defaults
steps:
@@ -176,7 +187,8 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- packages/react-router/node_modules
- packages/react-router/dist
build-vue:
<<: *defaults
@@ -199,7 +211,9 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- packages/vue/node_modules
- packages/vue/dist
- packages/vue/css
build-vue-router:
<<: *defaults
@@ -222,7 +236,7 @@ jobs:
- persist_to_workspace:
root: /tmp/workspace
paths:
- "*"
- packages/vue-router/dist
test-core-clean-build:
<<: *defaults
@@ -420,6 +434,46 @@ jobs:
command: npm run test -- --protractor-config=e2e/protractor-ci.conf.js
working_directory: /tmp/workspace/angular/test/test-app
install-vue-test-app:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
command: CYPRESS_CACHE_FOLDER=/tmp/workspace/packages/vue/test-app npm install
working_directory: /tmp/workspace/packages/vue/test-app
- persist_to_workspace:
root: /tmp/workspace
paths:
- packages/vue/test-app
test-vue-spec:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
command: npm run sync
working_directory: /tmp/workspace/packages/vue/test-app
- run:
command: npm run test:unit
working_directory: /tmp/workspace/packages/vue/test-app
test-vue-e2e:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
command: npm run sync
working_directory: /tmp/workspace/packages/vue/test-app
- run:
command: CYPRESS_CACHE_FOLDER=/tmp/workspace/packages/vue/test-app npm run test:e2e
working_directory: /tmp/workspace/packages/vue/test-app
workflows:
version: 2
build:
@@ -471,13 +525,19 @@ workflows:
- build-vue:
requires: [build-core]
- build-vue-router:
requires: [build-core, build-vue]
requires: [build-vue]
- test-vue-lint:
requires: [build-vue]
- test-vue-router-lint:
requires: [build-vue-router]
- test-vue-router-spec:
requires: [build-vue-router]
- install-vue-test-app:
requires: [build-core]
- test-vue-spec:
requires: [install-vue-test-app, build-vue, build-vue-router]
- test-vue-e2e:
requires: [install-vue-test-app, build-vue, build-vue-router]
- test-angular-lint:
requires: [build-angular]
- test-angular-e2e:

View File

File diff suppressed because it is too large Load Diff

View File

@@ -6,15 +6,14 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "start-server-and-test serve http://localhost:8080 cypress",
"test:e2e": "concurrently \"npm run serve\" \"wait-on http-get://localhost:8080 && npm run cypress\" --kill-others --success first",
"lint": "vue-cli-service lint",
"cypress": "node_modules/.bin/cypress run --headless --browser chrome",
"sync": "sh ./scripts/sync.sh"
},
"dependencies": {
"@ionic/vue": "^5.4.1",
"@ionic/vue-router": "^5.4.1",
"core-js": "^3.6.5",
"@ionic/vue": "5.6.3",
"@ionic/vue-router": "5.6.3",
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-rc.4"
},
@@ -22,8 +21,8 @@
"@types/jest": "^24.0.19",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "^4.5.4",
"@vue/cli-plugin-babel": "^4.5.12",
"@vue/cli-plugin-e2e-cypress": "^5.0.0-alpha.7",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
@@ -32,12 +31,12 @@
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"cypress": "^5.3.0",
"concurrently": "^6.0.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"typescript": "~3.9.3",
"vue-jest": "^5.0.0-0",
"wait-on": "^5.2.0"
"wait-on": "^5.3.0"
},
"description": "An Ionic project"
}

View File

@@ -25,19 +25,18 @@
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('ionSwipeToGoBack', (complete = false, selector = 'ion-router-outlet') => {
const increment = (complete) ? 60 : 25;
const increment = (complete) ? 60 : 5;
cy.get(selector)
.first()
.trigger('mousedown', 0, 275, { which: 1, force: true })
.trigger('mousemove', increment * 1, 275, { which: 1, force: true })
.wait(50)
.wait(25)
.trigger('mousemove', increment * 2, 275, { which: 1, force: true })
.wait(50)
.wait(25)
.trigger('mousemove', increment * 3, 275, { which: 1, force: true })
.wait(50)
.trigger('mousemove', increment * 4, 275, { which: 1, force: true })
.wait(50)
.trigger('mouseup', increment * 4, 275, { which: 1, force: true })
.wait(25)
.trigger('mousemove', (complete) ? increment * 4 : increment * 0, 275, { which: 1, force: true })
.trigger('mouseup', (complete) ? increment * 4 : increment * 0, 275, { which: 1, force: true })
cy.wait(150);
})