Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: add a welcome page when no any test suites #184

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions console/atest-ui/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import WelcomePage from './views/WelcomePage.vue'
import TestCase from './views/TestCase.vue'
import TestSuite from './views/TestSuite.vue'
import StoreManager from './views/StoreManager.vue'
Expand Down Expand Up @@ -132,6 +133,10 @@ function loadStores() {
loadTestSuites(item.name)
}
})

if (data.value.length === 0) {
viewName.value = ""
}
})
}
loadStores()
Expand Down Expand Up @@ -235,14 +240,14 @@ const filterTestCases = (value: string, data: Tree) => {
return data.label.includes(value)
}

const viewName = ref('testcase')
const viewName = ref('')
</script>

<template>
<div class="common-layout" data-title="Welcome!" data-intro="Welcome to use api-testing! 👋">
<el-container style="height: 100%">
<el-header style="height: 30px;justify-content: flex-end;">
<el-button type="primary" :icon="Share" @click="viewName = ''" data-intro="Manage the store backends." />
<el-button type="primary" :icon="Share" @click="viewName = 'store'" data-intro="Manage the store backends." />
</el-header>

<el-main>
Expand Down Expand Up @@ -271,23 +276,26 @@ const viewName = ref('testcase')
</el-aside>

<el-main>
<WelcomePage
v-if="viewName === ''"
/>
<TestCase
v-if="viewName === 'testcase'"
v-else-if="viewName === 'testcase'"
:store="store"
: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' && 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."
/>
<StoreManager
v-else-if="viewName === '' || testSuite === '' || store === ''"
v-else-if="viewName === 'store'"
/>
</el-main>
</el-container>
Expand Down Expand Up @@ -338,6 +346,7 @@ const viewName = ref('testcase')
</el-dialog>

<el-dialog v-model="importDialogVisible" title="Import Test Suite" width="30%" draggable>
<span>Supported source URL: Postman collection share link</span>
<template #footer>
<span class="dialog-footer">
<el-form
Expand All @@ -360,7 +369,7 @@ const viewName = ref('testcase')
</el-select>
</el-form-item>
<el-form-item label="URL" prop="url">
<el-input v-model="importSuiteForm.url" test-id="suite-import-form-api" />
<el-input v-model="importSuiteForm.url" test-id="suite-import-form-api" placeholder="https://api.postman.com/collections/xxx" />
</el-form-item>
<el-form-item>
<el-button
Expand Down
2 changes: 1 addition & 1 deletion console/atest-ui/src/views/StoreManager.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { reactive, ref, watch } from 'vue'
import { reactive, ref } from 'vue'
import { Edit, Delete } from '@element-plus/icons-vue'
import type { FormInstance, FormRules } from 'element-plus'
import type { Pair } from './types'
Expand Down
10 changes: 10 additions & 0 deletions console/atest-ui/src/views/WelcomePage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>Welcome to use atest to improve your code quality!</div>
<div>Please read the following guide if this is your first time to use atest.</div>
<li>Create a test suite on the left panel</li>
<li>Select a suite, then create the test case.</li>

<div>
Please get more details from the <a href="https://linuxsuren.github.io/api-testing/" target="_blank" rel="noopener">offical document</a>.
</div>
</template>
Loading