Shows URL of page on AWS.

This commit is contained in:
NissimHadar 2018-10-08 14:32:10 -07:00
parent 92b26fec37
commit a5dc985308
8 changed files with 76 additions and 50 deletions

View file

@ -23,9 +23,13 @@ AWSInterface::AWSInterface(QObject* parent) : QObject(parent) {
void AWSInterface::createWebPageFromResults(const QString& testResults, void AWSInterface::createWebPageFromResults(const QString& testResults,
const QString& workingDirectory, const QString& workingDirectory,
QCheckBox* updateAWSCheckBox) { QCheckBox* updateAWSCheckBox,
QLineEdit* urlLineEdit) {
_testResults = testResults; _testResults = testResults;
_workingDirectory = workingDirectory; _workingDirectory = workingDirectory;
_urlLineEdit = urlLineEdit;
_urlLineEdit->setEnabled(false);
extractTestFailuresFromZippedFolder(); extractTestFailuresFromZippedFolder();
createHTMLFile(); createHTMLFile();
@ -278,15 +282,21 @@ void AWSInterface::updateAWS() {
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
stream << "data = open('" << _workingDirectory << "/" << filename << "/" << imageNames[i] << "', 'rb')\n"; stream << "data = open('" << _workingDirectory << "/" << filename << "/" << imageNames[i] << "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='hifi-qa', Key='" << filename << "/" << imageNames[i] << "', Body=data)\n\n"; stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << filename << "/" << imageNames[i] << "', Body=data)\n\n";
} }
} }
stream << "data = open('" << _workingDirectory << "/" << _resultsFolder << "/" << HTML_FILENAME << "', 'rb')\n"; stream << "data = open('" << _workingDirectory << "/" << _resultsFolder << "/" << HTML_FILENAME << "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='hifi-qa', Key='" << _resultsFolder << "/" << HTML_FILENAME << "', Body=data, ContentType='text/html')\n"; stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << _resultsFolder << "/"
<< HTML_FILENAME << "', Body=data, ContentType='text/html')\n";
file.close(); file.close();
// Show user the URL
_urlLineEdit->setEnabled(true);
_urlLineEdit->setText(QString("https://") + AWS_BUCKET + ".s3.amazonaws.com/" + _resultsFolder + "/" + HTML_FILENAME);
_urlLineEdit->setCursorPosition(0);
QProcess* process = new QProcess(); QProcess* process = new QProcess();
connect(process, &QProcess::started, this, [=]() { _busyWindow.exec(); }); connect(process, &QProcess::started, this, [=]() { _busyWindow.exec(); });

View file

@ -12,6 +12,7 @@
#define hifi_AWSInterface_h #define hifi_AWSInterface_h
#include <QCheckBox> #include <QCheckBox>
#include <QLineEdit>
#include <QObject> #include <QObject>
#include <QTextStream> #include <QTextStream>
@ -24,7 +25,11 @@ class AWSInterface : public QObject {
public: public:
explicit AWSInterface(QObject* parent = 0); explicit AWSInterface(QObject* parent = 0);
void createWebPageFromResults(const QString& testResults, const QString& workingDirectory, QCheckBox* updateAWSCheckBox); void createWebPageFromResults(const QString& testResults,
const QString& workingDirectory,
QCheckBox* updateAWSCheckBox,
QLineEdit* urlLineEdit);
void extractTestFailuresFromZippedFolder(); void extractTestFailuresFromZippedFolder();
void createHTMLFile(); void createHTMLFile();
@ -56,6 +61,10 @@ private:
PythonInterface* _pythonInterface; PythonInterface* _pythonInterface;
QString _pythonCommand; QString _pythonCommand;
QString AWS_BUCKET{ "hifi-qa" };
QLineEdit* _urlLineEdit;
}; };
#endif // hifi_AWSInterface_h #endif // hifi_AWSInterface_h

View file

@ -1028,7 +1028,7 @@ void Test::setTestRailCreateMode(TestRailCreateMode testRailCreateMode) {
_testRailCreateMode = testRailCreateMode; _testRailCreateMode = testRailCreateMode;
} }
void Test::createWebPage(QCheckBox* updateAWSCheckBox) { void Test::createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit) {
QString testResults = QFileDialog::getOpenFileName(nullptr, "Please select the zipped test results to update from", nullptr, QString testResults = QFileDialog::getOpenFileName(nullptr, "Please select the zipped test results to update from", nullptr,
"Zipped Test Results (*.zip)"); "Zipped Test Results (*.zip)");
if (testResults.isNull()) { if (testResults.isNull()) {
@ -1041,5 +1041,5 @@ void Test::createWebPage(QCheckBox* updateAWSCheckBox) {
return; return;
} }
_awsInterface.createWebPageFromResults(testResults, tempDirectory, updateAWSCheckBox); _awsInterface.createWebPageFromResults(testResults, tempDirectory, updateAWSCheckBox, urlLineEdit);
} }

