Skip to content

Commit

Permalink
[Site] update results path based on recent updates for concurrency (#708
Browse files Browse the repository at this point in the history
)

* [Site] handle updated paths due to concurrent runs

Signed-off-by: Kawika Avilla <[email protected]>

* add gif

Signed-off-by: Kawika Avilla <[email protected]>

---------

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Co-authored-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla and Kawika Avilla authored Jun 2, 2023
1 parent 0c474de commit aadc599
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 27 deletions.
Binary file added site/assets/plugin_test_results_help.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

<body onload="setDefaultValues()">
<div class="topNav">
<span>OpenSearch Dashboards Test Results Explorer</span>
<img src="https://opensearch.org/assets/brand/SVG/Logo/opensearch_dashboards_logo_darkmode.svg"/>
<span>Functional Test Results Explorer</span>
<a href="https://github.com/opensearch-project/opensearch-dashboards-functional-test">
Github
</a>
Expand Down Expand Up @@ -96,11 +97,15 @@
<table id="advancedInputsTable">
<tr>
<th>Test Job Name</th>
<th>Legacy Tests Results</th>
</tr>
<tr>
<td>
<input style="width:50vw" type="text" id="testJobName" value="integ-test-opensearch-dashboards">
</td>
<td id="legacyTd">
<input type="checkbox" id="legacyResults">
</td>
</tr>
</table>
<button id="submitButton" onclick="getTestResults()">Submit</button>
Expand Down
102 changes: 79 additions & 23 deletions site/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
*/

const defaults = {
version: '2.5.0',
buildNumber: '5367',
testNumber: '2993',
version: '2.8.0',
buildNumber: '6177',
testNumber: '3616',
testJobName: 'integ-test-opensearch-dashboards',
platform: 'linux',
arch: 'x64',
type: 'tar',
withSecurity: false,
advancedConfig: false,
showLegacyTestResults: false,
};

