Can extract filename after selecting zipped results and temporary folder.

This commit is contained in:
NissimHadar 2018-10-04 08:54:34 -07:00
parent 2cb0b2ea8d
commit ed94ffa384
7 changed files with 47 additions and 7 deletions

View file

@ -1027,3 +1027,19 @@ QString Test::getExpectedImagePartialSourceDirectory(const QString& filename) {
void Test::setTestRailCreateMode(TestRailCreateMode testRailCreateMode) {
_testRailCreateMode = testRailCreateMode;
}
void Test::createWebPage() {
QString testResults = QFileDialog::getOpenFileName(nullptr, "Please select the zipped test results to update from", nullptr,
"Zipped Test Results (*.zip)");
if (testResults.isNull()) {
return;
}
QString tempDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select a folder to store temporary files in",
nullptr, QFileDialog::ShowDirsOnly);
if (tempDirectory.isNull()) {
return;
}
_awsInterface.createWebPageFromResults(testResults, tempDirectory);
}

View file

@ -16,6 +16,7 @@
#include <QtCore/QRegularExpression>
#include <QProgressBar>
#include "AWSInterface.h"
#include "ImageComparer.h"
#include "ui/MismatchWindow.h"
#include "TestRailInterface.h"
@ -97,6 +98,8 @@ public:
void setTestRailCreateMode(TestRailCreateMode testRailCreateMode);
void createWebPage();
private:
QProgressBar* _progressBar;
QCheckBox* _checkBoxInteractiveMode;
@ -151,8 +154,9 @@ private:
bool _exitWhenComplete{ false };
TestRailInterface _testRailInterface;
TestRailCreateMode _testRailCreateMode { PYTHON };
AWSInterface _awsInterface;
};
#endif // hifi_test_h

View file

@ -530,7 +530,7 @@ void TestRailInterface::updateRunWithResults() {
stream << "failed_tests = set()\n";
stream << "for entry in listdir('" + _outputDirectory + "/" + tempName + "'):\n";
stream << "for entry in listdir('" + _outputDirectory + "/" + TEMP_NAME + "'):\n";
stream << "\tparts = entry.split('--tests.')[1].split('.')\n";
stream << "\tfailed_test = parts[0]\n";
stream << "\tfor i in range(1, len(parts) - 1):\n";
@ -1157,11 +1157,20 @@ void TestRailInterface::updateTestRailRunResults(const QString& testResults, con
createTestRailDotPyScript();
// Extract test failures from zipped folder
QString tempSubDirectory = tempDirectory + "/" + tempName;
QString tempSubDirectory = tempDirectory + "/" + TEMP_NAME;
QDir dir = tempSubDirectory;
dir.mkdir(tempSubDirectory);
JlCompress::extractDir(testResults, tempSubDirectory);
// TestRail will be updated after the process initiated by getTestRunFromTestRail has completed
getRunsFromTestRail();
dir.rmdir(tempSubDirectory);
}
void TestRailInterface::extractTestFailuresFromZippedFolder(const QString& testResults, const QString& tempDirectory) {
QString tempSubDirectory = tempDirectory + "/" + TEMP_NAME;
QDir dir = tempSubDirectory;
dir.mkdir(tempSubDirectory);
JlCompress::extractDir(testResults, tempSubDirectory);
}

View file

@ -89,6 +89,7 @@ public:
void updateRunWithResults();
bool setPythonCommand();
void extractTestFailuresFromZippedFolder(const QString& testResults, const QString& tempDirectory);
private:
// HighFidelity Interface project ID in TestRail
@ -111,6 +112,7 @@ private:
QString _suiteID;
QString _testDirectory;
QString _testResults;
QString _outputDirectory;
QString _userGitHub;
QString _branchGitHub;
@ -126,7 +128,7 @@ private:
QStringList _runNames;
std::vector<int> _runIDs;
QString tempName{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
QString TEMP_NAME{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
};
#endif

View file

@ -36,7 +36,7 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
_ui.statusLabel->setText("");
_ui.plainTextEdit->setReadOnly(true);
setWindowTitle("Auto Tester - v5.1");
setWindowTitle("Auto Tester - v6.0");
// Coming soon to an auto-tester near you...
//// _helpWindow.textBrowser->setText()
@ -212,6 +212,10 @@ void AutoTester::on_createXMLScriptRadioButton_clicked() {
_test->setTestRailCreateMode(XML);
}
void AutoTester::on_createWebPagePushButton_clicked() {
_test->createWebPage();
}
void AutoTester::downloadFile(const QUrl& url) {
_downloaders.emplace_back(new Downloader(url, this));
connect(_downloaders[_index], SIGNAL(downloaded()), _signalMapper, SLOT(map()));

View file

@ -20,6 +20,7 @@
#include "HelpWindow.h"
#include "../TestRunner.h"
#include "../AWSInterface.h"
class AutoTester : public QMainWindow {
Q_OBJECT
@ -84,6 +85,8 @@ private slots:
void on_createPythonScriptRadioButton_clicked();
void on_createXMLScriptRadioButton_clicked();
void on_createWebPagePushButton_clicked();
void on_closeButton_clicked();
void saveFile(int index);
@ -96,6 +99,8 @@ private:
Test* _test{ nullptr };
TestRunner* _testRunner{ nullptr };
AWSInterface _awsInterface;
std::vector<Downloader*> _downloaders;
// local storage for parameters - folder to store downloaded files in, and a list of their names

View file

@ -43,7 +43,7 @@
</rect>
</property>
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<widget class="QWidget" name="tab_1">
<attribute name="title">
@ -680,7 +680,7 @@
</property>
<widget class="QPushButton" name="createWebPagePushButton">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="geometry">
<rect>