-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/2348 test cases definition report with grouping (#196)
* testcases definition report with grouping * add generation of testcaseDefinitionReport to cli
- Loading branch information
1 parent
435a689
commit 142ca8f
Showing
12 changed files
with
314 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 119 additions & 67 deletions
186
spec_files/reports/templates/testcase_definition/table_view.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,133 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
#customers { | ||
font-family: Arial, Helvetica, sans-serif; | ||
border-collapse: collapse; | ||
width: 100%; | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
} | ||
<head> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<style> | ||
#customers { | ||
font-family: Arial, Helvetica, sans-serif; | ||
border-collapse: collapse; | ||
width: 100%; | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
} | ||
|
||
#customers td, #customers th { | ||
border: 1px solid #ddd; | ||
padding: 14px; | ||
} | ||
#customers .tableRow:nth-child(even){ | ||
background-color: #f9f9f9; | ||
} | ||
|
||
#customers tr:nth-child(even){background-color: #f9f9f9;} | ||
#customers .tableRow:hover { | ||
background-color: #eee; | ||
} | ||
|
||
#customers tr:hover {background-color: #eee;} | ||
#customers .tableHeader { | ||
padding: 16px; | ||
text-align: left; | ||
background-color: #EEE; | ||
color: black; | ||
} | ||
|
||
#customers th { | ||
padding-top: 16px; | ||
padding-bottom: 16px; | ||
text-align: left; | ||
background-color: #EEE; | ||
color: black; | ||
} | ||
#customers .tableHeaderBlue { | ||
background-color: #E0EfFE; | ||
color: black; | ||
} | ||
#customers .tableHeaderYellow { | ||
background-color: #FFFDDD; | ||
color: black; | ||
} | ||
|
||
#customers .headerBlue th { | ||
background-color: #E0EfFE; | ||
color: black; | ||
/* padding-left: 25px; */ | ||
#customers .tableHeaderYellow .collapsed { | ||
transform: rotate(90deg); | ||
} | ||
|
||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
#customers .headerYellow th { | ||
background-color: #FFFDDD; | ||
color: black; | ||
/* padding-left: 35px; */ | ||
} | ||
<div id="customers" class="container-fluid border border-dark" > | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<div class="row border border-white"> | ||
<div class="col border border-white"> | ||
<div class="btn-group float-right" role="group" aria-label="Button Group"> | ||
<button id="openAll" class="btn btn-outline-success btn-sm float-right">Expand Folders</button> | ||
<button id="closeAll" class="btn btn-outline-success btn-sm float-right">Collapse Folders</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row border border-white"> | ||
<div class="col border border-white"> | ||
<div class="row tableRow border border-secondary"> | ||
<div class="col-2 tableHeader border border-secondary">Testcase</div> | ||
<div class="col-2 tableHeader border border-secondary">Request Description</div> | ||
<div class="col-3 tableHeader border border-secondary">Test Scenario</div> | ||
<div class="col-5 tableHeader border border-secondary">Expected Result</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{#each test_cases}} | ||
<div class="row border border-white"> | ||
<div class="col border border-white"> | ||
<div class="row tableRow border border-secondary" > | ||
<div class="col-sm tableHeaderBlue border border-secondary" >{{fileInfo.path}} | ||
{{#if fileInfo.labels}} | ||
- (Labels: {{fileInfo.labels}}) | ||
{{/if}} | ||
</div> | ||
</div> | ||
<div class="row tableRow border border-secondary"> | ||
<div class="col tableHeaderYellow border border-secondary"> | ||
<a data-toggle="collapse" href="#" data-target="#folder-collapse-{{id}}" aria-expanded="false" aria-controls="collapse" id="folder-{{id}}" class="collapsed z-block"> | ||
{{name}} | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<div id="folder-collapse-{{id}}" class="collapse row border border-secondary" aria-labelledby="folder-{{id}}"> | ||
<div class="col border border-secondary"> | ||
{{#each requests}} | ||
<div class="row tableRow border border-secondary"> | ||
<div class="col-2 tableData border border-secondary">{{#if @first}}{{../meta.info}}{{/if}} </div> | ||
<div class="col-2 tableData border border-secondary">{{meta.info}}</div> | ||
<div class="col-3 tableData border border-secondary">{{description}} <br />({{method}} {{operationPath}})</div> | ||
<div class="col-5 tableData border border-secondary"> | ||
{{#if tests.assertions}} | ||
<ul> | ||
{{#each tests.assertions}} | ||
<li>{{description}}</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
</div> | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{/each}} | ||
|
||
<table id="customers"> | ||
<tr> | ||
<th>Testcase</th> | ||
<th>Request Description</th> | ||
<th>Test Scenario</th> | ||
<th>Expected Result</th> | ||
</tr> | ||
<tr class='headerBlue'> | ||
<th colspan='100%'>Folder Name > File Name</th> | ||
</tr> | ||
{{#each test_cases}} | ||
<tr class='headerYellow'> | ||
<th colspan='100%'>{{name}}</th> | ||
</tr> | ||
{{#each requests}} | ||
<tr> | ||
<td>{{#if @first}}{{../meta.info}}{{/if}} </td> | ||
<td>{{meta.info}}</td> | ||
<td>{{description}} <br />({{method}} {{operationPath}})</td> | ||
<td> | ||
{{#if tests.assertions}} | ||
<ul> | ||
{{#each tests.assertions}} | ||
<li>{{description}}</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
{{/each}} | ||
</div> | ||
|
||
</table> | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | ||
|
||
</body> | ||
</body> | ||
</html> | ||
|
||
<script> | ||
$('#openAll').on('click', function(e) { | ||
{{#each test_cases}} | ||
$('#folder-{{id}}').removeClass('collapsed') | ||
$('#folder-collapse-{{id}}').addClass('show') | ||
{{/each}} | ||
}) | ||
</script> | ||
|
||
<script> | ||
$('#closeAll').on('click', function(e) { | ||
{{#each test_cases}} | ||
$('#folder-{{id}}').addClass('collapsed') | ||
$('#folder-collapse-{{id}}').removeClass('show') | ||
{{/each}} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/***** | ||
License | ||
-------------- | ||
Copyright © 2017 Bill & Melinda Gates Foundation | ||
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
Contributors | ||
-------------- | ||
This is the official list of the Mojaloop project contributors for this file. | ||
Names of the original copyright holders (individuals or organizations) | ||
should be listed with a '*' in the first column. People who have | ||
contributed from an organization can be listed under the organization | ||
that actually holds the copyright for their contributions (see the | ||
Gates Foundation organization for an example). Those individuals should have | ||
their names indented and be marked with a '-'. Email address can be added | ||
optionally within square brackets <email>. | ||
* Gates Foundation | ||
* ModusBox | ||
* Georgi Logodazhki <georgi.logodazhki@modusbox.com> (Original Author) | ||
-------------- | ||
******/ | ||
|
||
const report = require('../utils/report') | ||
const fStr = require('node-strings') | ||
const utils = require('../../lib/utils.js') | ||
const objectStore = require('../objectStore') | ||
const templateGenerator = require('../utils/templateGenerator') | ||
|
||
const download = async () => { | ||
const config = objectStore.get('config') | ||
try { | ||
const inputFiles = config.inputFiles.split(',') | ||
const selectedLabels = config.labels ? config.labels.split(',') : null | ||
const template = await templateGenerator.generateTemplate(inputFiles, selectedLabels) | ||
if (config.environmentFile) { | ||
const environmentFileContent = await utils.readFileAsync(config.environmentFile, 'utf8') | ||
template.inputValues = JSON.parse(environmentFileContent).inputValues | ||
} | ||
await report.testcaseDefinition(template) | ||
console.log(fStr.green('Terminate with exit code 0')) | ||
process.exit(0) | ||
} catch (err) { | ||
console.log(err) | ||
console.log(fStr.red('Terminate with exit code 1')) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
module.exports = { | ||
download | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.