testgen/index.html

113 lines
4.5 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-10-25 19:36:45 +00:00
<br>
<hr>
2017-09-11 14:57:57 +00:00
<p v-cloak><strong>{{ combos.length }}</strong> {{ pluralize("test case", combos.length) }}</p>
2017-10-25 19:36:45 +00:00
<form action="export.php" method="POST">
<textarea v-cloak name="test_cases" style="font-family:monospace; resize:vertical;" rows="30" class="textarea">{{ combos.join('\n') }}</textarea>
<button type="submit">export to excel template</button>
</form>
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-09-18 16:32:45 +00:00
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
2017-10-03 16:12:45 +00:00
<script>
var cartesian = function cartesian(arr) {
return arr.reduce(function (a, b) {
return a.map(function (x) {
return b.map(function (y) {
return x.concat(y);
});
}).reduce(function (a, b) {
return a.concat(b);
}, []);
}, [[]]);
};
var vm = new Vue({
2017-09-11 13:19:52 +00:00
el: '#app',
2017-09-11 13:54:47 +00:00
data: {
2017-10-25 19:36:45 +00:00
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: {
2017-10-03 16:12:45 +00:00
pluralize: function pluralize(noun, count) {
return "" + noun + (count == 1 ? '' : 's');
}
2017-09-11 17:40:43 +00:00
},
computed: {
2017-10-03 16:12:45 +00:00
combos: function combos() {
var _this = this;
return cartesian(this.n.trim().split('\n\n').map(function (e) {
return e.split('\n').map(function (e) {
return e.trim();
}).filter(function (e) {
return e[0] !== '#';
});
})).map(function (e) {
return "" + _this.prefix + e.join(_this.delimiter) + _this.suffix;
});
2017-09-11 17:40:43 +00:00
}
}
2017-10-03 16:12:45 +00:00
});
2017-09-11 13:19:52 +00:00
</script>
2017-09-08 17:57:29 +00:00
</body>
</html>