testgen/index.html

92 lines
3.9 KiB
HTML
Raw Normal View History

2017-09-08 17:57:29 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.1/css/bulma.css" />
2017-09-18 16:32:45 +00:00
<title>Multivar TestGen</title>
2017-10-03 15:32:33 +00:00
<style>[v-cloak] { display: none }</style>
2017-09-08 17:57:29 +00:00
</head>
<body>
<section class="section">
<div class="container" id="app">
2017-09-11 13:54:47 +00:00
2017-09-08 17:57:29 +00:00
<h1 class="title">Multivariable TestGenerator</h1>
2017-09-11 13:59:37 +00:00
<p class="subtitle">Enter each set of variables separated by an empty line. Paste the output into a Jira test case!</p>
2017-09-11 13:54:47 +00:00
2017-09-11 13:59:37 +00:00
<hr>
2017-09-11 13:54:47 +00:00
<div class="field is-grouped">
<div class="control">
<label class="label">Prefix</label>
<input style="font-family:monospace;" v-model="prefix" type="text" class="input">
</div>
<div class="control">
<label class="label">Delimiter</label>
<input style="font-family:monospace;" v-model="delimiter" type="text" class="input">
</div>
<div class="control">
<label class="label">Suffix</label>
<input style="font-family:monospace;" v-model="suffix" type="text" class="input">
</div>
</div>
2017-09-11 13:59:37 +00:00
<p><em>These presets will display the combinations as a bulleted list with Jira formatting. Feel free to change them as needed.</em></p>
<hr>
2017-09-11 13:54:47 +00:00
2017-09-08 17:57:29 +00:00
<div class="field">
2017-09-11 13:54:47 +00:00
<label class="label">Variables</label>
2017-09-11 17:40:43 +00:00
<em>Lines starting with <code>#</code> are comments.</em>
2017-10-03 15:38:31 +00:00
<div class="control"><textarea style="font-family:monospace; resize:vertical;" rows="20" v-model="n" class="textarea"></textarea></div>
2017-09-08 17:57:29 +00:00
</div>
2017-09-11 13:54:47 +00:00
2017-09-11 14:57:57 +00:00
<p v-cloak><strong>{{ combos.length }}</strong> {{ pluralize("test case", combos.length) }}</p>
<pre v-cloak>{{ combos.join('\n') }}</pre>
2017-09-11 13:54:47 +00:00
2017-09-08 17:57:29 +00:00
</div>
</section>
2017-09-11 13:54:47 +00:00
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>Variable Combination Generator</p>
<p>More info on <a href="https://hagerty.atlassian.net/wiki/spaces/QA/pages/56328193/Test+Data+Generator">Confluence</a>.</p>
</div>
</div>
</footer>
2017-10-03 15:38:31 +00:00
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
2017-09-18 16:32:45 +00:00
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
2017-10-03 15:38:31 +00:00
<script type="text/babel">
2017-09-11 13:19:52 +00:00
const cartesian = arr => arr.reduce((a, b) => a.map(x => b.map(y => x.concat(y))).reduce((a, b) => a.concat(b), []), [[]])
const vm = new Vue({
el: '#app',
2017-09-11 13:54:47 +00:00
data: {
prefix: "* ",
delimiter: " \\\\ ",
suffix: " \\\\ \\\\",
2017-09-18 16:32:45 +00:00
n: "# Country\nDTUS\nDTCAN\n\n# Routing number\nValid routing number\nInvalid routing number\n\n# Service call\nIncluded in service call\nNot included in service call\n\n# Payment type/source\nOne time (Payment Central)\nPay plan (Pay Plan Maintenance Screen)\nScan/Import Screen"
2017-09-11 13:54:47 +00:00
},
2017-09-11 17:40:43 +00:00
methods: {
pluralize: (noun, count) =>
`${noun}${count == 1 ? '' : 's'}`
},
computed: {
combos() {
return cartesian(
this.n.trim().split('\n\n')
.map(e =>
e.split('\n')
.map(e => e.trim())
.filter(e => e[0] !== '#')
)
2017-09-18 16:32:45 +00:00
).map(e => `${this.prefix}${e.join(this.delimiter)}${this.suffix}`)
2017-09-11 17:40:43 +00:00
}
}
2017-09-11 13:19:52 +00:00
})
</script>
2017-09-08 17:57:29 +00:00
</body>
</html>