const plugins = {
Expand Down Expand Up @@ -155,17 +157,6 @@ function getTestResults() {
const arch = document.getElementById('arch').value;
const type = document.getElementById('type').value;
const securityEnabled = document.getElementById('security').checked;
const testResultsUrl =
'https://ci.opensearch.org/ci/dbc/' +
`${testJobName}/` +
`${version}/` +
`${buildNumber}/` +
`${platform}/` +
`${arch}/` +
`${type}/` +
`test-results/${testNumber}/integ-test/functionalTestDashboards/` +
`${securityEnabled ? 'with-security' : 'without-security'}/` +
'test-results/stdout.txt';

document.getElementById('testResultsLinksDiv').style.display = 'block';

Expand All @@ -186,10 +177,6 @@ function getTestResults() {
resultPageLink.textContent = resultPageUrl;
resultPageLink.href = resultPageUrl;

var testResultsLink = document.getElementById('testResultLink');
testResultsLink.textContent = testResultsUrl;
testResultsLink.href = testResultsUrl;

const osdUrl =
'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/' +
`${version}/` +
Expand Down Expand Up @@ -238,6 +225,27 @@ function getTestResults() {
jenkinsLink.textContent = jenkinsUrl;
jenkinsLink.href = jenkinsUrl;

if (!enableLegacyTestsResults()) {
hideLegacyTestsResults();
return;
}

const testResultsUrl =
'https://ci.opensearch.org/ci/dbc/' +
`${testJobName}/` +
`${version}/` +
`${buildNumber}/` +
`${platform}/` +
`${arch}/` +
`${type}/` +
`test-results/${testNumber}/integ-test/functionalTestDashboards/` +
`${securityEnabled ? 'with-security' : 'without-security'}/` +
'test-results/stdout.txt';

var testResultsLink = document.getElementById('testResultLink');
testResultsLink.textContent = testResultsUrl;
testResultsLink.href = testResultsUrl;

document.getElementById('testResultsDiv').style.display = 'block';
document.getElementById('testResults').src =
decodeURIComponent(testResultsUrl);
Expand All @@ -249,6 +257,17 @@ function enableAdvancedConfig() {
document.getElementById('advancedConfig').checked ? 'block' : 'none';
}

function enableLegacyTestsResults() {
return document.getElementById('legacyResults').checked;
}

function hideLegacyTestsResults() {
document.getElementById('testResultsDiv').style.display = 'none';
var testResultsLink = document.getElementById('testResultLink');
testResultsLink.textContent = 'How to view test results for plugins';
testResultsLink.href = 'assets/plugin_test_results_help.gif';
}

// eslint-disable-next-line no-unused-vars
function getPluginLinks(plugin) {
document.getElementById('pluginLinksList').innerHTML = '';
Expand Down Expand Up @@ -283,6 +302,29 @@ function getPluginLinks(plugin) {
githubManifestLink.href = `https://github.com/opensearch-project/opensearch-build/blob/main/manifests/${version}/opensearch-dashboards-${version}.yml`;
document.getElementById('githubManifestLink').appendChild(githubManifestLink);

if (!enableLegacyTestsResults()) {
const testResultsUrl =
'https://ci.opensearch.org/ci/dbc/' +
`${testJobName}/` +
`${version}/` +
`${buildNumber}/` +
`${platform}/` +
`${arch}/` +
`${type}/` +
`test-results/${testNumber}/integ-test/` +
`${pluginObject.name}/` +
`${securityEnabled ? 'with-security' : 'without-security'}/` +
'stdout.txt';

var pluginTestResultLink = document.createElement('a');
pluginTestResultLink.textContent = testResultsUrl;
pluginTestResultLink.href = testResultsUrl;
document.getElementById('pluginLink').appendChild(pluginTestResultLink);

const ruleElement = document.createElement('hr');
document.getElementById('pluginLink').appendChild(ruleElement);
}

var pluginLink = document.createElement('a');
pluginLink.textContent = pluginUrl;
pluginLink.href = pluginUrl;
Expand All @@ -296,14 +338,22 @@ function getPluginLinks(plugin) {
`${platform}/` +
`${arch}/` +
`${type}/` +
`test-results/${testNumber}/integ-test/functionalTestDashboards/` +
`${securityEnabled ? 'with-security' : 'without-security'}`;
const screenshotBaseUrl = `${s3BaseUrl}/test-results/cypress-screenshots/plugins/${plugin}/$SPEC_FILE/$FULL_TEST_FAILURE.png`;
const videosBaseUrl = `${s3BaseUrl}/test-results/cypress-videos/plugins/${plugin}`;
`test-results/${testNumber}/integ-test/` +
`${
enableLegacyTestsResults()
? 'functionalTestDashboards'
: pluginObject.name
}/` +
`${securityEnabled ? 'with-security' : 'without-security'}` +
`${enableLegacyTestsResults() ? 'test-results' : ''}`;
const screenshotBaseUrl = `${s3BaseUrl}/cypress-screenshots/plugins/${plugin}/$SPEC_FILE/$FULL_TEST_FAILURE.png`;
const videosBaseUrl = `${s3BaseUrl}/cypress-videos/plugins/${plugin}`;

document.getElementById(
'baseScreenshotUrlBefore'
).innerHTML = `/tmp/$RANDOM/functionalTestDashboards/cypress/screenshots/plugins/${plugin}/$SPEC_FILE/$FULL_TEST_FAILURE.png`;
).innerHTML = `/tmp/$RANDOM/${
enableLegacyTestsResults() ? 'functionalTestDashboards' : pluginObject.name
}/cypress/screenshots/plugins/${plugin}/$SPEC_FILE/$FULL_TEST_FAILURE.png`;
document.getElementById('baseScreenshotUrlAfter').innerHTML =
screenshotBaseUrl;

Expand Down Expand Up @@ -354,4 +404,10 @@ function setDefaultValues() {
document.getElementById('security').checked = params.get('with_security')
? params.get('with_security').toLowerCase() === 'true'
: defaults.withSecurity;
document.getElementById('advancedConfig').checked = defaults.advancedConfig;
document.getElementById('legacyResults').checked = params.get(
'legacy_results'
)
? params.get('legacy_results').toLowerCase() === 'true'
: defaults.showLegacyTestResults;
}
16 changes: 13 additions & 3 deletions site/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ body {
display: none;
}

#inputsDiv #advancedInputsTable #legacyTd {
text-align: center;
}

#submitButton {
margin-top: 8px;
width: 150px;
Expand Down Expand Up @@ -99,7 +103,7 @@ body {
left: 50%;
top: 50%;
margin-left: -375px;
margin-top: -225px;
margin-top: -275px;
background-color: white;
border-radius: 6px;
box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 3px 0 inset;
Expand Down Expand Up @@ -148,18 +152,24 @@ body {
overflow: hidden;
}

.topNav img {
float: left;
height: 28px;
width: auto;
padding: 12px 6px;
}
.topNav span {
float: left;
color: white;
padding: 14px 16px;
padding: 16px 8px;
font-size: 1rem;
cursor: default;
}

.topNav a {
float: right;
color: white;
padding: 14px 16px;
padding: 16px 16px;
text-align: center;
text-decoration: underline;
font-size: 1rem;
Expand Down

0 comments on commit aadc599

Please sign in to comment.