mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
Disable "RunNow" button while running tests
Check if Interface test scripts ran to completion.
This commit is contained in:
parent
5c7b4338b6
commit
318e83e500
3 changed files with 28 additions and 8 deletions
|
@ -9,6 +9,7 @@
|
||||||
//
|
//
|
||||||
#include "TestRunner.h"
|
#include "TestRunner.h"
|
||||||
|
|
||||||
|
#include <QHostInfo>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QtWidgets/QMessageBox>
|
#include <QtWidgets/QMessageBox>
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
|
@ -28,6 +29,7 @@ TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
|
||||||
QCheckBox* runServerless,
|
QCheckBox* runServerless,
|
||||||
QCheckBox* runLatest,
|
QCheckBox* runLatest,
|
||||||
QTextEdit* url,
|
QTextEdit* url,
|
||||||
|
QPushButton* runNow,
|
||||||
QObject* parent) :
|
QObject* parent) :
|
||||||
QObject(parent) {
|
QObject(parent) {
|
||||||
_dayCheckboxes = dayCheckboxes;
|
_dayCheckboxes = dayCheckboxes;
|
||||||
|
@ -37,6 +39,7 @@ TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
|
||||||
_runServerless = runServerless;
|
_runServerless = runServerless;
|
||||||
_runLatest = runLatest;
|
_runLatest = runLatest;
|
||||||
_url = url;
|
_url = url;
|
||||||
|
_runNow = runNow;
|
||||||
|
|
||||||
installerThread = new QThread();
|
installerThread = new QThread();
|
||||||
installerWorker = new Worker();
|
installerWorker = new Worker();
|
||||||
|
@ -94,6 +97,8 @@ void TestRunner::setWorkingFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::run() {
|
void TestRunner::run() {
|
||||||
|
_runNow->setEnabled(false);
|
||||||
|
|
||||||
_testStartDateTime = QDateTime::currentDateTime();
|
_testStartDateTime = QDateTime::currentDateTime();
|
||||||
_automatedTestIsRunning = true;
|
_automatedTestIsRunning = true;
|
||||||
|
|
||||||
|
@ -240,10 +245,12 @@ void TestRunner::createSnapshotFolder() {
|
||||||
// Just delete all PNGs from the folder if it already exists
|
// Just delete all PNGs from the folder if it already exists
|
||||||
if (QDir(_snapshotFolder).exists()) {
|
if (QDir(_snapshotFolder).exists()) {
|
||||||
// Note that we cannot use just a `png` filter, as the filenames include periods
|
// Note that we cannot use just a `png` filter, as the filenames include periods
|
||||||
|
// Also, delete any `jpg` and `txt` files
|
||||||
|
// The idea is to leave only previous zipped result folders
|
||||||
QDirIterator it(_snapshotFolder.toStdString().c_str());
|
QDirIterator it(_snapshotFolder.toStdString().c_str());
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QString filename = it.next();
|
QString filename = it.next();
|
||||||
if (filename.right(4) == ".png") {
|
if (filename.right(4) == ".png" || filename.right(4) == ".jpg" || filename.right(4) == ".txt") {
|
||||||
QFile::remove(filename);
|
QFile::remove(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,6 +348,13 @@ void TestRunner::runInterfaceWithTestScript() {
|
||||||
void TestRunner::interfaceExecutionComplete() {
|
void TestRunner::interfaceExecutionComplete() {
|
||||||
killProcesses();
|
killProcesses();
|
||||||
|
|
||||||
|
QFileInfo testCompleted(QDir::toNativeSeparators(_snapshotFolder) +"/tests_completed.txt");
|
||||||
|
if (!testCompleted.exists()) {
|
||||||
|
QMessageBox::critical(0, "Tests not completed", "Interface seems to have crashed before completion of the test scripts");
|
||||||
|
_runNow->setEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
evaluateResults();
|
evaluateResults();
|
||||||
|
|
||||||
// The High Fidelity AppData folder will be restored after evaluation has completed
|
// The High Fidelity AppData folder will be restored after evaluation has completed
|
||||||
|
@ -352,7 +366,7 @@ void TestRunner::evaluateResults() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder, int numberOfFailures) {
|
void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder, int numberOfFailures) {
|
||||||
addBuildNumberToResults(zippedFolder);
|
addBuildNumberAndHostnameToResults(zippedFolder);
|
||||||
restoreHighFidelityAppDataFolder();
|
restoreHighFidelityAppDataFolder();
|
||||||
|
|
||||||
updateStatusLabel("Testing complete");
|
updateStatusLabel("Testing complete");
|
||||||
|
@ -373,9 +387,11 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder, int nu
|
||||||
appendLog(completionText);
|
appendLog(completionText);
|
||||||
|
|
||||||
_automatedTestIsRunning = false;
|
_automatedTestIsRunning = false;
|
||||||
|
|
||||||
|
_runNow->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::addBuildNumberToResults(QString zippedFolderName) {
|
void TestRunner::addBuildNumberAndHostnameToResults(QString zippedFolderName) {
|
||||||
if (!_runLatest->isChecked()) {
|
if (!_runLatest->isChecked()) {
|
||||||
QStringList filenameParts = zippedFolderName.split(".");
|
QStringList filenameParts = zippedFolderName.split(".");
|
||||||
QString augmentedFilename = filenameParts[0] + "(" + getPRNumberFromURL(_url->toPlainText()) + ")." + filenameParts[1];
|
QString augmentedFilename = filenameParts[0] + "(" + getPRNumberFromURL(_url->toPlainText()) + ")." + filenameParts[1];
|
||||||
|
@ -385,7 +401,9 @@ void TestRunner::addBuildNumberToResults(QString zippedFolderName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList filenameParts = zippedFolderName.split(".");
|
QStringList filenameParts = zippedFolderName.split(".");
|
||||||
QString augmentedFilename = filenameParts[0] + "(" + _buildInformation.build + ")." + filenameParts[1];
|
QString augmentedFilename =
|
||||||
|
filenameParts[0] + "(" + _buildInformation.build + ")[" + QHostInfo::localHostName() + "]." + filenameParts[1];
|
||||||
|
|
||||||
QFile::rename(zippedFolderName, augmentedFilename);
|
QFile::rename(zippedFolderName, augmentedFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimeEdit>
|
#include <QTimeEdit>
|
||||||
|
@ -38,6 +39,7 @@ public:
|
||||||
QCheckBox* runServerless,
|
QCheckBox* runServerless,
|
||||||
QCheckBox* runLatest,
|
QCheckBox* runLatest,
|
||||||
QTextEdit* url,
|
QTextEdit* url,
|
||||||
|
QPushButton* runNow,
|
||||||
QObject* parent = 0);
|
QObject* parent = 0);
|
||||||
|
|
||||||
~TestRunner();
|
~TestRunner();
|
||||||
|
@ -62,7 +64,7 @@ public:
|
||||||
|
|
||||||
void evaluateResults();
|
void evaluateResults();
|
||||||
void automaticTestRunEvaluationComplete(QString zippedFolderName, int numberOfFailures);
|
void automaticTestRunEvaluationComplete(QString zippedFolderName, int numberOfFailures);
|
||||||
void addBuildNumberToResults(QString zippedFolderName);
|
void addBuildNumberAndHostnameToResults(QString zippedFolderName);
|
||||||
|
|
||||||
void copyFolder(const QString& source, const QString& destination);
|
void copyFolder(const QString& source, const QString& destination);
|
||||||
|
|
||||||
|
@ -115,7 +117,7 @@ private:
|
||||||
QCheckBox* _runServerless;
|
QCheckBox* _runServerless;
|
||||||
QCheckBox* _runLatest;
|
QCheckBox* _runLatest;
|
||||||
QTextEdit* _url;
|
QTextEdit* _url;
|
||||||
|
QPushButton* _runNow;
|
||||||
QTimer* _timer;
|
QTimer* _timer;
|
||||||
|
|
||||||
QFile _logFile;
|
QFile _logFile;
|
||||||
|
|
|
@ -36,7 +36,7 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
|
||||||
_ui.statusLabel->setText("");
|
_ui.statusLabel->setText("");
|
||||||
_ui.plainTextEdit->setReadOnly(true);
|
_ui.plainTextEdit->setReadOnly(true);
|
||||||
|
|
||||||
setWindowTitle("Auto Tester - v5.0");
|
setWindowTitle("Auto Tester - v5.1");
|
||||||
|
|
||||||
// Coming soon to an auto-tester near you...
|
// Coming soon to an auto-tester near you...
|
||||||
//// _helpWindow.textBrowser->setText()
|
//// _helpWindow.textBrowser->setText()
|
||||||
|
@ -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);
|
_testRunner = new TestRunner(dayCheckboxes, timeEditCheckboxes, timeEdits, _ui.workingFolderLabel, _ui.checkBoxServerless, _ui.checkBoxRunLatest, _ui.urlTextEdit, _ui.runNowButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine,
|
void AutoTester::startTestsEvaluation(const bool isRunningFromCommandLine,
|
||||||
|
|
Loading…
Reference in a new issue