Commit 31845e22 authored by 黎博's avatar 黎博

empty

parent 29e6bdb8
File deleted
# autointerface-h5
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
'use strict'
module.exports = {
NODE_ENV: '"production"'
}
'use strict'
const merge = require('webpack-merge')
const devEnv = require('./dev.env')
module.exports = merge(devEnv, {
NODE_ENV: '"testing"'
})
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>QA测试平台</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
This diff is collapsed.
{
"name": "qa-platform-ui",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "libo <bo.li@quantgroup.cn>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.19.2",
"echarts": "^4.8.0",
"element-ui": "^2.13.2",
"less": "^3.11.1",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2",
"babel-loader": "^7.1.1",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"jest": "^22.0.4",
"jest-serializer-vue": "^0.3.0",
"less-loader": "^4.1.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-jest": "^1.0.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
</style>
html, body, #app {
height: 100%;
min-width: 1024px;
margin: 0;
padding: 0;
}
.el-breadcrumb {
margin-bottom: 15px;
font-size: 12px;
}
.el-pagination {
margin-top: 20px;
}
\ No newline at end of file
<template>
<div>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item>自动化测试</el-breadcrumb-item>
<el-breadcrumb-item>接口管理</el-breadcrumb-item>
</el-breadcrumb>
<el-card>接口管理</el-card>
</div>
</template>
<script>
export default {}
</script>
<style lang="less" scoped>
</style>
<template>
<div>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item>自动化测试</el-breadcrumb-item>
<el-breadcrumb-item>项目管理</el-breadcrumb-item>
</el-breadcrumb>
<el-card>项目管理</el-card>
</div>
</template>
<script>
export default {}
</script>
<style lang="less" scoped>
</style>
<template>
<div class="report">
<div class="reportheader">
<h2>测试报告</h2>
</div>
<!-- 数据总计区 -->
<el-card>
<el-collapse v-model="activeNames" @change="handleCollapseChange">
<el-collapse-item title="报告汇总" name="1">
<div class="total">
<!-- 汇总区域 -->
<div class="panel">
<div class="data">
<p style="color: #1CB395; font-weight: bold; margin-bottom: 10px;">
用例名称:
<el-input
v-model="testcaseName"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
<p style="color: #1CB395; font-weight: bold; margin-bottom: 10px;">
用例总数:
<el-input
v-model="totalCaseNum"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
<p style="color: #1CB395; font-weight: bold; margin-bottom: 10px;">
用例通过:
<el-input
v-model="passedCaseNum"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
<p style="color: #EE5968; font-weight: bold; margin-bottom: 10px;">
用例失败:
<el-input
v-model="failedCaseNum"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
<p style="color: #F9B264; font-weight: bold; margin-bottom: 10px;">
用例跳过:
<el-input
v-model="jumpCaseNum"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
<p style="color: #1CB395; font-weight: bold; margin-bottom: 10px;">
开始时间:
<el-input v-model="startTime" :disable="true" style="width: 200px;" size="small"></el-input>
</p>
<p style="color: #1CB395; font-weight: bold;">
运行时长:
<el-input
v-model="elapsedTime"
:disable="true"
style="width: 200px;"
size="small"
></el-input>
</p>
</div>
</div>
<div class="panel">
<div class="chart"></div>
</div>
</div>
</el-collapse-item>
<el-collapse-item title="详细数据" name="2">
<div class="body">
<!-- 头部过滤区 -->
<div class="detail">
<div class="filter">
<p>
接口地址:&nbsp;
<el-select
v-model="value"
clearable
placeholder="请选择"
style="width: 300px;"
size="medium"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
<p>
结果:&nbsp;
<el-select v-model="value" clearable placeholder="请选择" size="medium">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
</div>
<div class="num">
<p style="color: #1CB395;">用例数: 10000 |&nbsp;</p>
<p style="color: #1CB395;">成功: 0 |&nbsp;</p>
<p style="color: #1CB395;">失败: 0 |&nbsp;</p>
<p style="color: #1CB395;">跳过: 0 &nbsp;</p>
</div>
</div>
</div>
<!-- 表格区域 -->
<el-table :data="tableData" border style="width: 100%">
<el-table-column type="index" label="编号" width="100px"></el-table-column>
<el-table-column prop="date" label="请求地址" width="180"></el-table-column>
<el-table-column prop="name" label="响应结果" width="180"></el-table-column>
<el-table-column prop="address" label="用例描述"></el-table-column>
<el-table-column prop="address" label="耗时"></el-table-column>
<el-table-column prop="address" label="结果"></el-table-column>
<el-table-column prop="address" label="操作"></el-table-column>
</el-table>
<!-- 分页区域 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage4"
:page-sizes="[100, 200, 300, 400]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="400"
></el-pagination>
</el-collapse-item>
</el-collapse>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
activeNames: ['1', '2'],
testcaseName: '123', // 用例名称
totalCaseNum: 100, // 总用例数
passedCaseNum: 50, // 成功用例数
failedCaseNum: 50, // 失败用例数
jumpCaseNum: 0, // 跳过用例数
startTime: 'xxx', // 开始时间
elapsedTime: 123, // 运行时间
// 测试结果饼图Option
resultOption: {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: ['成功', '失败', '跳过']
},
series: [
{
name: '用例数',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [
{ value: 100, name: '成功' },
{ value: 20, name: '失败' },
{ value: 0, name: '跳过' }
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
itemStyle: {
normal: {
color: function(params) {
var colorList = ['#1CB395', '#EE5968', '#F9B264']
return colorList[params.dataIndex]
}
}
}
}
]
}
}
},
mounted() {
this.setResultChart()
},
methods: {
handleCollapseChange(val) {
console.log(val)
},
// 渲染结果饼图
setResultChart() {
var resultChart = this.$echarts.init(
document.querySelector('.panel .chart')
)
resultChart.setOption(this.resultOption)
}
}
}
</script>
<style lang="less" scoped>
* {
margin: 0;
padding: 0;
}
.reportheader {
height: 50px;
background-color: #fff;
margin-bottom: 10px;
padding: 0;
h2 {
text-align: center;
font-size: 22px;
color: #18b394;
padding-top: 10px;
}
}
.total {
position: relative;
display: flex;
height: 400px;
width: 100%;
.panel {
flex: 1;
margin: 0 10px;
.data {
margin-left: 30px;
}
.chart {
height: 100%;
width: 100%;
}
}
}
.total::before {
position: absolute;
top: 0;
width: 100%;
content: '';
border-top: 1px solid #eceef6;
}
.panel:nth-child(1) {
border-right: 1px solid #eceef6;
margin-top: 25px;
}
.body {
position: relative;
}
.detail::before {
position: absolute;
top: 0;
width: 100%;
content: '';
border-top: 1px solid #eceef6;
}
.detail {
display: flex;
.filter {
flex: 1;
display: flex;
p {
flex: 1;
}
}
.num {
display: flex;
width: 400px;
padding-top: 10px;
justify-content: flex-end;
.p {
flex: 1;
text-align: center;
}
}
}
</style>
<template>
<div>
<!-- 头部导航栏 -->
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item>数据工厂</el-breadcrumb-item>
<el-breadcrumb-item>已有数据查询</el-breadcrumb-item>
</el-breadcrumb>
<!-- 卡片视图 -->
<el-card>
<!-- namespace下拉框 -->
<div class="filter">
<p>
Namespace:
<el-select v-model="selectNamespace" placeholder="请选择namespace">
<el-option
v-for="item in namespaceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
<!-- 借款状态下拉框 -->
<p>
借款状态:
<el-select v-model="selectStatus" placeholder="请选择借款状态" @change="selectStatusChange">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
<!-- 查询数据按钮 -->
<p>
<el-button type="primary" style="margin-left:20px" @click="getTableData">查询数据</el-button>
</p>
</div>
<!-- 数据表格 -->
<div class="dataTable">
<el-table :data="dataTable" border style="width: 100%">
<el-table-column prop="phoneNo" label="phone_no" width="150px"></el-table-column>
<el-table-column prop="userId" label="user_id" width="100px"></el-table-column>
<el-table-column prop="uuid" label="uuid" width="330px"></el-table-column>
<el-table-column prop="enable" label="enable" width="100px">
<template slot-scope="scope">
<el-tag v-if="scope.row.enable === 1" type="success">启用</el-tag>
<el-tag v-else-if="scope.row.enable === 0" type="danger">停用</el-tag>
</template>
</el-table-column>
<el-table-column prop="registeredFrom" label="注册渠道" width="100px"></el-table-column>
<el-table-column prop="createdAt" label="创建时间" width="200px"></el-table-column>
</el-table>
</div>
<!-- 分页 -->
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="queryInfo.pageNum"
:page-size="queryInfo.pageSize"
layout="total, prev, pager, next"
:total="totalNum"
></el-pagination>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
namespaceOptions: [],
statusOptions: [],
dataTable: [],
selectNamespace: 'qa',
selectStatus: '',
totalNum: 0,
queryInfo: {
status: '',
pageNum: 1,
pageSize: 10
}
}
},
created() {},
methods: {
// 获取namespace选项
getNamespaceOptions() {
this.$axios
.get('/allEnvInfo')
.then(response => {
this.namespaceOptions = response['data']['data']
})
.catch(error => console.log(error))
},
// 获取状态选项
getStatusOptions() {
this.$axios
.get('/allUserLoanStatus')
.then(response => {
this.statusOptions = response['data']['data']
})
.catch(error => console.log(error))
},
// 获取表格数据
getTableData() {
this.dataTable = []
this.$axios
.get('/getLoanUserData', { params: this.queryInfo })
.then(response => {
this.dataTable = response.data.data.content
this.totalNum = response.data.data.totalNum
console.log(this.dataTable)
})
.catch(error => console.log(error))
},
selectStatusChange() {
this.queryInfo.status = this.selectStatus
},
handleSizeChange(newSize) {
this.queryInfo.pageSize = newSize
this.getTableData()
},
handleCurrentChange(newPage) {
this.queryInfo.pageNum = newPage
this.getTableData()
}
},
mounted() {
this.getNamespaceOptions()
this.getStatusOptions()
}
}
</script>
<style lang="less" scoped>
.dataTable {
margin-top: 20px;
}
.filter {
display: flex;
p {
margin-right: 20px;
}
}
</style>
<template>
<div>
<!-- 头部导航栏 -->
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item>数据工厂</el-breadcrumb-item>
<el-breadcrumb-item>生成新数据</el-breadcrumb-item>
</el-breadcrumb>
<!-- 卡片视图 -->
<el-card>
<!-- namespace下拉框 -->
<div class="filter">
<p>
Namespace:
<el-select
v-model="selectNamespace"
placeholder="请选择namespace"
@change="handleNamespaceChange"
>
<el-option
v-for="item in namespaceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
<!-- 借款状态下拉框 -->
<p>
借款状态:
<el-select v-model="selectStatus" placeholder="请选择借款状态">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</p>
<!-- 数据个数 -->
<p>
数据个数:
<el-input-number
v-model="expectNum"
@change="handleExpectNumChange"
:min="1"
:max="100"
label="数据个数"
></el-input-number>
</p>
<!-- 查询数据按钮 -->
<p>
<el-button type="primary" style="margin-left:20px" @click="queryData">制造数据</el-button>
</p>
</div>
<!-- 数据表格 -->
<div class="dataTable">
<el-table :data="dataTable" border style="width: 100%">
<el-table-column type="phoneNo" label="phone_no" width="200px"></el-table-column>
<el-table-column prop="userId" label="user_id" width="150px"></el-table-column>
<el-table-column prop="uuid" label="uuid" width="300px"></el-table-column>
<el-table-column prop="status" label="status" width="100px"></el-table-column>
<el-table-column prop="status" label="注册渠道" width="100px"></el-table-column>
<el-table-column prop="status" label="创建时间" width="200px"></el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
namespaceOptions: [],
statusOptions: [],
selectNamespace: '',
selectStatus: '',
expectNum: 1
}
},
created() {},
methods: {
getNamespaceOptions() {
this.$axios
.get('/allEnvInfo')
.then(response => {
this.namespaceOptions = response['data']['data']
})
.catch(error => console.log(error))
},
getStatusOptions() {
this.$axios
.get('/allUserLoanStatus')
.then(response => {
this.statusOptions = response['data']['data']
})
.catch(error => console.log(error))
},
handleExpectNumChange(newNum) {}
},
mounted() {
this.getNamespaceOptions()
this.getStatusOptions()
}
}
</script>
<style lang="less" scoped>
.dataTable {
margin-top: 20px;
}
.filter {
display: flex;
p {
margin-right: 20px;
}
}
</style>
<template>
<el-container class="home">
<el-header>
<div>
<img src="../assets/image/logo.png" alt />
<span>测试平台</span>
</div>
</el-header>
<el-container>
<el-aside width="200px">
<el-menu
:default-active="activePath"
background-color="#525e70"
text-color="#fff"
active-text-color="#ffd04b"
router
>
<el-submenu :index="1">
<template slot="title">
<i class="el-icon-s-check"></i>
<span>自动化测试</span>
</template>
<el-menu-item index="/project" @click="saveNavState('/project')">
<template slot="title">
<span>项目管理</span>
</template>
</el-menu-item>
<el-menu-item index="/case" @click="saveNavState('/case')">
<template slot="title">
<span>接口管理</span>
</template>
</el-menu-item>
<el-menu-item index="/report" @click="saveNavState('/report')">
<template slot="title">
<span>测试报告</span>
</template>
</el-menu-item>
</el-submenu>
<el-submenu :index="2">
<template slot="title">
<i class="el-icon-s-data"></i>
<span>数据工厂</span>
</template>
<el-menu-item index="/checkOldLoanData" @click="saveNavState('/checkOldLoanData')">
<template slot="title">
<span>查数据</span>
</template>
</el-menu-item>
<el-menu-item index="/genNewLoanData" @click="saveNavState('/genNewLoanData')">
<template slot="title">
<span>造数据</span>
</template>
</el-menu-item>
</el-submenu>
</el-menu>
</el-aside>
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</template>
<script>
export default {
data() {
return {
activePath: ''
}
},
methods: {
saveNavState(curPath) {
this.activePath = curPath
window.sessionStorage.setItem('activePath', curPath)
}
},
created() {
this.activePath = window.sessionStorage.getItem('activePath')
}
}
</script>
<style lang="less" scoped>
.home {
height: 100%;
}
.el-header {
background-color: #2a2961;
color: #333;
text-align: center;
line-height: 60px;
> div {
display: flex;
span {
font-size: 22px;
color: #ffffff;
margin-left: 20px;
}
> img {
height: 40px;
width: 70px;
margin-top: 12px;
}
}
}
.el-aside {
background-color: #525e70;
height: 100%;
.el-menu {
border-right: none;
}
}
.el-main {
background-color: #e9eef3;
}
</style>
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import '../src/assets/css/global.css'
import router from './router'
import echarts from 'echarts'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import {
Container,
Header,
Aside,
Main,
Menu,
Submenu,
MenuItem,
Card,
Collapse,
CollapseItem,
Input,
Table,
TableColumn,
Select,
Option,
Breadcrumb,
BreadcrumbItem,
Button,
InputNumber,
Tag,
Pagination
} from 'element-ui'
Vue.config.productionTip = false
Vue.prototype.$axios = axios
Vue.prototype.$echarts = echarts
axios.defaults.baseURL = 'http://127.0.0.1:8082'
Vue.use(Container)
Vue.use(Header)
Vue.use(Aside)
Vue.use(Main)
Vue.use(Menu)
Vue.use(Submenu)
Vue.use(MenuItem)
Vue.use(Card)
Vue.use(Collapse)
Vue.use(CollapseItem)
Vue.use(Input)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Select)
Vue.use(Option)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Button)
Vue.use(InputNumber)
Vue.use(Tag)
Vue.use(Pagination)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
import Vue from 'vue'
import Router from 'vue-router'
import Home from '../components/Home'
import Project from '../components/Automation/Project'
import Case from '../components/Automation/Case'
import Report from '../components/Automation/Report'
import GenNewLoanData from '../components/Data/GenNewLoanData'
import CheckOldLoanData from '../components/Data/CheckOldLoanData'
Vue.use(Router)
const router = new Router({
mode: 'history',
routes: [
{
'path': '/',
redirect: '/home'
},
{
'path': '/home',
component: Home,
children: [
{
'path': '/project',
component: Project
},
{
'path': '/case',
component: Case
},
{
'path': '/report',
component: Report
},
{
'path': '/genNewLoanData',
component: GenNewLoanData
},
{
'path': '/checkOldLoanData',
component: CheckOldLoanData
}
]
}
]
})
export default router
// A custom Nightwatch assertion.
// The assertion name is the filename.
// Example usage:
//
// browser.assert.elementCount(selector, count)
//
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function (selector, count) {
this.message = 'Testing if element <' + selector + '> has count: ' + count
this.expected = count
this.pass = function (val) {
return val === this.expected
}
this.value = function (res) {
return res.value
}
this.command = function (cb) {
var self = this
return this.api.execute(function (selector) {
return document.querySelectorAll(selector).length
}, [selector], function (res) {
cb.call(self, res)
})
}
}
require('babel-register')
var config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'
const webpack = require('webpack')
const DevServer = require('webpack-dev-server')
const webpackConfig = require('../../build/webpack.prod.conf')
const devConfigPromise = require('../../build/webpack.dev.conf')
let server
devConfigPromise.then(devConfig => {
const devServerOptions = devConfig.devServer
const compiler = webpack(webpackConfig)
server = new DevServer(compiler, devServerOptions)
const port = devServerOptions.port
const host = devServerOptions.host
return server.listen(port, host)
})
.then(() => {
// 2. run the nightwatch test suite against it
// to run in additional browsers:
// 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
// 2. add it to the --env flag below
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
// For more information on Nightwatch's config file, see
// http://nightwatchjs.org/guide#settings-file
let opts = process.argv.slice(2)
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
}
if (opts.indexOf('--env') === -1) {
opts = opts.concat(['--env', 'chrome'])
}
const spawn = require('cross-spawn')
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
runner.on('exit', function (code) {
server.close()
process.exit(code)
})
runner.on('error', function (err) {
server.close()
throw err
})
})
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
'default e2e tests': function (browser) {
// automatically uses dev Server port from /config.index.js
// default: http://localhost:8080
// see nightwatch.conf.js
const devServer = browser.globals.devServerURL
browser
.url(devServer)
.waitForElementVisible('#app', 5000)
.assert.elementPresent('.hello')
.assert.containsText('h1', 'Welcome to Your Vue.js App')
.assert.elementCount('img', 1)
.end()
}
}
{
"env": {
"jest": true
},
"globals": {
}
}
const path = require('path')
module.exports = {
rootDir: path.resolve(__dirname, '../../'),
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
testPathIgnorePatterns: [
'<rootDir>/test/e2e'
],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
mapCoverage: true,
coverageDirectory: '<rootDir>/test/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
'!src/router/index.js',
'!**/node_modules/**'
]
}
import Vue from 'vue'
Vue.config.productionTip = false
import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
describe('HelloWorld.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(HelloWorld)
const vm = new Constructor().$mount()
expect(vm.$el.querySelector('.hello h1').textContent)
.toEqual('Welcome to Your Vue.js App')
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment