Merge pull request #15175 from NissimHadar/21691-improveNitpickWebPage

Case 21691: Improve nitpick web page.
This commit is contained in:
Andrew Meadows 2019-03-22 10:06:08 -07:00 committed by GitHub
commit 8977aba7c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 15 deletions

View file

@ -8,6 +8,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "AWSInterface.h"
#include "common.h"
#include <QDirIterator>
#include <QJsonDocument>
@ -29,7 +30,9 @@ void AWSInterface::createWebPageFromResults(const QString& testResults,
QCheckBox* updateAWSCheckBox,
QRadioButton* diffImageRadioButton,
QRadioButton* ssimImageRadionButton,
QLineEdit* urlLineEdit
QLineEdit* urlLineEdit,
const QString& branch,
const QString& user
) {
_workingDirectory = workingDirectory;
@ -53,6 +56,9 @@ void AWSInterface::createWebPageFromResults(const QString& testResults,
_urlLineEdit = urlLineEdit;
_urlLineEdit->setEnabled(false);
_branch = branch;
_user = user;
QString zipFilenameWithoutExtension = zipFilename.split('.')[0];
extractTestFailuresFromZippedFolder(_workingDirectory + "/" + zipFilenameWithoutExtension);
@ -202,13 +208,21 @@ void AWSInterface::writeTitle(QTextStream& stream, const QStringList& originalNa
stream << "run on " << hostName << "</h1>\n";
int numberOfFailures = originalNamesFailures.length();
int numberOfSuccesses = originalNamesSuccesses.length();
stream << "<h2>";
stream << "nitpick " << nitpickVersion;
stream << ", tests from GitHub: " << _user << "/" << _branch;
stream << "</h2>";
stream << "<h2>" << QString::number(numberOfFailures) << " failed, out of a total of " << QString::number(numberOfSuccesses) << " tests</h2>\n";
_numberOfFailures = originalNamesFailures.length();
_numberOfSuccesses = originalNamesSuccesses.length();
stream << "<h2>" << QString::number(_numberOfFailures) << " failed, out of a total of " << QString::number(_numberOfFailures + _numberOfSuccesses) << " tests</h2>\n";
stream << "\t" << "\t" << "<font color=\"red\">\n";
stream << "\t" << "\t" << "<h1>The following tests failed:</h1>";
if (_numberOfFailures > 0) {
stream << "\t" << "\t" << "<h1>The following tests failed:</h1>";
}
}
void AWSInterface::writeTable(QTextStream& stream, const QStringList& originalNamesFailures, const QStringList& originalNamesSuccesses) {
@ -289,7 +303,10 @@ void AWSInterface::writeTable(QTextStream& stream, const QStringList& originalNa
closeTable(stream);
stream << "\t" << "\t" << "<font color=\"blue\">\n";
stream << "\t" << "\t" << "<h1>The following tests passed:</h1>";
if (_numberOfSuccesses > 0) {
stream << "\t" << "\t" << "<h1>The following tests passed:</h1>";
}
// Now do the same for passes
folderNames.clear();

View file

@ -31,7 +31,10 @@ public:
QCheckBox* updateAWSCheckBox,
QRadioButton* diffImageRadioButton,
QRadioButton* ssimImageRadionButton,
QLineEdit* urlLineEdit);
QLineEdit* urlLineEdit,
const QString& branch,
const QString& user
);
void extractTestFailuresFromZippedFolder(const QString& folderName);
void createHTMLFile();
@ -70,9 +73,13 @@ private:
QString AWS_BUCKET{ "hifi-qa" };
QLineEdit* _urlLineEdit;
QString _user;
QString _branch;
QString _comparisonImageFilename;
int _numberOfFailures;
int _numberOfSuccesses;
};
#endif // hifi_AWSInterface_h

View file

@ -38,7 +38,7 @@ Nitpick::Nitpick(QWidget* parent) : QMainWindow(parent) {
_ui.plainTextEdit->setReadOnly(true);
setWindowTitle("Nitpick - v3.1.3");
setWindowTitle("Nitpick - " + nitpickVersion);
clientProfiles << "VR-High" << "Desktop-High" << "Desktop-Low" << "Mobile-Touch" << "VR-Standalone";
_ui.clientProfileComboBox->insertItems(0, clientProfiles);
@ -266,7 +266,7 @@ void Nitpick::on_createXMLScriptRadioButton_clicked() {
}
void Nitpick::on_createWebPagePushbutton_clicked() {
_testCreator->createWebPage(_ui.updateAWSCheckBox, _ui.diffImageRadioButton, _ui.ssimImageRadioButton, _ui.awsURLLineEdit);
_testCreator->createWebPage(_ui.updateAWSCheckBox, _ui.diffImageRadioButton, _ui.ssimImageRadioButton, _ui.awsURLLineEdit, _ui.branchLineEdit->text(), _ui.userLineEdit->text());
}
void Nitpick::about() {

View file

@ -1118,7 +1118,10 @@ void TestCreator::createWebPage(
QCheckBox* updateAWSCheckBox,
QRadioButton* diffImageRadioButton,
QRadioButton* ssimImageRadionButton,
QLineEdit* urlLineEdit
QLineEdit* urlLineEdit,
const QString& branch,
const QString& user
) {
QString testResults = QFileDialog::getOpenFileName(nullptr, "Please select the zipped test results to update from", nullptr,
"Zipped TestCreator Results (TestResults--*.zip)");
@ -1142,6 +1145,8 @@ void TestCreator::createWebPage(
updateAWSCheckBox,
diffImageRadioButton,
ssimImageRadionButton,
urlLineEdit
urlLineEdit,
branch,
user
);
}

View file

@ -107,7 +107,10 @@ public:
QCheckBox* updateAWSCheckBox,
QRadioButton* diffImageRadioButton,
QRadioButton* ssimImageRadionButton,
QLineEdit* urlLineEdit);
QLineEdit* urlLineEdit,
const QString& branch,
const QString& user
);
private:
QProgressBar* _progressBar;

View file

@ -60,4 +60,5 @@ const double R_Y = 0.212655f;
const double G_Y = 0.715158f;
const double B_Y = 0.072187f;
const QString nitpickVersion { "v3.1.4" };
#endif // hifi_common_h

View file

@ -620,7 +620,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If unchecked, will not show results during evaluation&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>usePreviousInstallation</string>
<string>Use Previous Installation</string>
</property>
<property name="checked">
<bool>false</bool>
@ -895,7 +895,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If unchecked, will not show results during evaluation&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>usePreviousInstallation</string>
<string>Use Previous Installation</string>
</property>
<property name="checked">
<bool>false</bool>