View file

@ -98,7 +98,7 @@ public:
void setTestRailCreateMode(TestRailCreateMode testRailCreateMode); void setTestRailCreateMode(TestRailCreateMode testRailCreateMode);
void createWebPage(QCheckBox* updateAWSCheckBox); void createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit);
private: private:
QProgressBar* _progressBar; QProgressBar* _progressBar;

View file

@ -28,7 +28,7 @@ TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
QLabel* workingFolderLabel, QLabel* workingFolderLabel,
QCheckBox* runServerless, QCheckBox* runServerless,
QCheckBox* runLatest, QCheckBox* runLatest,
QTextEdit* url, QLineEdit* url,
QPushButton* runNow, QPushButton* runNow,
QObject* parent) : QObject* parent) :
QObject(parent) { QObject(parent) {
@ -142,7 +142,7 @@ void TestRunner::downloadComplete() {
urls << _buildInformation.url; urls << _buildInformation.url;
filenames << _installerFilename; filenames << _installerFilename;
} else { } else {
QString urlText = _url->toPlainText(); QString urlText = _url->text();
urls << urlText; urls << urlText;
_installerFilename = getInstallerNameFromURL(urlText); _installerFilename = getInstallerNameFromURL(urlText);
filenames << _installerFilename; filenames << _installerFilename;
@ -224,7 +224,7 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() {
_appDataFolder = dataDirectory + "\\High Fidelity"; _appDataFolder = dataDirectory + "\\High Fidelity";
} else { } else {
// We are running a PR build // We are running a PR build
_appDataFolder = dataDirectory + "\\High Fidelity - " + getPRNumberFromURL(_url->toPlainText()); _appDataFolder = dataDirectory + "\\High Fidelity - " + getPRNumberFromURL(_url->text());
} }
_savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME; _savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME;
@ -398,7 +398,7 @@ void TestRunner::addBuildNumberAndHostnameToResults(QString zippedFolderName) {
if (!_runLatest->isChecked()) { if (!_runLatest->isChecked()) {
QStringList filenameParts = zippedFolderName.split("."); QStringList filenameParts = zippedFolderName.split(".");
augmentedFilename = augmentedFilename =
filenameParts[0] + "(" + getPRNumberFromURL(_url->toPlainText()) + ")[" + QHostInfo::localHostName() + "]." + filenameParts[1]; filenameParts[0] + "(" + getPRNumberFromURL(_url->text()) + ")[" + QHostInfo::localHostName() + "]." + filenameParts[1];
} else { } else {
QStringList filenameParts = zippedFolderName.split("."); QStringList filenameParts = zippedFolderName.split(".");
augmentedFilename = augmentedFilename =

View file

@ -14,9 +14,9 @@
#include <QCheckBox> #include <QCheckBox>
#include <QDir> #include <QDir>
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QObject> #include <QObject>
#include <QPushButton> #include <QPushButton>
#include <QTextEdit>
#include <QThread> #include <QThread>
#include <QTimeEdit> #include <QTimeEdit>
#include <QTimer> #include <QTimer>
@ -38,7 +38,7 @@ public:
QLabel* workingFolderLabel, QLabel* workingFolderLabel,
QCheckBox* runServerless, QCheckBox* runServerless,
QCheckBox* runLatest, QCheckBox* runLatest,
QTextEdit* url, QLineEdit* url,
QPushButton* runNow, QPushButton* runNow,
QObject* parent = 0); QObject* parent = 0);
@ -116,7 +116,7 @@ private:
QLabel* _workingFolderLabel; QLabel* _workingFolderLabel;
QCheckBox* _runServerless; QCheckBox* _runServerless;
QCheckBox* _runLatest; QCheckBox* _runLatest;
QTextEdit* _url; QLineEdit* _url;
QPushButton* _runNow; QPushButton* _runNow;
QTimer* _timer; QTimer* _timer;

View file

@ -84,7 +84,7 @@ void AutoTester::setup() {
if (_testRunner) { if (_testRunner) {
delete _testRunner; delete _testRunner;
} }
_testRunner = new TestRunner(dayCheckboxes, timeEditCheckboxes, timeEdits, _ui.workingFolderLabel, _ui.checkBoxServerless, _ui.checkBoxRunLatest, _ui.urlTextEdit, _ui.runNowButton); _testRunner = new TestRunner(dayCheckboxes, timeEditCheckboxes, timeEdits, _ui.workingFolderLabel, _ui.checkBoxServerless, _ui.checkBoxRunLatest, _ui.urlLineEdit, _ui.runNowButton);
} }
void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine, void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine,
@ -165,7 +165,7 @@ void AutoTester::on_runNowButton_clicked() {
} }
void AutoTester::on_checkBoxRunLatest_clicked() { void AutoTester::on_checkBoxRunLatest_clicked() {
_ui.urlTextEdit->setEnabled(!_ui.checkBoxRunLatest->isChecked()); _ui.urlLineEdit->setEnabled(!_ui.checkBoxRunLatest->isChecked());
} }
void AutoTester::automaticTestRunEvaluationComplete(QString zippedFolderName, int numberOfFailures) { void AutoTester::automaticTestRunEvaluationComplete(QString zippedFolderName, int numberOfFailures) {
@ -213,7 +213,7 @@ void AutoTester::on_createXMLScriptRadioButton_clicked() {
} }
void AutoTester::on_createWebPagePushButton_clicked() { void AutoTester::on_createWebPagePushButton_clicked() {
_test->createWebPage(_ui.updateAWSCheckBox); _test->createWebPage(_ui.updateAWSCheckBox, _ui.awsURLLineEdit);
} }
void AutoTester::downloadFile(const QUrl& url) { void AutoTester::downloadFile(const QUrl& url) {

View file

@ -520,19 +520,6 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QTextEdit" name="urlTextEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>150</x>
<y>98</y>
<width>461</width>
<height>28</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="workingFolderLabel_3"> <widget class="QLabel" name="workingFolderLabel_3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -546,6 +533,16 @@
<string>URL</string> <string>URL</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="urlLineEdit">
<property name="geometry">
<rect>
<x>160</x>
<y>100</y>
<width>451</width>
<height>21</height>
</rect>
</property>
</widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
@ -588,8 +585,8 @@
<widget class="QPushButton" name="updateTestRailRunResultsButton"> <widget class="QPushButton" name="updateTestRailRunResultsButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>240</x>
<y>230</y> <y>220</y>
<width>160</width> <width>160</width>
<height>40</height> <height>40</height>
</rect> </rect>
@ -601,8 +598,8 @@
<widget class="QRadioButton" name="createPythonScriptRadioButton"> <widget class="QRadioButton" name="createPythonScriptRadioButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>170</x>
<y>110</y> <y>100</y>
<width>95</width> <width>95</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -617,8 +614,8 @@
<widget class="QPushButton" name="createTestRailRunButton"> <widget class="QPushButton" name="createTestRailRunButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>240</x>
<y>170</y> <y>160</y>
<width>160</width> <width>160</width>
<height>40</height> <height>40</height>
</rect> </rect>
@ -630,8 +627,8 @@
<widget class="QPushButton" name="createTestRailTestCasesButton"> <widget class="QPushButton" name="createTestRailTestCasesButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>240</x>
<y>110</y> <y>100</y>
<width>160</width> <width>160</width>
<height>40</height> <height>40</height>
</rect> </rect>
@ -643,8 +640,8 @@
<widget class="QRadioButton" name="createXMLScriptRadioButton"> <widget class="QRadioButton" name="createXMLScriptRadioButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>170</x>
<y>130</y> <y>120</y>
<width>95</width> <width>95</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -656,9 +653,9 @@
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>-20</x> <x>10</x>
<y>30</y> <y>30</y>
<width>291</width> <width>601</width>
<height>300</height> <height>300</height>
</rect> </rect>
</property> </property>
@ -669,10 +666,10 @@
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>329</x> <x>10</x>
<y>30</y> <y>350</y>
<width>291</width> <width>601</width>
<height>300</height> <height>151</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -684,8 +681,8 @@
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>110</x> <x>240</x>
<y>80</y> <y>30</y>
<width>160</width> <width>160</width>
<height>40</height> <height>40</height>
</rect> </rect>
@ -697,8 +694,8 @@
<widget class="QCheckBox" name="updateAWSCheckBox"> <widget class="QCheckBox" name="updateAWSCheckBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>150</x>
<y>92</y> <y>42</y>
<width>81</width> <width>81</width>
<height>17</height> <height>17</height>
</rect> </rect>
@ -707,6 +704,16 @@
<string>Update AWS</string> <string>Update AWS</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="awsURLLineEdit">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>561</width>
<height>21</height>
</rect>
</property>
</widget>
</widget> </widget>
<zorder>groupBox</zorder> <zorder>groupBox</zorder>
<zorder>updateTestRailRunResultsButton</zorder> <zorder>updateTestRailRunResultsButton</zorder>