This commit is contained in:
NissimHadar 2018-09-12 17:37:02 -07:00
parent 8ee051ea14
commit cbc53f1e5d
5 changed files with 102 additions and 11 deletions

View file

@ -56,6 +56,7 @@ void TestRunner::setWorkingFolder() {
}
_installationFolder = _workingFolder + "/High Fidelity";
_logFile.setFileName(_workingFolder + "/log.txt");
autoTester->enableRunTabControls();
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
@ -67,6 +68,7 @@ void TestRunner::setWorkingFolder() {
}
void TestRunner::run() {
_testStartDateTime = QDateTime::currentDateTime();
_automatedTestIsRunning = true;
// Initial setup
@ -83,12 +85,20 @@ void TestRunner::run() {
QStringList filenames;
filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME;
updateStatusLabel("Downloading installer");
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
// `installerDownloadComplete` will run after download has completed
}
void TestRunner::installerDownloadComplete() {
appendLog(QString("Test started at ") + QString::number(_testStartDateTime.time().hour()) + ":" +
QString("%1").arg(_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " +
_testStartDateTime.date().toString("ddd, MMM d, yyyy"));
updateStatusLabel("Installing");
// Kill any existing processes that would interfere with installation
killProcesses();
@ -96,6 +106,8 @@ void TestRunner::installerDownloadComplete() {
createSnapshotFolder();
updateStatusLabel("Running tests");
startLocalServerProcesses();
runInterfaceWithTestScript();
killProcesses();
@ -232,6 +244,7 @@ void TestRunner::runInterfaceWithTestScript() {
}
void TestRunner::evaluateResults() {
updateStatusLabel("Evaluating results");
autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
}
@ -239,6 +252,7 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder) {
addBuildNumberToResults(zippedFolder);
restoreHighFidelityAppDataFolder();
updateStatusLabel("Testing complete");
_automatedTestIsRunning = false;
}
@ -382,4 +396,22 @@ void TestRunner::checkTime() {
if (timeToRun) {
run();
}
}
void TestRunner::updateStatusLabel(const QString& message) {
autoTester->updateStatusLabel(message);
}
void TestRunner::appendLog(const QString& message) {
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
"Could not open the log file");
exit(-1);
}
_logFile.write(message.toStdString().c_str());
_logFile.write("\n");
_logFile.close();
autoTester->appendLogWindow(message);
}

View file

@ -51,6 +51,9 @@ public:
void copyFolder(const QString& source, const QString& destination);
void updateStatusLabel(const QString& message);
void appendLog(const QString& message);
private slots:
void checkTime();
@ -85,6 +88,10 @@ private:
QLabel* _workingFolderLabel;
QTimer* _timer;
QFile _logFile;
QDateTime _testStartDateTime;
};
#endif // hifi_testRunner_h

View file

@ -32,7 +32,11 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
#ifndef Q_OS_WIN
_ui.tabWidget->removeTab(1);
#endif
//// Coming soon to an auto-tester near you...
_ui.statusLabel->setText("");
_ui.plainTextEdit->setReadOnly(true);
// Coming soon to an auto-tester near you...
//// _helpWindow.textBrowser->setText()
}
@ -67,7 +71,8 @@ void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine,
const bool isRunningInAutomaticTestRun,
const QString& snapshotDirectory,
const QString& branch,
const QString& user) {
const QString& user
) {
_test->startTestsEvaluation(isRunningFromCommandLine, isRunningInAutomaticTestRun, snapshotDirectory, branch, user);
}
@ -263,3 +268,11 @@ void AutoTester::setBranchText(const QString& branch) {
QString AutoTester::getSelectedBranch() {
return _ui.branchTextEdit->toPlainText();
}
void AutoTester::updateStatusLabel(const QString& status) {
_ui.statusLabel->setText(status);
}
void AutoTester::appendLogWindow(const QString& message) {
_ui.plainTextEdit->appendPlainText(message);
}

View file

@ -49,6 +49,9 @@ public:
void enableRunTabControls();
void updateStatusLabel(const QString& status);
void appendLogWindow(const QString& message);
private slots:
void on_tabWidget_currentChanged(int index);

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>734</height>
<width>707</width>
<height>796</height>
</rect>
</property>
<property name="sizePolicy">
@ -23,8 +23,8 @@
<widget class="QPushButton" name="closeButton">
<property name="geometry">
<rect>
<x>430</x>
<y>620</y>
<x>470</x>
<y>660</y>
<width>100</width>
<height>40</height>
</rect>
@ -38,8 +38,8 @@
<rect>
<x>30</x>
<y>140</y>
<width>521</width>
<height>461</height>
<width>631</width>
<height>501</height>
</rect>
</property>
<property name="currentIndex">
@ -320,7 +320,7 @@
<rect>
<x>130</x>
<y>150</y>
<width>181</width>
<width>161</width>
<height>191</height>
</rect>
</property>
@ -446,6 +446,42 @@
<string>#######</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="geometry">
<rect>
<x>300</x>
<y>120</y>
<width>311</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="workingFolderLabel_2">
<property name="geometry">
<rect>
<x>300</x>
<y>80</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Status:</string>
</property>
</widget>
<widget class="QLabel" name="statusLabel">
<property name="geometry">
<rect>
<x>350</x>
<y>80</y>
<width>271</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>#######</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
@ -615,7 +651,7 @@
<property name="geometry">
<rect>
<x>80</x>
<y>630</y>
<y>670</y>
<width>255</width>
<height>23</height>
</rect>
@ -630,7 +666,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<width>707</width>
<height>21</height>
</rect>
</property>