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,
const QString& workingDirectory,
QCheckBox* updateAWSCheckBox) {
QCheckBox* updateAWSCheckBox,
QLineEdit* urlLineEdit) {
_testResults = testResults;
_workingDirectory = workingDirectory;
_urlLineEdit = urlLineEdit;
_urlLineEdit->setEnabled(false);
extractTestFailuresFromZippedFolder();
createHTMLFile();
@ -278,15 +282,21 @@ void AWSInterface::updateAWS() {
for (int i = 0; i < 3; ++i) {
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 << "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();
// 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();
connect(process, &QProcess::started, this, [=]() { _busyWindow.exec(); });

View file

@ -12,6 +12,7 @@
#define hifi_AWSInterface_h
#include <QCheckBox>
#include <QLineEdit>
#include <QObject>
#include <QTextStream>
@ -24,7 +25,11 @@ class AWSInterface : public QObject {
public:
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 createHTMLFile();
@ -56,6 +61,10 @@ private:
PythonInterface* _pythonInterface;
QString _pythonCommand;
QString AWS_BUCKET{ "hifi-qa" };
QLineEdit* _urlLineEdit;
};
#endif // hifi_AWSInterface_h

View file

@ -1028,7 +1028,7 @@ void Test::setTestRailCreateMode(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,
"Zipped Test Results (*.zip)");
if (testResults.isNull()) {
@ -1041,5 +1041,5 @@ void Test::createWebPage(QCheckBox* updateAWSCheckBox) {
return;
}
_awsInterface.createWebPageFromResults(testResults, tempDirectory, updateAWSCheckBox);
_awsInterface.createWebPageFromResults(testResults, tempDirectory, updateAWSCheckBox, urlLineEdit);
}

View file

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

View file

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

View file

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

View file

@ -84,7 +84,7 @@ void AutoTester::setup() {
if (_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,
@ -165,7 +165,7 @@ void AutoTester::on_runNowButton_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) {
@ -213,7 +213,7 @@ void AutoTester::on_createXMLScriptRadioButton_clicked() {
}
void AutoTester::on_createWebPagePushButton_clicked() {
_test->createWebPage(_ui.updateAWSCheckBox);
_test->createWebPage(_ui.updateAWSCheckBox, _ui.awsURLLineEdit);
}
void AutoTester::downloadFile(const QUrl& url) {

View file

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