From a5dc985308cd904d78fcf3b27f6baca0e80d036f Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Mon, 8 Oct 2018 14:32:10 -0700 Subject: [PATCH] Shows URL of page on AWS. --- tools/auto-tester/src/AWSInterface.cpp | 16 +++++- tools/auto-tester/src/AWSInterface.h | 11 +++- tools/auto-tester/src/Test.cpp | 4 +- tools/auto-tester/src/Test.h | 2 +- tools/auto-tester/src/TestRunner.cpp | 8 +-- tools/auto-tester/src/TestRunner.h | 6 +- tools/auto-tester/src/ui/AutoTester.cpp | 6 +- tools/auto-tester/src/ui/AutoTester.ui | 73 ++++++++++++++----------- 8 files changed, 76 insertions(+), 50 deletions(-) diff --git a/tools/auto-tester/src/AWSInterface.cpp b/tools/auto-tester/src/AWSInterface.cpp index b5c73d7534..9fdebb1f2a 100644 --- a/tools/auto-tester/src/AWSInterface.cpp +++ b/tools/auto-tester/src/AWSInterface.cpp @@ -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(); }); diff --git a/tools/auto-tester/src/AWSInterface.h b/tools/auto-tester/src/AWSInterface.h index ebfc027345..b0e23066a2 100644 --- a/tools/auto-tester/src/AWSInterface.h +++ b/tools/auto-tester/src/AWSInterface.h @@ -12,6 +12,7 @@ #define hifi_AWSInterface_h #include +#include #include #include @@ -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 \ No newline at end of file diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index a150805bd2..a9682b1536 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -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); } \ No newline at end of file diff --git a/tools/auto-tester/src/Test.h b/tools/auto-tester/src/Test.h index 93e8ec249d..28bc7ccad0 100644 --- a/tools/auto-tester/src/Test.h +++ b/tools/auto-tester/src/Test.h @@ -98,7 +98,7 @@ public: void setTestRailCreateMode(TestRailCreateMode testRailCreateMode); - void createWebPage(QCheckBox* updateAWSCheckBox); + void createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit); private: QProgressBar* _progressBar; diff --git a/tools/auto-tester/src/TestRunner.cpp b/tools/auto-tester/src/TestRunner.cpp index e790575ce5..756923828f 100644 --- a/tools/auto-tester/src/TestRunner.cpp +++ b/tools/auto-tester/src/TestRunner.cpp @@ -28,7 +28,7 @@ TestRunner::TestRunner(std::vector 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 = diff --git a/tools/auto-tester/src/TestRunner.h b/tools/auto-tester/src/TestRunner.h index 4add393cd6..dfa93b7b1c 100644 --- a/tools/auto-tester/src/TestRunner.h +++ b/tools/auto-tester/src/TestRunner.h @@ -14,9 +14,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -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; diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index 1d2cb9551e..667a2f65d6 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -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) { diff --git a/tools/auto-tester/src/ui/AutoTester.ui b/tools/auto-tester/src/ui/AutoTester.ui index e551302f00..51170fcd42 100644 --- a/tools/auto-tester/src/ui/AutoTester.ui +++ b/tools/auto-tester/src/ui/AutoTester.ui @@ -520,19 +520,6 @@ true - - - false - - - - 150 - 98 - 461 - 28 - - - @@ -546,6 +533,16 @@ URL + + + + 160 + 100 + 451 + 21 + + + @@ -588,8 +585,8 @@ - 90 - 230 + 240 + 220 160 40 @@ -601,8 +598,8 @@ - 20 - 110 + 170 + 100 95 20 @@ -617,8 +614,8 @@ - 90 - 170 + 240 + 160 160 40 @@ -630,8 +627,8 @@ - 90 - 110 + 240 + 100 160 40 @@ -643,8 +640,8 @@ - 20 - 130 + 170 + 120 95 20 @@ -656,9 +653,9 @@ - -20 + 10 30 - 291 + 601 300 @@ -669,10 +666,10 @@ - 329 - 30 - 291 - 300 + 10 + 350 + 601 + 151 @@ -684,8 +681,8 @@ - 110 - 80 + 240 + 30 160 40 @@ -697,8 +694,8 @@ - 20 - 92 + 150 + 42 81 17 @@ -707,6 +704,16 @@ Update AWS + + + + 20 + 90 + 561 + 21 + + + groupBox updateTestRailRunResultsButton