Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m48s
Run linting on the backend code / Build (pull_request) Successful in 27s
Run testing on the backend code / Build (pull_request) Failing after 4m30s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 22s
1094 lines
54 KiB
HTML
1094 lines
54 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<title id="head-title">Backend Testing Report</title>
|
|
<style type="text/css">body {
|
|
font-family: Helvetica, Arial, sans-serif;
|
|
font-size: 12px;
|
|
/* do not increase min-width as some may use split screens */
|
|
min-width: 800px;
|
|
color: #999;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 24px;
|
|
color: black;
|
|
}
|
|
|
|
h2 {
|
|
font-size: 16px;
|
|
color: black;
|
|
}
|
|
|
|
p {
|
|
color: black;
|
|
}
|
|
|
|
a {
|
|
color: #999;
|
|
}
|
|
|
|
table {
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
/******************************
|
|
* SUMMARY INFORMATION
|
|
******************************/
|
|
#environment td {
|
|
padding: 5px;
|
|
border: 1px solid #e6e6e6;
|
|
vertical-align: top;
|
|
}
|
|
#environment tr:nth-child(odd) {
|
|
background-color: #f6f6f6;
|
|
}
|
|
#environment ul {
|
|
margin: 0;
|
|
padding: 0 20px;
|
|
}
|
|
|
|
/******************************
|
|
* TEST RESULT COLORS
|
|
******************************/
|
|
span.passed,
|
|
.passed .col-result {
|
|
color: green;
|
|
}
|
|
|
|
span.skipped,
|
|
span.xfailed,
|
|
span.rerun,
|
|
.skipped .col-result,
|
|
.xfailed .col-result,
|
|
.rerun .col-result {
|
|
color: orange;
|
|
}
|
|
|
|
span.error,
|
|
span.failed,
|
|
span.xpassed,
|
|
.error .col-result,
|
|
.failed .col-result,
|
|
.xpassed .col-result {
|
|
color: red;
|
|
}
|
|
|
|
.col-links__extra {
|
|
margin-right: 3px;
|
|
}
|
|
|
|
/******************************
|
|
* RESULTS TABLE
|
|
*
|
|
* 1. Table Layout
|
|
* 2. Extra
|
|
* 3. Sorting items
|
|
*
|
|
******************************/
|
|
/*------------------
|
|
* 1. Table Layout
|
|
*------------------*/
|
|
#results-table {
|
|
border: 1px solid #e6e6e6;
|
|
color: #999;
|
|
font-size: 12px;
|
|
width: 100%;
|
|
}
|
|
#results-table th,
|
|
#results-table td {
|
|
padding: 5px;
|
|
border: 1px solid #e6e6e6;
|
|
text-align: left;
|
|
}
|
|
#results-table th {
|
|
font-weight: bold;
|
|
}
|
|
|
|
/*------------------
|
|
* 2. Extra
|
|
*------------------*/
|
|
.logwrapper {
|
|
max-height: 230px;
|
|
overflow-y: scroll;
|
|
background-color: #e6e6e6;
|
|
}
|
|
.logwrapper.expanded {
|
|
max-height: none;
|
|
}
|
|
.logwrapper.expanded .logexpander:after {
|
|
content: "collapse [-]";
|
|
}
|
|
.logwrapper .logexpander {
|
|
z-index: 1;
|
|
position: sticky;
|
|
top: 10px;
|
|
width: max-content;
|
|
border: 1px solid;
|
|
border-radius: 3px;
|
|
padding: 5px 7px;
|
|
margin: 10px 0 10px calc(100% - 80px);
|
|
cursor: pointer;
|
|
background-color: #e6e6e6;
|
|
}
|
|
.logwrapper .logexpander:after {
|
|
content: "expand [+]";
|
|
}
|
|
.logwrapper .logexpander:hover {
|
|
color: #000;
|
|
border-color: #000;
|
|
}
|
|
.logwrapper .log {
|
|
min-height: 40px;
|
|
position: relative;
|
|
top: -50px;
|
|
height: calc(100% + 50px);
|
|
border: 1px solid #e6e6e6;
|
|
color: black;
|
|
display: block;
|
|
font-family: "Courier New", Courier, monospace;
|
|
padding: 5px;
|
|
padding-right: 80px;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
div.media {
|
|
border: 1px solid #e6e6e6;
|
|
float: right;
|
|
height: 240px;
|
|
margin: 0 5px;
|
|
overflow: hidden;
|
|
width: 320px;
|
|
}
|
|
|
|
.media-container {
|
|
display: grid;
|
|
grid-template-columns: 25px auto 25px;
|
|
align-items: center;
|
|
flex: 1 1;
|
|
overflow: hidden;
|
|
height: 200px;
|
|
}
|
|
|
|
.media-container--fullscreen {
|
|
grid-template-columns: 0px auto 0px;
|
|
}
|
|
|
|
.media-container__nav--right,
|
|
.media-container__nav--left {
|
|
text-align: center;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.media-container__viewport {
|
|
cursor: pointer;
|
|
text-align: center;
|
|
height: inherit;
|
|
}
|
|
.media-container__viewport img,
|
|
.media-container__viewport video {
|
|
object-fit: cover;
|
|
width: 100%;
|
|
max-height: 100%;
|
|
}
|
|
|
|
.media__name,
|
|
.media__counter {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-around;
|
|
flex: 0 0 25px;
|
|
align-items: center;
|
|
}
|
|
|
|
.collapsible td:not(.col-links) {
|
|
cursor: pointer;
|
|
}
|
|
.collapsible td:not(.col-links):hover::after {
|
|
color: #bbb;
|
|
font-style: italic;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.col-result {
|
|
width: 130px;
|
|
}
|
|
.col-result:hover::after {
|
|
content: " (hide details)";
|
|
}
|
|
|
|
.col-result.collapsed:hover::after {
|
|
content: " (show details)";
|
|
}
|
|
|
|
#environment-header h2:hover::after {
|
|
content: " (hide details)";
|
|
color: #bbb;
|
|
font-style: italic;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
}
|
|
|
|
#environment-header.collapsed h2:hover::after {
|
|
content: " (show details)";
|
|
color: #bbb;
|
|
font-style: italic;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
}
|
|
|
|
/*------------------
|
|
* 3. Sorting items
|
|
*------------------*/
|
|
.sortable {
|
|
cursor: pointer;
|
|
}
|
|
.sortable.desc:after {
|
|
content: " ";
|
|
position: relative;
|
|
left: 5px;
|
|
bottom: -12.5px;
|
|
border: 10px solid #4caf50;
|
|
border-bottom: 0;
|
|
border-left-color: transparent;
|
|
border-right-color: transparent;
|
|
}
|
|
.sortable.asc:after {
|
|
content: " ";
|
|
position: relative;
|
|
left: 5px;
|
|
bottom: 12.5px;
|
|
border: 10px solid #4caf50;
|
|
border-top: 0;
|
|
border-left-color: transparent;
|
|
border-right-color: transparent;
|
|
}
|
|
|
|
.hidden, .summary__reload__button.hidden {
|
|
display: none;
|
|
}
|
|
|
|
.summary__data {
|
|
flex: 0 0 550px;
|
|
}
|
|
.summary__reload {
|
|
flex: 1 1;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
.summary__reload__button {
|
|
flex: 0 0 300px;
|
|
display: flex;
|
|
color: white;
|
|
font-weight: bold;
|
|
background-color: #4caf50;
|
|
text-align: center;
|
|
justify-content: center;
|
|
align-items: center;
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
}
|
|
.summary__reload__button:hover {
|
|
background-color: #46a049;
|
|
}
|
|
.summary__spacer {
|
|
flex: 0 0 550px;
|
|
}
|
|
|
|
.controls {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.filters,
|
|
.collapse {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.filters button,
|
|
.collapse button {
|
|
color: #999;
|
|
border: none;
|
|
background: none;
|
|
cursor: pointer;
|
|
text-decoration: underline;
|
|
}
|
|
.filters button:hover,
|
|
.collapse button:hover {
|
|
color: #ccc;
|
|
}
|
|
|
|
.filter__label {
|
|
margin-right: 10px;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
<h1 id="title">Backend Testing Report</h1>
|
|
<p>Report generated on 23-Jan-2025 at 16:22:05 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a>
|
|
v4.1.1</p>
|
|
<div id="environment-header">
|
|
<h2>Environment</h2>
|
|
</div>
|
|
<table id="environment"></table>
|
|
<!-- TEMPLATES -->
|
|
<template id="template_environment_row">
|
|
<tr>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</template>
|
|
<template id="template_results-table__body--empty">
|
|
<tbody class="results-table-row">
|
|
<tr id="not-found-message">
|
|
<td colspan="7">No results found. Check the filters.</th>
|
|
</tr>
|
|
</template>
|
|
<template id="template_results-table__tbody">
|
|
<tbody class="results-table-row">
|
|
<tr class="collapsible">
|
|
</tr>
|
|
<tr class="extras-row">
|
|
<td class="extra" colspan="7">
|
|
<div class="extraHTML"></div>
|
|
<div class="media">
|
|
<div class="media-container">
|
|
<div class="media-container__nav--left"><</div>
|
|
<div class="media-container__viewport">
|
|
<img src="" />
|
|
<video controls>
|
|
<source src="" type="video/mp4">
|
|
</video>
|
|
</div>
|
|
<div class="media-container__nav--right">></div>
|
|
</div>
|
|
<div class="media__name"></div>
|
|
<div class="media__counter"></div>
|
|
</div>
|
|
<div class="logwrapper">
|
|
<div class="logexpander"></div>
|
|
<div class="log"></div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</template>
|
|
<!-- END TEMPLATES -->
|
|
<div class="summary">
|
|
<div class="summary__data">
|
|
<h2>Summary</h2>
|
|
<div class="additional-summary prefix">
|
|
</div>
|
|
<p class="run-count">8 tests took 00:01:51.</p>
|
|
<p class="filter">(Un)check the boxes to filter the results.</p>
|
|
<div class="summary__reload">
|
|
<div class="summary__reload__button hidden" onclick="location.reload()">
|
|
<div>There are still tests running. <br />Reload this page to get the latest results!</div>
|
|
</div>
|
|
</div>
|
|
<div class="summary__spacer"></div>
|
|
<div class="controls">
|
|
<div class="filters">
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="failed" />
|
|
<span class="failed">4 Failed,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="passed" />
|
|
<span class="passed">4 Passed,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="skipped" disabled/>
|
|
<span class="skipped">0 Skipped,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="xfailed" disabled/>
|
|
<span class="xfailed">0 Expected failures,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="xpassed" disabled/>
|
|
<span class="xpassed">0 Unexpected passes,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="error" disabled/>
|
|
<span class="error">0 Errors,</span>
|
|
<input checked="true" class="filter" name="filter_checkbox" type="checkbox" data-test-result="rerun" disabled/>
|
|
<span class="rerun">0 Reruns</span>
|
|
</div>
|
|
<div class="collapse">
|
|
<button id="show_all_details">Show all details</button> / <button id="hide_all_details">Hide all details</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="additional-summary summary">
|
|
</div>
|
|
<div class="additional-summary postfix">
|
|
</div>
|
|
</div>
|
|
<table id="results-table">
|
|
<thead id="results-table-head">
|
|
<tr>
|
|
<th class="sortable" data-column-type="result">Result</th>
|
|
<th class="sortable" data-column-type="testId">Test</th>
|
|
<th>Detailed trip</th>
|
|
<th>Trip Duration</th>
|
|
<th>Target Duration</th>
|
|
<th>Execution time</th>
|
|
<th>Links</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</body>
|
|
<footer>
|
|
<div id="data-container" data-jsonblob="{"environment": {"Python": "3.12.3", "Platform": "Linux-6.8.0-51-generic-x86_64-with-glibc2.39", "Packages": {"pytest": "8.3.4", "pluggy": "1.5.0"}, "Plugins": {"html": "4.1.1", "anyio": "4.8.0", "metadata": "3.1.1"}}, "tests": {"src/tests/test_main.py::test_turckheim": [{"extras": [], "result": "Passed", "testId": "src/tests/test_main.py::test_turckheim", "resultsTableRow": ["<td class=\"col-result\">Passed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_turckheim</td>", "<td>start (0 | 0) - 4 - Square Charles Grad (47 | 5) - 3 - Porte de France (157 | 5) - 5 - finish (0 | 0) - 0</td>", "<td>22 min</td>", "<td>20 min</td>", "<td class=\"col-duration\">104 ms</td>", "<td class=\"col-links\"></td>"], "log": "------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 5 landmarks in \t: 0.004 seconds\nINFO src.main:main.py:122 Total computation time\t: 0.031 seconds\nINFO src.main:main.py:127 Generated a trip of 22 minutes with 4 landmarks in 0.035 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_bellecour": [{"extras": [], "result": "Passed", "testId": "src/tests/test_main.py::test_bellecour", "resultsTableRow": ["<td class=\"col-result\">Passed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_bellecour</td>", "<td>start (0 | 0) - 7 - Grande Synagogue de Lyon (191 | 5) - 7 - Basilique Saint-Martin d'Ainay (314 | 5) - 8 - \u00c9glise Saint-Georges (357 | 5) - 7 - Cath\u00e9drale Saint-Jean (305 | 5) - 7 - Basilique de Fourvi\u00e8re (251 | 5) - 0 - Basilique Notre-Dame de Fourvi\u00e8re (247 | 5) - 7 - Mus\u00e9es Gadagne (401 | 5) - 1 - Temple du Change (314 | 5) - 8 - \u00c9glise Saint-Nizier (272 | 5) - 12 - H\u00f4tel de l'Europe (191 | 5) - 5 - finish (0 | 0) - 0</td>", "<td>119 min</td>", "<td>120 min</td>", "<td class=\"col-duration\">00:00:08</td>", "<td class=\"col-links\"></td>"], "log": "------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 182 landmarks in \t: 0.044 seconds\nINFO src.main:main.py:122 Total computation time\t: 8.146 seconds\nINFO src.main:main.py:127 Generated a trip of 119 minutes with 12 landmarks in 8.19 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_cologne": [{"extras": [], "result": "Passed", "testId": "src/tests/test_main.py::test_cologne", "resultsTableRow": ["<td class=\"col-result\">Passed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_cologne</td>", "<td>start (0 | 0) - 4 - R\u00f6misch-Germanisches Museum (698 | 5) - 6 - Wallraf-Richartz-Museum & Foundation Corboud (490 | 5) - 5 - Gro\u00df St. Martin (512 | 5) - 11 - St. Maria Lyskirchen (512 | 5) - 4 - Deutsches Sport- und Olympiamuseum (535 | 5) - 6 - Trinitatiskirche (467 | 5) - 4 - St. Maria im Kapitol (490 | 5) - 6 - Duftmuseum im Farina-Haus (539 | 5) - 5 - Minoritenkirche (379 | 5) - 6 - AntoniterCityKirche (423 | 5) - 4 - St. C\u00e4cilien (423 | 5) - 4 - Gesundheitsamt K\u00f6ln (364 | 5) - 5 - St. Aposteln (639 | 5) - 2 - Kreissparkasse K\u00f6ln (539 | 5) - 5 - Schauspielhaus K\u00f6ln (369 | 5) - 1 - Oper der Stadt K\u00f6ln (465 | 5) - 6 - Museum f\u00fcr Angewandte Kunst (514 | 5) - 5 - K\u00f6lner Dom (1141 | 5) - 3 - Excelsior Hotel Ernst (614 | 5) - 2 - St.Andreas (489 | 5) - 3 - St. Mari\u00e4 Himmelfahrt (401 | 5) - 2 - finish (0 | 0) - 0</td>", "<td>204 min</td>", "<td>240 min</td>", "<td class=\"col-duration\">00:00:09</td>", "<td class=\"col-links\"></td>"], "log": "------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 244 landmarks in \t: 0.068 seconds\nINFO src.main:main.py:122 Total computation time\t: 8.817 seconds\nINFO src.main:main.py:127 Generated a trip of 204 minutes with 23 landmarks in 8.885 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_strasbourg": [{"extras": [], "result": "Failed", "testId": "src/tests/test_main.py::test_strasbourg", "resultsTableRow": ["<td class=\"col-result\">Failed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_strasbourg</td>", "<td>start (0 | 0) - 10 - Grande \u00cele (228 | 5) - 11 - Palais du Rhin (466 | 5) - 11 - Cath\u00e9drale Notre-Dame (564 | 5) - 6 - \u00c9glise catholique Sainte-Madeleine (210 | 5) - 13 - Centre Administratif Ville et Eurom\u00e9tropole de Strasbourg (405 | 5) - 8 - Porte de l'H\u00f4pital (207 | 5) - 4 - Pont Saint-Nicolas (191 | 5) - 4 - \u00c9glise protestante Saint-Thomas (266 | 5) - 2 - Circuit \u00ab Petite France \u00bb (364 | 5) - 9 - Barrage Vauban (344 | 5) - 10 - \u00c9glise Catholique Saint-Jean-Baptiste (247 | 5) - 1 - finish (0 | 0) - 0</td>", "<td>144 min</td>", "<td>180 min</td>", "<td class=\"col-duration\">00:00:04</td>", "<td class=\"col-links\"></td>"], "log": "client = &lt;starlette.testclient.TestClient object at 0x70221d7b4740&gt;\nrequest = &lt;FixtureRequest for &lt;Function test_strasbourg&gt;&gt;\n\n def test_strasbourg(client, request) : # pylint: disable=redefined-outer-name\n &quot;&quot;&quot;\n Test n\u00b02 : Custom test in Lyon centre to ensure proper decision making in crowded area.\n \n Args:\n client:\n request:\n &quot;&quot;&quot;\n start_time = time.time() # Start timer\n duration_minutes = 180\n \n response = client.post(\n &quot;/trip/new&quot;,\n json={\n &quot;preferences&quot;: {&quot;sightseeing&quot;: {&quot;type&quot;: &quot;sightseeing&quot;, &quot;score&quot;: 5},\n &quot;nature&quot;: {&quot;type&quot;: &quot;nature&quot;, &quot;score&quot;: 5},\n &quot;shopping&quot;: {&quot;type&quot;: &quot;shopping&quot;, &quot;score&quot;: 5},\n &quot;max_time_minute&quot;: duration_minutes,\n &quot;detour_tolerance_minute&quot;: 0},\n &quot;start&quot;: [48.5846589226, 7.74078715721]\n }\n )\n result = response.json()\n landmarks = load_trip_landmarks(client, result[&#x27;first_landmark_uuid&#x27;])\n \n # Get computation time\n comp_time = time.time() - start_time\n \n # Add details to report\n log_trip_details(request, landmarks, result[&#x27;total_time&#x27;], duration_minutes)\n \n # for elem in landmarks :\n # print(elem)\n \n # checks :\n assert response.status_code == 200 # check for successful planning\n assert comp_time &lt; 30, f&quot;Computation time exceeded 30 seconds: {comp_time:.2f} seconds&quot;\n&gt; assert duration_minutes*0.8 &lt; result[&#x27;total_time&#x27;], f&quot;Trip too short: {result[&#x27;total_time&#x27;]} instead of {duration_minutes}&quot;\nE AssertionError: Trip too short: 144 instead of 180\nE assert (180 * 0.8) &lt; 144\n\nsrc/tests/test_main.py:180: AssertionError\n\n------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 118 landmarks in \t: 0.03 seconds\nINFO src.main:main.py:122 Total computation time\t: 4.096 seconds\nINFO src.main:main.py:127 Generated a trip of 144 minutes with 13 landmarks in 4.126 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_zurich": [{"extras": [], "result": "Failed", "testId": "src/tests/test_main.py::test_zurich", "resultsTableRow": ["<td class=\"col-result\">Failed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_zurich</td>", "<td>start (0 | 0) - 3 - Schweizerisches Landesmuseum (336 | 5) - 7 - Globus (325 | 30) - 10 - St. Peter (379 | 5) - 3 - Fraum\u00fcnster (467 | 5) - 4 - Grossm\u00fcnster (425 | 5) - 9 - Friedenskirche (207 | 5) - 10 - Liebfrauenkirche (247 | 5) - 6 - Russisch-Orthodoxe Auferstehungskirche (325 | 5) - 13 - finish (0 | 0) - 0</td>", "<td>130 min</td>", "<td>180 min</td>", "<td class=\"col-duration\">00:00:16</td>", "<td class=\"col-links\"></td>"], "log": "client = &lt;starlette.testclient.TestClient object at 0x70221d7b4740&gt;, request = &lt;FixtureRequest for &lt;Function test_zurich&gt;&gt;\n\n def test_zurich(client, request) : # pylint: disable=redefined-outer-name\n &quot;&quot;&quot;\n Test n\u00b02 : Custom test in Lyon centre to ensure proper decision making in crowded area.\n \n Args:\n client:\n request:\n &quot;&quot;&quot;\n start_time = time.time() # Start timer\n duration_minutes = 180\n \n response = client.post(\n &quot;/trip/new&quot;,\n json={\n &quot;preferences&quot;: {&quot;sightseeing&quot;: {&quot;type&quot;: &quot;sightseeing&quot;, &quot;score&quot;: 5},\n &quot;nature&quot;: {&quot;type&quot;: &quot;nature&quot;, &quot;score&quot;: 5},\n &quot;shopping&quot;: {&quot;type&quot;: &quot;shopping&quot;, &quot;score&quot;: 5},\n &quot;max_time_minute&quot;: duration_minutes,\n &quot;detour_tolerance_minute&quot;: 0},\n &quot;start&quot;: [47.377884227, 8.5395114066]\n }\n )\n result = response.json()\n landmarks = load_trip_landmarks(client, result[&#x27;first_landmark_uuid&#x27;])\n \n # Get computation time\n comp_time = time.time() - start_time\n \n # Add details to report\n log_trip_details(request, landmarks, result[&#x27;total_time&#x27;], duration_minutes)\n \n # for elem in landmarks :\n # print(elem)\n \n # checks :\n assert response.status_code == 200 # check for successful planning\n assert comp_time &lt; 30, f&quot;Computation time exceeded 30 seconds: {comp_time:.2f} seconds&quot;\n&gt; assert duration_minutes*0.8 &lt; result[&#x27;total_time&#x27;], f&quot;Trip too short: {result[&#x27;total_time&#x27;]} instead of {duration_minutes}&quot;\nE AssertionError: Trip too short: 130 instead of 180\nE assert (180 * 0.8) &lt; 130\n\nsrc/tests/test_main.py:221: AssertionError\n\n------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 133 landmarks in \t: 0.027 seconds\nINFO src.main:main.py:122 Total computation time\t: 16.137 seconds\nINFO src.main:main.py:127 Generated a trip of 130 minutes with 10 landmarks in 16.164 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_paris": [{"extras": [], "result": "Failed", "testId": "src/tests/test_main.py::test_paris", "resultsTableRow": ["<td class=\"col-result\">Failed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_paris</td>", "<td>start (0 | 0) - 5 - \u00c9glise Saint-Leu - Saint-Gilles (423 | 5) - 19 - Mus\u00e9e Carnavalet (490 | 5) - 14 - Centre Georges Pompidou (865 | 5) - 3 - \u00c9glise Saint-Merri (466 | 5) - 3 - Tour Saint-Jacques (614 | 5) - 10 - Cath\u00e9drale Notre-Dame de Paris (1138 | 5) - 8 - Sainte-Chapelle (1138 | 5) - 1 - Palais de Justice de Paris (467 | 5) - 9 - \u00c9glise Saint-Germain l'Auxerrois (512 | 5) - 6 - La Seine (447 | 5) - 5 - Pyramide du Louvre (490 | 5) - 12 - Mus\u00e9e d'Orsay (890 | 5) - 12 - Mus\u00e9e du Louvre (698 | 5) - 5 - Temple de l'Oratoire du Louvre (651 | 5) - 4 - Bourse de Commerce \u2014 Pinault Collection (627 | 5) - 2 - Jardin Nelson Mandela (367 | 5) - 3 - finish (0 | 0) - 0</td>", "<td>201 min</td>", "<td>300 min</td>", "<td class=\"col-duration\">00:01:12</td>", "<td class=\"col-links\"></td>"], "log": "client = &lt;starlette.testclient.TestClient object at 0x70221d7b4740&gt;, request = &lt;FixtureRequest for &lt;Function test_paris&gt;&gt;\n\n def test_paris(client, request) : # pylint: disable=redefined-outer-name\n &quot;&quot;&quot;\n Test n\u00b02 : Custom test in Paris (les Halles) centre to ensure proper decision making in crowded area.\n \n Args:\n client:\n request:\n &quot;&quot;&quot;\n start_time = time.time() # Start timer\n duration_minutes = 300\n \n response = client.post(\n &quot;/trip/new&quot;,\n json={\n &quot;preferences&quot;: {&quot;sightseeing&quot;: {&quot;type&quot;: &quot;sightseeing&quot;, &quot;score&quot;: 5},\n &quot;nature&quot;: {&quot;type&quot;: &quot;nature&quot;, &quot;score&quot;: 5},\n &quot;shopping&quot;: {&quot;type&quot;: &quot;shopping&quot;, &quot;score&quot;: 5},\n &quot;max_time_minute&quot;: duration_minutes,\n &quot;detour_tolerance_minute&quot;: 0},\n &quot;start&quot;: [48.86248803298562, 2.346451131285925]\n }\n )\n result = response.json()\n landmarks = load_trip_landmarks(client, result[&#x27;first_landmark_uuid&#x27;])\n \n # Get computation time\n comp_time = time.time() - start_time\n \n # Add details to report\n log_trip_details(request, landmarks, result[&#x27;total_time&#x27;], duration_minutes)\n \n # for elem in landmarks :\n # print(elem)\n \n # checks :\n assert response.status_code == 200 # check for successful planning\n&gt; assert comp_time &lt; 30, f&quot;Computation time exceeded 30 seconds: {comp_time:.2f} seconds&quot;\nE AssertionError: Computation time exceeded 30 seconds: 72.07 seconds\nE assert 72.07316541671753 &lt; 30\n\nsrc/tests/test_main.py:261: AssertionError\n\n------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 363 landmarks in \t: 0.134 seconds\nINFO src.main:main.py:122 Total computation time\t: 71.935 seconds\nINFO src.main:main.py:127 Generated a trip of 201 minutes with 18 landmarks in 72.068 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_new_york": [{"extras": [], "result": "Failed", "testId": "src/tests/test_main.py::test_new_york", "resultsTableRow": ["<td class=\"col-result\">Failed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_new_york</td>", "<td>start (0 | 0) - 6 - St. George's Church (344 | 5) - 7 - Grace Church (401 | 5) - 7 - Union Square Park (482 | 5) - 10 - Flatiron Building (604 | 5) - 5 - Cathedral of St. Sava (401 | 5) - 4 - Madison Square Park (482 | 5) - 7 - Calvary Church (357 | 5) - 17 - Saint Mark's in-the-Bowery (490 | 5) - 7 - Immaculate Conception Church (423 | 5) - 6 - St. Nicholas of Myra Orthodox Church (423 | 5) - 12 - Cathedral of the Holy Virgin Protection (344 | 5) - 9 - Saint Patrick's Old Cathedral (379 | 5) - 9 - Capitale (627 | 5) - 10 - Columbus Park (482 | 5) - 3 - Thomas Paine Park (334 | 5) - 3 - Collect Pond Park (412 | 5) - 10 - Tribeca Park (386 | 5) - 4 - Albert Capsouto Park (339 | 5) - 1 - Duarte Square (512 | 5) - 11 - St. Anthony of Padua Church (379 | 5) - 7 - Judson Memorial Church (401 | 5) - 13 - finish (0 | 0) - 0</td>", "<td>273 min</td>", "<td>600 min</td>", "<td class=\"col-duration\">782 ms</td>", "<td class=\"col-links\"></td>"], "log": "client = &lt;starlette.testclient.TestClient object at 0x70221d7b4740&gt;\nrequest = &lt;FixtureRequest for &lt;Function test_new_york&gt;&gt;\n\n def test_new_york(client, request) : # pylint: disable=redefined-outer-name\n &quot;&quot;&quot;\n Test n\u00b02 : Custom test in New York (les Halles) centre to ensure proper decision making in crowded area.\n \n Args:\n client:\n request:\n &quot;&quot;&quot;\n start_time = time.time() # Start timer\n duration_minutes = 600\n \n response = client.post(\n &quot;/trip/new&quot;,\n json={\n &quot;preferences&quot;: {&quot;sightseeing&quot;: {&quot;type&quot;: &quot;sightseeing&quot;, &quot;score&quot;: 5},\n &quot;nature&quot;: {&quot;type&quot;: &quot;nature&quot;, &quot;score&quot;: 5},\n &quot;shopping&quot;: {&quot;type&quot;: &quot;shopping&quot;, &quot;score&quot;: 5},\n &quot;max_time_minute&quot;: duration_minutes,\n &quot;detour_tolerance_minute&quot;: 0},\n &quot;start&quot;: [40.72592726802, -73.9920434795]\n }\n )\n result = response.json()\n landmarks = load_trip_landmarks(client, result[&#x27;first_landmark_uuid&#x27;])\n \n # Get computation time\n comp_time = time.time() - start_time\n \n # Add details to report\n log_trip_details(request, landmarks, result[&#x27;total_time&#x27;], duration_minutes)\n \n # for elem in landmarks :\n # print(elem)\n \n # checks :\n assert response.status_code == 200 # check for successful planning\n assert comp_time &lt; 30, f&quot;Computation time exceeded 30 seconds: {comp_time:.2f} seconds&quot;\n&gt; assert duration_minutes*0.8 &lt; result[&#x27;total_time&#x27;], f&quot;Trip too short: {result[&#x27;total_time&#x27;]} instead of {duration_minutes}&quot;\nE AssertionError: Trip too short: 273 instead of 600\nE assert (600 * 0.8) &lt; 273\n\nsrc/tests/test_main.py:303: AssertionError\n\n------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 211 landmarks in \t: 0.038 seconds\nINFO src.main:main.py:122 Total computation time\t: 0.739 seconds\nINFO src.main:main.py:127 Generated a trip of 273 minutes with 23 landmarks in 0.777 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}], "src/tests/test_main.py::test_shopping": [{"extras": [], "result": "Passed", "testId": "src/tests/test_main.py::test_shopping", "resultsTableRow": ["<td class=\"col-result\">Passed</td>", "<td class=\"col-testId\">src/tests/test_main.py::test_shopping</td>", "<td>start (0 | 0) - 5 - Grand H\u00f4tel-Dieu (423 | 30) - 8 - Shopping Area (538 | 40) - 4 - Grand Bazar (93 | 30) - 20 - Halles de Lyon Paul Bocuse (210 | 30) - 8 - Westfield La Part-Dieu (423 | 30) - 32 - finish (0 | 0) - 0</td>", "<td>237 min</td>", "<td>240 min</td>", "<td class=\"col-duration\">424 ms</td>", "<td class=\"col-links\"></td>"], "log": "----------------------------- Captured stdout call -----------------------------\nLandmark(start): [start @(45.7576485, 4.8330241), score=0, time_to_next=5]\nLandmark(shopping): [Grand H\u00f4tel-Dieu @(45.7586955, 4.8364597), score=423, time_to_next=8]\nLandmark(shopping): [Shopping Area @(np.float64(45.76223053940519), np.float64(4.833794685873603)), score=538, time_to_next=4]\nLandmark(shopping): [Grand Bazar @(45.7632141, 4.8361975), score=93, time_to_next=20]\nLandmark(shopping): [Halles de Lyon Paul Bocuse @(45.7628282, 4.8505601), score=210, time_to_next=8]\nLandmark(shopping): [Westfield La Part-Dieu @(45.761331, 4.855676), score=423, time_to_next=32]\nLandmark(finish): [finish @(45.7576485, 4.8330241), score=0]\n\n------------------------------ Captured log call -------------------------------\nINFO src.main:main.py:65 No end coordinates provided. Using start=end.\nINFO src.main:main.py:97 Fetched 7 landmarks in \t: 0.01 seconds\nINFO src.main:main.py:122 Total computation time\t: 0.409 seconds\nINFO src.main:main.py:127 Generated a trip of 237 minutes with 7 landmarks in 0.419 seconds.\nINFO httpx:_client.py:1025 HTTP Request: POST http://testserver/trip/new &quot;HTTP/1.1 200 OK&quot;\n\n"}]}, "renderCollapsed": ["passed"], "initialSort": "result", "title": "Backend Testing Report"}"></div>
|
|
<script>
|
|
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
const { getCollapsedCategory, setCollapsedIds } = require('./storage.js')
|
|
|
|
class DataManager {
|
|
setManager(data) {
|
|
const collapsedCategories = [...getCollapsedCategory(data.renderCollapsed)]
|
|
const collapsedIds = []
|
|
const tests = Object.values(data.tests).flat().map((test, index) => {
|
|
const collapsed = collapsedCategories.includes(test.result.toLowerCase())
|
|
const id = `test_${index}`
|
|
if (collapsed) {
|
|
collapsedIds.push(id)
|
|
}
|
|
return {
|
|
...test,
|
|
id,
|
|
collapsed,
|
|
}
|
|
})
|
|
const dataBlob = { ...data, tests }
|
|
this.data = { ...dataBlob }
|
|
this.renderData = { ...dataBlob }
|
|
setCollapsedIds(collapsedIds)
|
|
}
|
|
|
|
get allData() {
|
|
return { ...this.data }
|
|
}
|
|
|
|
resetRender() {
|
|
this.renderData = { ...this.data }
|
|
}
|
|
|
|
setRender(data) {
|
|
this.renderData.tests = [...data]
|
|
}
|
|
|
|
toggleCollapsedItem(id) {
|
|
this.renderData.tests = this.renderData.tests.map((test) =>
|
|
test.id === id ? { ...test, collapsed: !test.collapsed } : test,
|
|
)
|
|
}
|
|
|
|
set allCollapsed(collapsed) {
|
|
this.renderData = { ...this.renderData, tests: [...this.renderData.tests.map((test) => (
|
|
{ ...test, collapsed }
|
|
))] }
|
|
}
|
|
|
|
get testSubset() {
|
|
return [...this.renderData.tests]
|
|
}
|
|
|
|
get environment() {
|
|
return this.renderData.environment
|
|
}
|
|
|
|
get initialSort() {
|
|
return this.data.initialSort
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
manager: new DataManager(),
|
|
}
|
|
|
|
},{"./storage.js":8}],2:[function(require,module,exports){
|
|
const mediaViewer = require('./mediaviewer.js')
|
|
const templateEnvRow = document.getElementById('template_environment_row')
|
|
const templateResult = document.getElementById('template_results-table__tbody')
|
|
|
|
function htmlToElements(html) {
|
|
const temp = document.createElement('template')
|
|
temp.innerHTML = html
|
|
return temp.content.childNodes
|
|
}
|
|
|
|
const find = (selector, elem) => {
|
|
if (!elem) {
|
|
elem = document
|
|
}
|
|
return elem.querySelector(selector)
|
|
}
|
|
|
|
const findAll = (selector, elem) => {
|
|
if (!elem) {
|
|
elem = document
|
|
}
|
|
return [...elem.querySelectorAll(selector)]
|
|
}
|
|
|
|
const dom = {
|
|
getStaticRow: (key, value) => {
|
|
const envRow = templateEnvRow.content.cloneNode(true)
|
|
const isObj = typeof value === 'object' && value !== null
|
|
const values = isObj ? Object.keys(value).map((k) => `${k}: ${value[k]}`) : null
|
|
|
|
const valuesElement = htmlToElements(
|
|
values ? `<ul>${values.map((val) => `<li>${val}</li>`).join('')}<ul>` : `<div>${value}</div>`)[0]
|
|
const td = findAll('td', envRow)
|
|
td[0].textContent = key
|
|
td[1].appendChild(valuesElement)
|
|
|
|
return envRow
|
|
},
|
|
getResultTBody: ({ testId, id, log, extras, resultsTableRow, tableHtml, result, collapsed }) => {
|
|
const resultBody = templateResult.content.cloneNode(true)
|
|
resultBody.querySelector('tbody').classList.add(result.toLowerCase())
|
|
resultBody.querySelector('tbody').id = testId
|
|
resultBody.querySelector('.collapsible').dataset.id = id
|
|
|
|
resultsTableRow.forEach((html) => {
|
|
const t = document.createElement('template')
|
|
t.innerHTML = html
|
|
resultBody.querySelector('.collapsible').appendChild(t.content)
|
|
})
|
|
|
|
if (log) {
|
|
// Wrap lines starting with "E" with span.error to color those lines red
|
|
const wrappedLog = log.replace(/^E.*$/gm, (match) => `<span class="error">${match}</span>`)
|
|
resultBody.querySelector('.log').innerHTML = wrappedLog
|
|
} else {
|
|
resultBody.querySelector('.log').remove()
|
|
}
|
|
|
|
if (collapsed) {
|
|
resultBody.querySelector('.collapsible > td')?.classList.add('collapsed')
|
|
resultBody.querySelector('.extras-row').classList.add('hidden')
|
|
} else {
|
|
resultBody.querySelector('.collapsible > td')?.classList.remove('collapsed')
|
|
}
|
|
|
|
const media = []
|
|
extras?.forEach(({ name, format_type, content }) => {
|
|
if (['image', 'video'].includes(format_type)) {
|
|
media.push({ path: content, name, format_type })
|
|
}
|
|
|
|
if (format_type === 'html') {
|
|
resultBody.querySelector('.extraHTML').insertAdjacentHTML('beforeend', `<div>${content}</div>`)
|
|
}
|
|
})
|
|
mediaViewer.setup(resultBody, media)
|
|
|
|
// Add custom html from the pytest_html_results_table_html hook
|
|
tableHtml?.forEach((item) => {
|
|
resultBody.querySelector('td[class="extra"]').insertAdjacentHTML('beforeend', item)
|
|
})
|
|
|
|
return resultBody
|
|
},
|
|
}
|
|
|
|
module.exports = {
|
|
dom,
|
|
htmlToElements,
|
|
find,
|
|
findAll,
|
|
}
|
|
|
|
},{"./mediaviewer.js":6}],3:[function(require,module,exports){
|
|
const { manager } = require('./datamanager.js')
|
|
const { doSort } = require('./sort.js')
|
|
const storageModule = require('./storage.js')
|
|
|
|
const getFilteredSubSet = (filter) =>
|
|
manager.allData.tests.filter(({ result }) => filter.includes(result.toLowerCase()))
|
|
|
|
const doInitFilter = () => {
|
|
const currentFilter = storageModule.getVisible()
|
|
const filteredSubset = getFilteredSubSet(currentFilter)
|
|
manager.setRender(filteredSubset)
|
|
}
|
|
|
|
const doFilter = (type, show) => {
|
|
if (show) {
|
|
storageModule.showCategory(type)
|
|
} else {
|
|
storageModule.hideCategory(type)
|
|
}
|
|
|
|
const currentFilter = storageModule.getVisible()
|
|
const filteredSubset = getFilteredSubSet(currentFilter)
|
|
manager.setRender(filteredSubset)
|
|
|
|
const sortColumn = storageModule.getSort()
|
|
doSort(sortColumn, true)
|
|
}
|
|
|
|
module.exports = {
|
|
doFilter,
|
|
doInitFilter,
|
|
}
|
|
|
|
},{"./datamanager.js":1,"./sort.js":7,"./storage.js":8}],4:[function(require,module,exports){
|
|
const { redraw, bindEvents, renderStatic } = require('./main.js')
|
|
const { doInitFilter } = require('./filter.js')
|
|
const { doInitSort } = require('./sort.js')
|
|
const { manager } = require('./datamanager.js')
|
|
const data = JSON.parse(document.getElementById('data-container').dataset.jsonblob)
|
|
|
|
function init() {
|
|
manager.setManager(data)
|
|
doInitFilter()
|
|
doInitSort()
|
|
renderStatic()
|
|
redraw()
|
|
bindEvents()
|
|
}
|
|
|
|
init()
|
|
|
|
},{"./datamanager.js":1,"./filter.js":3,"./main.js":5,"./sort.js":7}],5:[function(require,module,exports){
|
|
const { dom, find, findAll } = require('./dom.js')
|
|
const { manager } = require('./datamanager.js')
|
|
const { doSort } = require('./sort.js')
|
|
const { doFilter } = require('./filter.js')
|
|
const {
|
|
getVisible,
|
|
getCollapsedIds,
|
|
setCollapsedIds,
|
|
getSort,
|
|
getSortDirection,
|
|
possibleFilters,
|
|
} = require('./storage.js')
|
|
|
|
const removeChildren = (node) => {
|
|
while (node.firstChild) {
|
|
node.removeChild(node.firstChild)
|
|
}
|
|
}
|
|
|
|
const renderStatic = () => {
|
|
const renderEnvironmentTable = () => {
|
|
const environment = manager.environment
|
|
const rows = Object.keys(environment).map((key) => dom.getStaticRow(key, environment[key]))
|
|
const table = document.getElementById('environment')
|
|
removeChildren(table)
|
|
rows.forEach((row) => table.appendChild(row))
|
|
}
|
|
renderEnvironmentTable()
|
|
}
|
|
|
|
const addItemToggleListener = (elem) => {
|
|
elem.addEventListener('click', ({ target }) => {
|
|
const id = target.parentElement.dataset.id
|
|
manager.toggleCollapsedItem(id)
|
|
|
|
const collapsedIds = getCollapsedIds()
|
|
if (collapsedIds.includes(id)) {
|
|
const updated = collapsedIds.filter((item) => item !== id)
|
|
setCollapsedIds(updated)
|
|
} else {
|
|
collapsedIds.push(id)
|
|
setCollapsedIds(collapsedIds)
|
|
}
|
|
redraw()
|
|
})
|
|
}
|
|
|
|
const renderContent = (tests) => {
|
|
const sortAttr = getSort(manager.initialSort)
|
|
const sortAsc = JSON.parse(getSortDirection())
|
|
const rows = tests.map(dom.getResultTBody)
|
|
const table = document.getElementById('results-table')
|
|
const tableHeader = document.getElementById('results-table-head')
|
|
|
|
const newTable = document.createElement('table')
|
|
newTable.id = 'results-table'
|
|
|
|
// remove all sorting classes and set the relevant
|
|
findAll('.sortable', tableHeader).forEach((elem) => elem.classList.remove('asc', 'desc'))
|
|
tableHeader.querySelector(`.sortable[data-column-type="${sortAttr}"]`)?.classList.add(sortAsc ? 'desc' : 'asc')
|
|
newTable.appendChild(tableHeader)
|
|
|
|
if (!rows.length) {
|
|
const emptyTable = document.getElementById('template_results-table__body--empty').content.cloneNode(true)
|
|
newTable.appendChild(emptyTable)
|
|
} else {
|
|
rows.forEach((row) => {
|
|
if (!!row) {
|
|
findAll('.collapsible td:not(.col-links', row).forEach(addItemToggleListener)
|
|
find('.logexpander', row).addEventListener('click',
|
|
(evt) => evt.target.parentNode.classList.toggle('expanded'),
|
|
)
|
|
newTable.appendChild(row)
|
|
}
|
|
})
|
|
}
|
|
|
|
table.replaceWith(newTable)
|
|
}
|
|
|
|
const renderDerived = () => {
|
|
const currentFilter = getVisible()
|
|
possibleFilters.forEach((result) => {
|
|
const input = document.querySelector(`input[data-test-result="${result}"]`)
|
|
input.checked = currentFilter.includes(result)
|
|
})
|
|
}
|
|
|
|
const bindEvents = () => {
|
|
const filterColumn = (evt) => {
|
|
const { target: element } = evt
|
|
const { testResult } = element.dataset
|
|
|
|
doFilter(testResult, element.checked)
|
|
const collapsedIds = getCollapsedIds()
|
|
const updated = manager.renderData.tests.map((test) => {
|
|
return {
|
|
...test,
|
|
collapsed: collapsedIds.includes(test.id),
|
|
}
|
|
})
|
|
manager.setRender(updated)
|
|
redraw()
|
|
}
|
|
|
|
const header = document.getElementById('environment-header')
|
|
header.addEventListener('click', () => {
|
|
const table = document.getElementById('environment')
|
|
table.classList.toggle('hidden')
|
|
header.classList.toggle('collapsed')
|
|
})
|
|
|
|
findAll('input[name="filter_checkbox"]').forEach((elem) => {
|
|
elem.addEventListener('click', filterColumn)
|
|
})
|
|
|
|
findAll('.sortable').forEach((elem) => {
|
|
elem.addEventListener('click', (evt) => {
|
|
const { target: element } = evt
|
|
const { columnType } = element.dataset
|
|
doSort(columnType)
|
|
redraw()
|
|
})
|
|
})
|
|
|
|
document.getElementById('show_all_details').addEventListener('click', () => {
|
|
manager.allCollapsed = false
|
|
setCollapsedIds([])
|
|
redraw()
|
|
})
|
|
document.getElementById('hide_all_details').addEventListener('click', () => {
|
|
manager.allCollapsed = true
|
|
const allIds = manager.renderData.tests.map((test) => test.id)
|
|
setCollapsedIds(allIds)
|
|
redraw()
|
|
})
|
|
}
|
|
|
|
const redraw = () => {
|
|
const { testSubset } = manager
|
|
|
|
renderContent(testSubset)
|
|
renderDerived()
|
|
}
|
|
|
|
module.exports = {
|
|
redraw,
|
|
bindEvents,
|
|
renderStatic,
|
|
}
|
|
|
|
},{"./datamanager.js":1,"./dom.js":2,"./filter.js":3,"./sort.js":7,"./storage.js":8}],6:[function(require,module,exports){
|
|
class MediaViewer {
|
|
constructor(assets) {
|
|
this.assets = assets
|
|
this.index = 0
|
|
}
|
|
|
|
nextActive() {
|
|
this.index = this.index === this.assets.length - 1 ? 0 : this.index + 1
|
|
return [this.activeFile, this.index]
|
|
}
|
|
|
|
prevActive() {
|
|
this.index = this.index === 0 ? this.assets.length - 1 : this.index -1
|
|
return [this.activeFile, this.index]
|
|
}
|
|
|
|
get currentIndex() {
|
|
return this.index
|
|
}
|
|
|
|
get activeFile() {
|
|
return this.assets[this.index]
|
|
}
|
|
}
|
|
|
|
|
|
const setup = (resultBody, assets) => {
|
|
if (!assets.length) {
|
|
resultBody.querySelector('.media').classList.add('hidden')
|
|
return
|
|
}
|
|
|
|
const mediaViewer = new MediaViewer(assets)
|
|
const container = resultBody.querySelector('.media-container')
|
|
const leftArrow = resultBody.querySelector('.media-container__nav--left')
|
|
const rightArrow = resultBody.querySelector('.media-container__nav--right')
|
|
const mediaName = resultBody.querySelector('.media__name')
|
|
const counter = resultBody.querySelector('.media__counter')
|
|
const imageEl = resultBody.querySelector('img')
|
|
const sourceEl = resultBody.querySelector('source')
|
|
const videoEl = resultBody.querySelector('video')
|
|
|
|
const setImg = (media, index) => {
|
|
if (media?.format_type === 'image') {
|
|
imageEl.src = media.path
|
|
|
|
imageEl.classList.remove('hidden')
|
|
videoEl.classList.add('hidden')
|
|
} else if (media?.format_type === 'video') {
|
|
sourceEl.src = media.path
|
|
|
|
videoEl.classList.remove('hidden')
|
|
imageEl.classList.add('hidden')
|
|
}
|
|
|
|
mediaName.innerText = media?.name
|
|
counter.innerText = `${index + 1} / ${assets.length}`
|
|
}
|
|
setImg(mediaViewer.activeFile, mediaViewer.currentIndex)
|
|
|
|
const moveLeft = () => {
|
|
const [media, index] = mediaViewer.prevActive()
|
|
setImg(media, index)
|
|
}
|
|
const doRight = () => {
|
|
const [media, index] = mediaViewer.nextActive()
|
|
setImg(media, index)
|
|
}
|
|
const openImg = () => {
|
|
window.open(mediaViewer.activeFile.path, '_blank')
|
|
}
|
|
if (assets.length === 1) {
|
|
container.classList.add('media-container--fullscreen')
|
|
} else {
|
|
leftArrow.addEventListener('click', moveLeft)
|
|
rightArrow.addEventListener('click', doRight)
|
|
}
|
|
imageEl.addEventListener('click', openImg)
|
|
}
|
|
|
|
module.exports = {
|
|
setup,
|
|
}
|
|
|
|
},{}],7:[function(require,module,exports){
|
|
const { manager } = require('./datamanager.js')
|
|
const storageModule = require('./storage.js')
|
|
|
|
const genericSort = (list, key, ascending, customOrder) => {
|
|
let sorted
|
|
if (customOrder) {
|
|
sorted = list.sort((a, b) => {
|
|
const aValue = a.result.toLowerCase()
|
|
const bValue = b.result.toLowerCase()
|
|
|
|
const aIndex = customOrder.findIndex((item) => item.toLowerCase() === aValue)
|
|
const bIndex = customOrder.findIndex((item) => item.toLowerCase() === bValue)
|
|
|
|
// Compare the indices to determine the sort order
|
|
return aIndex - bIndex
|
|
})
|
|
} else {
|
|
sorted = list.sort((a, b) => a[key] === b[key] ? 0 : a[key] > b[key] ? 1 : -1)
|
|
}
|
|
|
|
if (ascending) {
|
|
sorted.reverse()
|
|
}
|
|
return sorted
|
|
}
|
|
|
|
const durationSort = (list, ascending) => {
|
|
const parseDuration = (duration) => {
|
|
if (duration.includes(':')) {
|
|
// If it's in the format "HH:mm:ss"
|
|
const [hours, minutes, seconds] = duration.split(':').map(Number)
|
|
return (hours * 3600 + minutes * 60 + seconds) * 1000
|
|
} else {
|
|
// If it's in the format "nnn ms"
|
|
return parseInt(duration)
|
|
}
|
|
}
|
|
const sorted = list.sort((a, b) => parseDuration(a['duration']) - parseDuration(b['duration']))
|
|
if (ascending) {
|
|
sorted.reverse()
|
|
}
|
|
return sorted
|
|
}
|
|
|
|
const doInitSort = () => {
|
|
const type = storageModule.getSort(manager.initialSort)
|
|
const ascending = storageModule.getSortDirection()
|
|
const list = manager.testSubset
|
|
const initialOrder = ['Error', 'Failed', 'Rerun', 'XFailed', 'XPassed', 'Skipped', 'Passed']
|
|
|
|
storageModule.setSort(type)
|
|
storageModule.setSortDirection(ascending)
|
|
|
|
if (type?.toLowerCase() === 'original') {
|
|
manager.setRender(list)
|
|
} else {
|
|
let sortedList
|
|
switch (type) {
|
|
case 'duration':
|
|
sortedList = durationSort(list, ascending)
|
|
break
|
|
case 'result':
|
|
sortedList = genericSort(list, type, ascending, initialOrder)
|
|
break
|
|
default:
|
|
sortedList = genericSort(list, type, ascending)
|
|
break
|
|
}
|
|
manager.setRender(sortedList)
|
|
}
|
|
}
|
|
|
|
const doSort = (type, skipDirection) => {
|
|
const newSortType = storageModule.getSort(manager.initialSort) !== type
|
|
const currentAsc = storageModule.getSortDirection()
|
|
let ascending
|
|
if (skipDirection) {
|
|
ascending = currentAsc
|
|
} else {
|
|
ascending = newSortType ? false : !currentAsc
|
|
}
|
|
storageModule.setSort(type)
|
|
storageModule.setSortDirection(ascending)
|
|
|
|
const list = manager.testSubset
|
|
const sortedList = type === 'duration' ? durationSort(list, ascending) : genericSort(list, type, ascending)
|
|
manager.setRender(sortedList)
|
|
}
|
|
|
|
module.exports = {
|
|
doInitSort,
|
|
doSort,
|
|
}
|
|
|
|
},{"./datamanager.js":1,"./storage.js":8}],8:[function(require,module,exports){
|
|
const possibleFilters = [
|
|
'passed',
|
|
'skipped',
|
|
'failed',
|
|
'error',
|
|
'xfailed',
|
|
'xpassed',
|
|
'rerun',
|
|
]
|
|
|
|
const getVisible = () => {
|
|
const url = new URL(window.location.href)
|
|
const settings = new URLSearchParams(url.search).get('visible')
|
|
const lower = (item) => {
|
|
const lowerItem = item.toLowerCase()
|
|
if (possibleFilters.includes(lowerItem)) {
|
|
return lowerItem
|
|
}
|
|
return null
|
|
}
|
|
return settings === null ?
|
|
possibleFilters :
|
|
[...new Set(settings?.split(',').map(lower).filter((item) => item))]
|
|
}
|
|
|
|
const hideCategory = (categoryToHide) => {
|
|
const url = new URL(window.location.href)
|
|
const visibleParams = new URLSearchParams(url.search).get('visible')
|
|
const currentVisible = visibleParams ? visibleParams.split(',') : [...possibleFilters]
|
|
const settings = [...new Set(currentVisible)].filter((f) => f !== categoryToHide).join(',')
|
|
|
|
url.searchParams.set('visible', settings)
|
|
window.history.pushState({}, null, unescape(url.href))
|
|
}
|
|
|
|
const showCategory = (categoryToShow) => {
|
|
if (typeof window === 'undefined') {
|
|
return
|
|
}
|
|
const url = new URL(window.location.href)
|
|
const currentVisible = new URLSearchParams(url.search).get('visible')?.split(',').filter(Boolean) ||
|
|
[...possibleFilters]
|
|
const settings = [...new Set([categoryToShow, ...currentVisible])]
|
|
const noFilter = possibleFilters.length === settings.length || !settings.length
|
|
|
|
noFilter ? url.searchParams.delete('visible') : url.searchParams.set('visible', settings.join(','))
|
|
window.history.pushState({}, null, unescape(url.href))
|
|
}
|
|
|
|
const getSort = (initialSort) => {
|
|
const url = new URL(window.location.href)
|
|
let sort = new URLSearchParams(url.search).get('sort')
|
|
if (!sort) {
|
|
sort = initialSort || 'result'
|
|
}
|
|
return sort
|
|
}
|
|
|
|
const setSort = (type) => {
|
|
const url = new URL(window.location.href)
|
|
url.searchParams.set('sort', type)
|
|
window.history.pushState({}, null, unescape(url.href))
|
|
}
|
|
|
|
const getCollapsedCategory = (renderCollapsed) => {
|
|
let categories
|
|
if (typeof window !== 'undefined') {
|
|
const url = new URL(window.location.href)
|
|
const collapsedItems = new URLSearchParams(url.search).get('collapsed')
|
|
switch (true) {
|
|
case !renderCollapsed && collapsedItems === null:
|
|
categories = ['passed']
|
|
break
|
|
case collapsedItems?.length === 0 || /^["']{2}$/.test(collapsedItems):
|
|
categories = []
|
|
break
|
|
case /^all$/.test(collapsedItems) || collapsedItems === null && /^all$/.test(renderCollapsed):
|
|
categories = [...possibleFilters]
|
|
break
|
|
default:
|
|
categories = collapsedItems?.split(',').map((item) => item.toLowerCase()) || renderCollapsed
|
|
break
|
|
}
|
|
} else {
|
|
categories = []
|
|
}
|
|
return categories
|
|
}
|
|
|
|
const getSortDirection = () => JSON.parse(sessionStorage.getItem('sortAsc')) || false
|
|
const setSortDirection = (ascending) => sessionStorage.setItem('sortAsc', ascending)
|
|
|
|
const getCollapsedIds = () => JSON.parse(sessionStorage.getItem('collapsedIds')) || []
|
|
const setCollapsedIds = (list) => sessionStorage.setItem('collapsedIds', JSON.stringify(list))
|
|
|
|
module.exports = {
|
|
getVisible,
|
|
hideCategory,
|
|
showCategory,
|
|
getCollapsedIds,
|
|
setCollapsedIds,
|
|
getSort,
|
|
setSort,
|
|
getSortDirection,
|
|
setSortDirection,
|
|
getCollapsedCategory,
|
|
possibleFilters,
|
|
}
|
|
|
|
},{}]},{},[4]);
|
|
</script>
|
|
</footer>
|
|
</html> |