feat: add unit tests for UI (#133)
This commit is contained in:
parent
17bdadc11d
commit
352f9eda80
|
@ -1,4 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
make test-all
|
||||
cd console/atest-ui && npm run format
|
||||
|
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
- uses: actions/checkout@v3.0.0
|
||||
- name: Unit Test
|
||||
run: |
|
||||
make test-all
|
||||
make test-all-backend
|
||||
- name: Report
|
||||
if: github.actor == 'linuxsuren'
|
||||
env:
|
||||
|
@ -61,3 +61,5 @@ jobs:
|
|||
cache-dependency-path: console/atest-ui/package-lock.json
|
||||
- name: Build
|
||||
run: make build-embed-ui
|
||||
- name: Test
|
||||
run: make test-ui test-e2e
|
||||
|
|
7
Makefile
7
Makefile
|
@ -33,13 +33,18 @@ copy-restart: build-embed-ui
|
|||
test:
|
||||
go test ./... -cover -v -coverprofile=coverage.out
|
||||
go tool cover -func=coverage.out
|
||||
test-ui:
|
||||
cd console/atest-ui && npm run test:unit
|
||||
test-e2e:
|
||||
cd console/atest-ui && npm run test:e2e
|
||||
test-collector:
|
||||
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
|
||||
go tool cover -func=collector-coverage.out
|
||||
test-store-orm:
|
||||
go test github.com/linuxsuren/api-testing/extensions/store-orm/./... -cover -v -coverprofile=store-orm-coverage.out
|
||||
go tool cover -func=store-orm-coverage.out
|
||||
test-all: test test-collector test-store-orm
|
||||
test-all-backend: test test-collector test-store-orm
|
||||
test-all: test-all-backend test-ui
|
||||
|
||||
install-precheck:
|
||||
cp .github/pre-commit .git/hooks/pre-commit
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// https://on.cypress.io/api
|
||||
|
||||
describe('Components exist', () => {
|
||||
it('Home page', () => {
|
||||
cy.visit('/')
|
||||
cy.contains('span', 'Tool Box')
|
||||
})
|
||||
})
|
|
@ -1,7 +0,0 @@
|
|||
// https://on.cypress.io/api
|
||||
|
||||
describe('My First Test', () => {
|
||||
it('visits the app root url', () => {
|
||||
cy.visit('/')
|
||||
})
|
||||
})
|
|
@ -6,14 +6,14 @@
|
|||
"dev": "vite",
|
||||
"build": "run-p type-check build-only",
|
||||
"preview": "vite preview",
|
||||
"test:unit": "vitest",
|
||||
"test:unit": "jest --collect-coverage",
|
||||
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
|
||||
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'",
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||
"format": "prettier --write src/",
|
||||
"test": "vitest --dom"
|
||||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"element-plus": "^2.3.7",
|
||||
|
|
Loading…
Reference in New Issue