Skip to content

Commit

Permalink
feat: add introduction process on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Jul 30, 2023
1 parent 8d459a9 commit 7e2af32
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 14 deletions.
4 changes: 4 additions & 0 deletions console/atest-ui/cypress/e2e/component-exist.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('Suite Manage', () => {

it('Create Suite', () => {
cy.visit('/')
cy.get('.introjs-skipbutton').click()
cy.contains('span', 'Tool Box')

cy.get('[test-id="open-new-suite-dialog"]').click()
Expand All @@ -29,6 +30,7 @@ describe('Suite Manage', () => {
const caseAPI = "/api/v2"
it('New Case', () => {
cy.visit('/')
cy.get('.introjs-skipbutton').click()
cy.get('span').contains(suiteName).should('be.visible').click()

cy.get('[test-id="open-new-case-dialog"]').click()
Expand All @@ -43,6 +45,7 @@ describe('Suite Manage', () => {

it('Find Case', () => {
cy.visit('/')
cy.get('.introjs-skipbutton').click()
const searchInput = cy.get('[test-id="search"]')
searchInput.type(caseName)
searchInput.trigger('keydown', {key: 'Enter'})
Expand All @@ -56,6 +59,7 @@ describe('Suite Manage', () => {

it('Delete Suite', () => {
cy.visit('/')
cy.get('.introjs-skipbutton').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-del-but"]').click()
Expand Down
11 changes: 11 additions & 0 deletions console/atest-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions console/atest-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"element-plus": "^2.3.7",
"intro.js": "^7.0.1",
"vue": "^3.3.4",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.2.2"
Expand Down
9 changes: 7 additions & 2 deletions console/atest-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ const viewName = ref('testcase')
</script>

<template>
<div class="common-layout">
<div class="common-layout" data-title="Welcome!" data-intro="Welcome to use api-testing! 👋">
<el-container style="height: 100vh">
<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-tree
Expand All @@ -209,6 +211,7 @@ const viewName = ref('testcase')
node-key="id"
:filter-node-method="filterTestCases"
@node-click="handleNodeClick"
data-intro="This is the test suite tree. You can click the test suite to edit it."
/>
</el-aside>

Expand All @@ -219,12 +222,14 @@ const viewName = ref('testcase')
:suite="testSuite"
:name="testCaseName"
@updated="loadStores"
data-intro="This is the test case editor. You can edit the test case here."
/>
<TestSuite
v-else-if="viewName === 'testsuite'"
:name="testSuite"
:store="store"
@updated="loadStores"
data-intro="This is the test suite editor. You can edit the test suite here."
/>
</el-main>
</el-container>
Expand Down
8 changes: 8 additions & 0 deletions console/atest-ui/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import App from './App.vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import introJs from 'intro.js'
import 'intro.js/introjs.css'

const app = createApp(App)

Expand All @@ -15,3 +17,9 @@ app.use(ElementPlus, {
// app.use(router)

app.mount('#app')

let dontShowAgain = window.location.search.indexOf('newbie') === -1;

Check notice on line 21 in console/atest-ui/src/main.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

console/atest-ui/src/main.ts#L21

'dontShowAgain' is never reassigned. Use 'const' instead.
introJs().setOptions({
"dontShowAgain": dontShowAgain,
"showProgress": true,
}).start();
4 changes: 2 additions & 2 deletions console/atest-ui/src/views/TemplateFunctions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function queryFuncs() {

<template>
<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-dialog v-model="dialogVisible" title="Template Functions Query" width="40%" draggable destroy-on-close>
<template #footer>
<el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" />
Expand Down
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ Please see the following example usage:
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
There are multiple storage backends supported. See the status from the list:

Expand Down
8 changes: 8 additions & 0 deletions sample/kubernetes/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
topologyKey: kubernetes.io/hostname
weight: 5
containers:
- image: ghcr.io/linuxsuren/api-testing
- image: ghcr.io/linuxsuren/api-testing:master
name: server
imagePullPolicy: Always
livenessProbe:
Expand All @@ -52,18 +52,32 @@ spec:
memory: 512Mi
requests:
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
kind: Service
metadata:
name: api-testing
spec:
ports:
- name: grpc
port: 7070
protocol: TCP
targetPort: 7070
- name: web
port: 8080
protocol: TCP
Expand All @@ -72,3 +86,35 @@ spec:
app: api-testing
sessionAffinity: None
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
9 changes: 9 additions & 0 deletions sample/kubernetes/docker.io/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions sample/kubernetes/kustomization.yaml

This file was deleted.

0 comments on commit 7e2af32

Please sign in to comment.