feat: add introduction process on UI (#149)

This commit is contained in:
Rick 2023-07-30 21:32:20 +08:00 committed by GitHub
parent e8c16fb686
commit 1e45dd165d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 112 additions and 14 deletions

View File

@ -10,6 +10,7 @@ describe('Suite Manage', () => {
it('Create Suite', () => { it('Create Suite', () => {
cy.visit('/') cy.visit('/')
cy.get('.introjs-skipbutton').click()
cy.contains('span', 'Tool Box') cy.contains('span', 'Tool Box')
cy.get('[test-id="open-new-suite-dialog"]').click() cy.get('[test-id="open-new-suite-dialog"]').click()
@ -29,6 +30,7 @@ describe('Suite Manage', () => {
const caseAPI = "/api/v2" const caseAPI = "/api/v2"
it('New Case', () => { it('New Case', () => {
cy.visit('/') cy.visit('/')
cy.get('.introjs-skipbutton').click()
cy.get('span').contains(suiteName).should('be.visible').click() cy.get('span').contains(suiteName).should('be.visible').click()
cy.get('[test-id="open-new-case-dialog"]').click() cy.get('[test-id="open-new-case-dialog"]').click()
@ -43,6 +45,7 @@ describe('Suite Manage', () => {
it('Find Case', () => { it('Find Case', () => {
cy.visit('/') cy.visit('/')
cy.get('.introjs-skipbutton').click()
const searchInput = cy.get('[test-id="search"]') const searchInput = cy.get('[test-id="search"]')
searchInput.type(caseName) searchInput.type(caseName)
searchInput.trigger('keydown', {key: 'Enter'}) searchInput.trigger('keydown', {key: 'Enter'})
@ -56,6 +59,7 @@ describe('Suite Manage', () => {
it('Delete Suite', () => { it('Delete Suite', () => {
cy.visit('/') cy.visit('/')
cy.get('.introjs-skipbutton').click()
cy.get('span').contains(suiteName).should('be.visible').click() cy.get('span').contains(suiteName).should('be.visible').click()
cy.get('[test-id="suite-editor-api"]').should('have.value', sampleAPIAddress) cy.get('[test-id="suite-editor-api"]').should('have.value', sampleAPIAddress)
cy.get('[test-id="suite-del-but"]').click() cy.get('[test-id="suite-del-but"]').click()

View File

@ -9,6 +9,7 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"element-plus": "^2.3.7", "element-plus": "^2.3.7",
"intro.js": "^7.0.1",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-json-viewer": "^3.0.4", "vue-json-viewer": "^3.0.4",
"vue-router": "^4.2.2" "vue-router": "^4.2.2"
@ -6421,6 +6422,11 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/intro.js": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/intro.js/-/intro.js-7.0.1.tgz",
"integrity": "sha512-1oqz6aOz9cGQ3CrtVYhCSo6AkjnXUn302kcIWLaZ3TI4kKssRXDwDSz4VRoGcfC1jN+WfaSJXRBrITz+QVEBzg=="
},
"node_modules/is-array-buffer": { "node_modules/is-array-buffer": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz", "resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
@ -17072,6 +17078,11 @@
"side-channel": "^1.0.4" "side-channel": "^1.0.4"
} }
}, },
"intro.js": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/intro.js/-/intro.js-7.0.1.tgz",
"integrity": "sha512-1oqz6aOz9cGQ3CrtVYhCSo6AkjnXUn302kcIWLaZ3TI4kKssRXDwDSz4VRoGcfC1jN+WfaSJXRBrITz+QVEBzg=="
},
"is-array-buffer": { "is-array-buffer": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz", "resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz",

View File

@ -17,6 +17,7 @@
}, },
"dependencies": { "dependencies": {
"element-plus": "^2.3.7", "element-plus": "^2.3.7",
"intro.js": "^7.0.1",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-json-viewer": "^3.0.4", "vue-json-viewer": "^3.0.4",
"vue-router": "^4.2.2" "vue-router": "^4.2.2"

View File

@ -193,10 +193,12 @@ const viewName = ref('testcase')
</script> </script>
<template> <template>
<div class="common-layout"> <div class="common-layout" data-title="Welcome!" data-intro="Welcome to use api-testing! 👋">
<el-container style="height: 100%"> <el-container style="height: 100%">
<el-aside width="200px"> <el-aside width="200px">
<el-button type="primary" @click="openTestSuiteCreateDialog" test-id="open-new-suite-dialog" :icon="Edit">New</el-button> <el-button type="primary" @click="openTestSuiteCreateDialog"
data-intro="Click here to create a new test suite"
test-id="open-new-suite-dialog" :icon="Edit">New</el-button>
<el-input v-model="filterText" placeholder="Filter keyword" test-id="search" /> <el-input v-model="filterText" placeholder="Filter keyword" test-id="search" />
<el-tree <el-tree
@ -209,6 +211,7 @@ const viewName = ref('testcase')
node-key="id" node-key="id"
:filter-node-method="filterTestCases" :filter-node-method="filterTestCases"
@node-click="handleNodeClick" @node-click="handleNodeClick"
data-intro="This is the test suite tree. You can click the test suite to edit it."
/> />
</el-aside> </el-aside>
@ -219,12 +222,14 @@ const viewName = ref('testcase')
:suite="testSuite" :suite="testSuite"
:name="testCaseName" :name="testCaseName"
@updated="loadStores" @updated="loadStores"
data-intro="This is the test case editor. You can edit the test case here."
/> />
<TestSuite <TestSuite
v-else-if="viewName === 'testsuite'" v-else-if="viewName === 'testsuite'"
:name="testSuite" :name="testSuite"
:store="store" :store="store"
@updated="loadStores" @updated="loadStores"
data-intro="This is the test suite editor. You can edit the test suite here."
/> />
</el-main> </el-main>
</el-container> </el-container>

View File

@ -6,6 +6,8 @@ import App from './App.vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import introJs from 'intro.js'
import 'intro.js/introjs.css'
const app = createApp(App) const app = createApp(App)
@ -15,3 +17,9 @@ app.use(ElementPlus, {
// app.use(router) // app.use(router)
app.mount('#app') app.mount('#app')
const dontShowAgain = window.location.search.indexOf('newbie') === -1;
introJs().setOptions({
"dontShowAgain": dontShowAgain,
"showProgress": true,
}).start();

View File

@ -23,10 +23,10 @@ function queryFuncs() {
<template> <template>
<el-affix position="bottom" :offset="20"> <el-affix position="bottom" :offset="20">
<el-button type="primary" @click="dialogVisible = !dialogVisible">Tool Box</el-button> <el-button type="primary" @click="dialogVisible = !dialogVisible"
data-intro="You can search your desired template functions.">Tool Box</el-button>
</el-affix> </el-affix>
<el-dialog v-model="dialogVisible" title="Template Functions Query" width="40%" draggable destroy-on-close> <el-dialog v-model="dialogVisible" title="Template Functions Query" width="40%" draggable destroy-on-close>
<template #footer> <template #footer>
<el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" /> <el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" />

View File

@ -35,6 +35,16 @@ Please see the following example usage:
atest service start -m podman --version master atest service start -m podman --version master
``` ```
## Run in k3s
```shell
sudo k3s server --write-kubeconfig-mode 666
k3s kubectl apply -k sample/kubernetes/default
kustomize build sample/kubernetes/docker.io/ | k3s kubectl apply -f -
```
## Storage ## Storage
There are multiple storage backends supported. See the status from the list: There are multiple storage backends supported. See the status from the list:

View File

@ -0,0 +1,8 @@
resources:
- manifest.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: ghcr.io/linuxsuren/api-testing:master
newName: ghcr.io/linuxsuren/api-testing
newTag: master

View File

@ -31,7 +31,7 @@ spec:
topologyKey: kubernetes.io/hostname topologyKey: kubernetes.io/hostname
weight: 5 weight: 5
containers: containers:
- image: ghcr.io/linuxsuren/api-testing - image: ghcr.io/linuxsuren/api-testing:master
name: server name: server
imagePullPolicy: Always imagePullPolicy: Always
livenessProbe: livenessProbe:
@ -52,7 +52,25 @@ spec:
memory: 512Mi memory: 512Mi
requests: requests:
cpu: 100m cpu: 100m
memory: 100m memory: 100Mi
volumeMounts:
- name: config
mountPath: /root/.config/atest/
- image: ghcr.io/linuxsuren/api-testing:master
name: extension-orm
command: [atest-store-orm]
imagePullPolicy: Always
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 100Mi
volumes:
- name: config
configMap:
name: api-testing
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@ -60,10 +78,6 @@ metadata:
name: api-testing name: api-testing
spec: spec:
ports: ports:
- name: grpc
port: 7070
protocol: TCP
targetPort: 7070
- name: web - name: web
port: 8080 port: 8080
protocol: TCP protocol: TCP
@ -72,3 +86,35 @@ spec:
app: api-testing app: api-testing
sessionAffinity: None sessionAffinity: None
type: NodePort type: NodePort
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-testing
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-testing
port:
number: 8080
---
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: api-testing
data:
stores.yaml: |
- name: db
kind:
name: database
url: localhost:7071
url: localhost:4000
username: root
properties:
database: test

View File

@ -0,0 +1,9 @@
bases:
- ../default
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: ghcr.io/linuxsuren/api-testing:master
newName: linuxsuren/api-testing
newTag: master

View File

@ -1,4 +0,0 @@
resources:
- manifest.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization