113 lines
4.5 KiB
HTML
Executable File
113 lines
4.5 KiB
HTML
Executable File
<!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" />
|
|
<title>Multivar TestGen</title>
|
|
<style>[v-cloak] { display: none }</style>
|
|
</head>
|
|
|
|
<body>
|
|
<section class="section">
|
|
<div class="container" id="app">
|
|
|
|
<h1 class="title">Multivariable TestGenerator</h1>
|
|
<p class="subtitle">Enter each set of variables separated by an empty line. Paste the output into a Jira test case!</p>
|
|
|
|
<hr>
|
|
<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>
|
|
<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>
|
|
|
|
<div class="field">
|
|
<label class="label">Variables</label>
|
|
<em>Lines starting with <code>#</code> are comments.</em>
|
|
<div class="control"><textarea style="font-family:monospace; resize:vertical;" rows="20" v-model="n" class="textarea"></textarea></div>
|
|
</div>
|
|
|
|
<br>
|
|
<hr>
|
|
|
|
<p v-cloak><strong>{{ combos.length }}</strong> {{ pluralize("test case", combos.length) }}</p>
|
|
|
|
<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>
|
|
|
|
</div>
|
|
</section>
|
|
|
|
<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>
|
|
|
|
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
|
|
<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({
|
|
el: '#app',
|
|
data: {
|
|
prefix: "",
|
|
delimiter: " ",
|
|
suffix: "",
|
|
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"
|
|
},
|
|
methods: {
|
|
pluralize: function pluralize(noun, count) {
|
|
return "" + noun + (count == 1 ? '' : 's');
|
|
}
|
|
},
|
|
computed: {
|
|
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;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|