Renamed TestRunner class to TestRunnerDesktop.

This commit is contained in:
NissimHadar 2019-01-22 13:37:45 -08:00
parent 4099fe333b
commit 7800a0bddc
4 changed files with 34 additions and 34 deletions

View file

@ -83,7 +83,7 @@ void Nitpick::setup() {
if (_testRunner) { if (_testRunner) {
delete _testRunner; delete _testRunner;
} }
_testRunner = new TestRunner(dayCheckboxes, timeEditCheckboxes, timeEdits, _ui.workingFolderLabel, _ui.checkBoxServerless, _ui.checkBoxRunLatest, _ui.urlLineEdit, _ui.runNowButton); _testRunner = new TestRunnerDesktop(dayCheckboxes, timeEditCheckboxes, timeEdits, _ui.workingFolderLabel, _ui.checkBoxServerless, _ui.checkBoxRunLatest, _ui.urlLineEdit, _ui.runNowButton);
} }
void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine, void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine,

View file

@ -18,7 +18,7 @@
#include "Downloader.h" #include "Downloader.h"
#include "Test.h" #include "Test.h"
#include "TestRunner.h" #include "TestRunnerDesktop.h"
#include "AWSInterface.h" #include "AWSInterface.h"
class Nitpick : public QMainWindow { class Nitpick : public QMainWindow {
@ -96,7 +96,7 @@ private slots:
private: private:
Ui::NitpickClass _ui; Ui::NitpickClass _ui;
Test* _test{ nullptr }; Test* _test{ nullptr };
TestRunner* _testRunner{ nullptr }; TestRunnerDesktop* _testRunner{ nullptr };
AWSInterface _awsInterface; AWSInterface _awsInterface;

View file

@ -1,5 +1,5 @@
// //
// TestRunner.cpp // TestRunnerDesktop.cpp
// //
// Created by Nissim Hadar on 1 Sept 2018. // Created by Nissim Hadar on 1 Sept 2018.
// Copyright 2013 High Fidelity, Inc. // Copyright 2013 High Fidelity, Inc.
@ -7,7 +7,7 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#include "TestRunner.h" #include "TestRunnerDesktop.h"
#include <QThread> #include <QThread>
#include <QtWidgets/QMessageBox> #include <QtWidgets/QMessageBox>
@ -24,7 +24,7 @@ extern Nitpick* nitpick;
// TODO: for debug // TODO: for debug
#include <iostream> #include <iostream>
TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes, TestRunnerDesktop::TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
std::vector<QCheckBox*> timeEditCheckboxes, std::vector<QCheckBox*> timeEditCheckboxes,
std::vector<QTimeEdit*> timeEdits, std::vector<QTimeEdit*> timeEdits,
QLabel* workingFolderLabel, QLabel* workingFolderLabel,
@ -60,7 +60,7 @@ TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
connect(_interfaceWorker, SIGNAL(commandComplete()), this, SLOT(interfaceExecutionComplete())); connect(_interfaceWorker, SIGNAL(commandComplete()), this, SLOT(interfaceExecutionComplete()));
} }
TestRunner::~TestRunner() { TestRunnerDesktop::~TestRunnerDesktop() {
delete _installerThread; delete _installerThread;
delete _installerWorker; delete _installerWorker;
@ -72,7 +72,7 @@ TestRunner::~TestRunner() {
} }
} }
void TestRunner::setWorkingFolder() { void TestRunnerDesktop::setWorkingFolder() {
// Everything will be written to this folder // Everything will be written to this folder
QString previousSelection = _workingFolder; QString previousSelection = _workingFolder;
QString parent = previousSelection.left(previousSelection.lastIndexOf('/')); QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
@ -181,7 +181,7 @@ void TestRunner::setWorkingFolder() {
#endif #endif
} }
void TestRunner::run() { void TestRunnerDesktop::run() {
_runNow->setEnabled(false); _runNow->setEnabled(false);
_testStartDateTime = QDateTime::currentDateTime(); _testStartDateTime = QDateTime::currentDateTime();
@ -211,7 +211,7 @@ void TestRunner::run() {
// `downloadComplete` will run after download has completed // `downloadComplete` will run after download has completed
} }
void TestRunner::downloadComplete() { void TestRunnerDesktop::downloadComplete() {
if (!buildXMLDownloaded) { if (!buildXMLDownloaded) {
// Download of Build XML has completed // Download of Build XML has completed
buildXMLDownloaded = true; buildXMLDownloaded = true;
@ -254,7 +254,7 @@ void TestRunner::downloadComplete() {
} }
} }
void TestRunner::runInstaller() { void TestRunnerDesktop::runInstaller() {
// Qt cannot start an installation process using QProcess::start (Qt Bug 9761) // Qt cannot start an installation process using QProcess::start (Qt Bug 9761)
// To allow installation, the installer is run using the `system` command // To allow installation, the installer is run using the `system` command
@ -302,7 +302,7 @@ void TestRunner::runInstaller() {
emit startInstaller(); emit startInstaller();
} }
void TestRunner::installationComplete() { void TestRunnerDesktop::installationComplete() {
verifyInstallationSucceeded(); verifyInstallationSucceeded();
createSnapshotFolder(); createSnapshotFolder();
@ -316,7 +316,7 @@ void TestRunner::installationComplete() {
runInterfaceWithTestScript(); runInterfaceWithTestScript();
} }
void TestRunner::verifyInstallationSucceeded() { void TestRunnerDesktop::verifyInstallationSucceeded() {
// Exit if the executables are missing. // Exit if the executables are missing.
// On Windows, the reason is probably that UAC has blocked the installation. This is treated as a critical error // On Windows, the reason is probably that UAC has blocked the installation. This is treated as a critical error
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -331,7 +331,7 @@ void TestRunner::verifyInstallationSucceeded() {
#endif #endif
} }
void TestRunner::saveExistingHighFidelityAppDataFolder() { void TestRunnerDesktop::saveExistingHighFidelityAppDataFolder() {
QString dataDirectory{ "NOT FOUND" }; QString dataDirectory{ "NOT FOUND" };
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming"; dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
@ -369,7 +369,7 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() {
} }
} }
void TestRunner::createSnapshotFolder() { void TestRunnerDesktop::createSnapshotFolder() {
_snapshotFolder = _workingFolder + "/" + SNAPSHOT_FOLDER_NAME; _snapshotFolder = _workingFolder + "/" + SNAPSHOT_FOLDER_NAME;
// Just delete all PNGs from the folder if it already exists // Just delete all PNGs from the folder if it already exists
@ -390,7 +390,7 @@ void TestRunner::createSnapshotFolder() {
} }
} }
void TestRunner::killProcesses() { void TestRunnerDesktop::killProcesses() {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
try { try {
QStringList processesToKill = QStringList() << "interface.exe" QStringList processesToKill = QStringList() << "interface.exe"
@ -450,7 +450,7 @@ void TestRunner::killProcesses() {
#endif #endif
} }
void TestRunner::startLocalServerProcesses() { void TestRunnerDesktop::startLocalServerProcesses() {
QString commandLine; QString commandLine;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -471,7 +471,7 @@ void TestRunner::startLocalServerProcesses() {
QThread::sleep(20); QThread::sleep(20);
} }
void TestRunner::runInterfaceWithTestScript() { void TestRunnerDesktop::runInterfaceWithTestScript() {
QString url = QString("hifi://localhost"); QString url = QString("hifi://localhost");
if (_runServerless->isChecked()) { if (_runServerless->isChecked()) {
// Move to an empty area // Move to an empty area
@ -562,7 +562,7 @@ void TestRunner::runInterfaceWithTestScript() {
appendLog(commandLine); appendLog(commandLine);
} }
void TestRunner::interfaceExecutionComplete() { void TestRunnerDesktop::interfaceExecutionComplete() {
QFileInfo testCompleted(QDir::toNativeSeparators(_snapshotFolder) +"/tests_completed.txt"); QFileInfo testCompleted(QDir::toNativeSeparators(_snapshotFolder) +"/tests_completed.txt");
if (!testCompleted.exists()) { if (!testCompleted.exists()) {
QMessageBox::critical(0, "Tests not completed", "Interface seems to have crashed before completion of the test scripts\nExisting images will be evaluated"); QMessageBox::critical(0, "Tests not completed", "Interface seems to have crashed before completion of the test scripts\nExisting images will be evaluated");
@ -575,12 +575,12 @@ void TestRunner::interfaceExecutionComplete() {
// The High Fidelity AppData folder will be restored after evaluation has completed // The High Fidelity AppData folder will be restored after evaluation has completed
} }
void TestRunner::evaluateResults() { void TestRunnerDesktop::evaluateResults() {
updateStatusLabel("Evaluating results"); updateStatusLabel("Evaluating results");
nitpick->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user); nitpick->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
} }
void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder, int numberOfFailures) { void TestRunnerDesktop::automaticTestRunEvaluationComplete(QString zippedFolder, int numberOfFailures) {
addBuildNumberToResults(zippedFolder); addBuildNumberToResults(zippedFolder);
restoreHighFidelityAppDataFolder(); restoreHighFidelityAppDataFolder();
@ -606,7 +606,7 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder, int nu
_runNow->setEnabled(true); _runNow->setEnabled(true);
} }
void TestRunner::addBuildNumberToResults(QString zippedFolderName) { void TestRunnerDesktop::addBuildNumberToResults(QString zippedFolderName) {
QString augmentedFilename; QString augmentedFilename;
if (!_runLatest->isChecked()) { if (!_runLatest->isChecked()) {
augmentedFilename = zippedFolderName.replace("local", getPRNumberFromURL(_url->text())); augmentedFilename = zippedFolderName.replace("local", getPRNumberFromURL(_url->text()));
@ -616,7 +616,7 @@ void TestRunner::addBuildNumberToResults(QString zippedFolderName) {
QFile::rename(zippedFolderName, augmentedFilename); QFile::rename(zippedFolderName, augmentedFilename);
} }
void TestRunner::restoreHighFidelityAppDataFolder() { void TestRunnerDesktop::restoreHighFidelityAppDataFolder() {
_appDataFolder.removeRecursively(); _appDataFolder.removeRecursively();
if (_savedAppDataFolder != QDir()) { if (_savedAppDataFolder != QDir()) {
@ -625,7 +625,7 @@ void TestRunner::restoreHighFidelityAppDataFolder() {
} }
// Copies a folder recursively // Copies a folder recursively
void TestRunner::copyFolder(const QString& source, const QString& destination) { void TestRunnerDesktop::copyFolder(const QString& source, const QString& destination) {
try { try {
if (!QFileInfo(source).isDir()) { if (!QFileInfo(source).isDir()) {
// just a file copy // just a file copy
@ -656,7 +656,7 @@ void TestRunner::copyFolder(const QString& source, const QString& destination) {
} }
} }
void TestRunner::checkTime() { void TestRunnerDesktop::checkTime() {
// No processing is done if a test is running // No processing is done if a test is running
if (_automatedTestIsRunning) { if (_automatedTestIsRunning) {
return; return;
@ -685,11 +685,11 @@ void TestRunner::checkTime() {
} }
} }
void TestRunner::updateStatusLabel(const QString& message) { void TestRunnerDesktop::updateStatusLabel(const QString& message) {
nitpick->updateStatusLabel(message); nitpick->updateStatusLabel(message);
} }
void TestRunner::appendLog(const QString& message) { void TestRunnerDesktop::appendLog(const QString& message) {
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) { if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
"Could not open the log file"); "Could not open the log file");
@ -703,7 +703,7 @@ void TestRunner::appendLog(const QString& message) {
nitpick->appendLogWindow(message); nitpick->appendLogWindow(message);
} }
QString TestRunner::getInstallerNameFromURL(const QString& url) { QString TestRunnerDesktop::getInstallerNameFromURL(const QString& url) {
// An example URL: https://deployment.highfidelity.com/jobs/pr-build/label%3Dwindows/13023/HighFidelity-Beta-Interface-PR14006-be76c43.exe // An example URL: https://deployment.highfidelity.com/jobs/pr-build/label%3Dwindows/13023/HighFidelity-Beta-Interface-PR14006-be76c43.exe
// On Mac, replace `exe` with `dmg` // On Mac, replace `exe` with `dmg`
try { try {
@ -718,7 +718,7 @@ QString TestRunner::getInstallerNameFromURL(const QString& url) {
} }
} }
QString TestRunner::getPRNumberFromURL(const QString& url) { QString TestRunnerDesktop::getPRNumberFromURL(const QString& url) {
try { try {
QStringList urlParts = url.split("/"); QStringList urlParts = url.split("/");
QStringList filenameParts = urlParts[urlParts.size() - 1].split("-"); QStringList filenameParts = urlParts[urlParts.size() - 1].split("-");
@ -739,7 +739,7 @@ QString TestRunner::getPRNumberFromURL(const QString& url) {
} }
} }
void TestRunner::parseBuildInformation() { void TestRunnerDesktop::parseBuildInformation() {
try { try {
QDomDocument domDocument; QDomDocument domDocument;
QString filename{ _workingFolder + "/" + DEV_BUILD_XML_FILENAME }; QString filename{ _workingFolder + "/" + DEV_BUILD_XML_FILENAME };

View file

@ -1,5 +1,5 @@
// //
// TestRunner.h // TestRunnerDesktop.h
// //
// Created by Nissim Hadar on 1 Sept 2018. // Created by Nissim Hadar on 1 Sept 2018.
// Copyright 2013 High Fidelity, Inc. // Copyright 2013 High Fidelity, Inc.
@ -29,10 +29,10 @@ public:
class Worker; class Worker;
class TestRunner : public QObject { class TestRunnerDesktop : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit TestRunner(std::vector<QCheckBox*> dayCheckboxes, explicit TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
std::vector<QCheckBox*> timeEditCheckboxes, std::vector<QCheckBox*> timeEditCheckboxes,
std::vector<QTimeEdit*> timeEdits, std::vector<QTimeEdit*> timeEdits,
QLabel* workingFolderLabel, QLabel* workingFolderLabel,
@ -42,7 +42,7 @@ public:
QPushButton* runNow, QPushButton* runNow,
QObject* parent = 0); QObject* parent = 0);
~TestRunner(); ~TestRunnerDesktop();
void setWorkingFolder(); void setWorkingFolder();