Merge pull request #14454 from NissimHadar/19991-MacAppData

case 19991 - implement AppData for Mac
This commit is contained in:
Shannon Romano 2018-11-30 11:38:21 -08:00 committed by GitHub
commit f3c0118602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 39 deletions

View file

@ -50,10 +50,12 @@ if (WIN32)
)
# add a custom command to copy the empty Apps/Data High Fidelity folder (i.e. - a valid folder with no entities)
# this also copied to the containing folder, to facilitate running from Visual Studio
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "$<TARGET_FILE_DIR:${TARGET_NAME}>/AppDataHighFidelity"
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "AppDataHighFidelity"
)
# add a custom command to copy the SSL DLLs
@ -62,5 +64,12 @@ if (WIN32)
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "$ENV{VCPKG_ROOT}/installed/x64-windows/bin" "$<TARGET_FILE_DIR:${TARGET_NAME}>"
)
elseif (APPLE)
# add a custom command to copy the empty Apps/Data High Fidelity folder (i.e. - a valid folder with no entities)
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "$<TARGET_FILE_DIR:${TARGET_NAME}>/AppDataHighFidelity"
)
endif ()
endif ()

View file

@ -1,6 +1,6 @@
# nitpick
Nitpick is a stand alone application that provides a mechanism for regression testing. The general idea is simple:
Nitpick is a stand alone application that provides a mechanism for regression testing. The general idea is simple:
* Each test folder has a script that produces a set of snapshots.
* The snapshots are compared to a 'canonical' set of images that have been produced beforehand.
* The result, if any test failed, is a zipped folder describing the failure.
@ -22,9 +22,9 @@ Nitpick is built as part of the High Fidelity build.
1. Select all, right-click and select 7-Zip->Add to archive...
1. Set Archive format to 7z
1. Check "Create SFX archive
1. Enter installer name (i.e. `nitpick-installer-v1.0.exe`)
1. Enter installer name (i.e. `nitpick-installer-v1.1.exe`)
1. Click "OK"
1. Copy created installer to https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.0.exe: aws s3 cp nitpick-installer-v1.0.exe s3://hifi-qa/nitpick/Mac/nitpick-installer-v1.0.exe
1. Copy created installer to https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.1.exe: aws s3 cp nitpick-installer-v1.1.exe s3://hifi-qa/nitpick/Mac/nitpick-installer-v1.1.exe
#### Mac
These steps assume the hifi repository has been cloned to `~/hifi`.
1. (first time) Install brew
@ -37,12 +37,12 @@ These steps assume the hifi repository has been cloned to `~/hifi`.
1. Change the loader instruction to find the dynamic library locally
In a terminal: `install_name_tool -change ~/hifi/build/ext/Xcode/quazip/project/lib/libquazip5.1.dylib libquazip5.1.dylib nitpick`
1. Delete any existing disk images. In a terminal: `rm *.dmg`
1. Create installer (note final period).In a terminal: `create-dmg --volname nitpick-installer-v1.0 nitpick-installer-v1.0.dmg .`
1. Create installer (note final period).In a terminal: `create-dmg --volname nitpick-installer-v1.1 nitpick-installer-v1.1.dmg .`
Make sure to wait for completion.
1. Copy created installer to AWS: `~/Library/Python/3.7/bin/aws s3 cp nitpick-installer-v1.0.dmg s3://hifi-qa/nitpick/Mac/nitpick-installer-v1.0.dmg`
1. Copy created installer to AWS: `~/Library/Python/3.7/bin/aws s3 cp nitpick-installer-v1.1.dmg s3://hifi-qa/nitpick/Mac/nitpick-installer-v1.1.dmg`
### Installation
#### Windows
1. (First time) download and install vc_redist.x64.exe (available at https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.0.exe)
1. (First time) download and install vc_redist.x64.exe (available at https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.1.exe)
1. (First time) download and install Python 3 from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/python-3.7.0-amd64.exe (also located at https://www.python.org/downloads/)
1. After installation - create an environment variable called PYTHON_PATH and set it to the folder containing the Python executable.
1. (First time) download and install AWS CLI from https://hifi-qa.s3.amazonaws.com/nitpick/Windows/AWSCLI64PY3.msi (also available at https://aws.amazon.com/cli/
@ -52,7 +52,7 @@ These steps assume the hifi repository has been cloned to `~/hifi`.
1. Leave region name and ouput format as default [None]
1. Install the latest release of Boto3 via pip: `pip install boto3`
1. Download the installer by browsing to [here](<https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.0.exe>)
1. Download the installer by browsing to [here](<https://hifi-qa.s3.amazonaws.com/nitpick/Windows/nitpick-installer-v1.1.exe>)
1. Double click on the installer and install to a convenient location
![](./setup_7z.PNG)
@ -76,14 +76,14 @@ In a terminal: `python3 get-pip.py --user`
1. Enter the secret key
1. Leave region name and ouput format as default [None]
1. Install the latest release of Boto3 via pip: pip3 install boto3
1. Download the installer by browsing to [here](<https://hifi-qa.s3.amazonaws.com/nitpick/Mac/nitpick-installer-v1.0.dmg>).
1. Download the installer by browsing to [here](<https://hifi-qa.s3.amazonaws.com/nitpick/Mac/nitpick-installer-v1.1.dmg>).
1. Double-click on the downloaded image to mount it
1. Create a folder for the nitpick files (e.g. ~/nitpick)
If this folder exists then delete all it's contents.
1. Copy the downloaded files to the folder
In a terminal:
`cd ~/nitpick`
`cp -r /Volumes/nitpick-installer-v1.0/* .`
`cp -r /Volumes/nitpick-installer-v1.1/* .`
1. __To run nitpick, cd to the folder that you copied to and run `./nitpick`__
# Usage

View file

@ -12,12 +12,12 @@
#include <QtWidgets/QMessageBox>
Downloader::Downloader(QUrl fileURL, QObject *parent) : QObject(parent) {
_networkAccessManager.get(QNetworkRequest(fileURL));
connect(
&_networkAccessManager, SIGNAL (finished(QNetworkReply*)),
this, SLOT (fileDownloaded(QNetworkReply*))
);
_networkAccessManager.get(QNetworkRequest(fileURL));
}
void Downloader::fileDownloaded(QNetworkReply* reply) {

View file

@ -620,7 +620,7 @@ void Test::createTestAutoScript() {
}
if (createTestAutoScript(_testDirectory)) {
QMessageBox::information(0, "Success", "'nitpick.js` script has been created");
QMessageBox::information(0, "Success", "'testAuto.js` script has been created");
}
}
@ -677,7 +677,7 @@ bool Test::createTestAutoScript(const QString& directory) {
stream << "if (typeof PATH_TO_THE_REPO_PATH_UTILS_FILE === 'undefined') PATH_TO_THE_REPO_PATH_UTILS_FILE = 'https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js';\n";
stream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);\n";
stream << "var nitpick = createAutoTester(Script.resolvePath('.'));\n\n";
stream << "var nitpick = createNitpick(Script.resolvePath('.'));\n\n";
stream << "nitpick.enableAuto();\n\n";
stream << "Script.include('./test.js?raw=true');\n";
@ -748,9 +748,9 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
QTextStream textStream(&allTestsFilename);
textStream << "// This is an automatically generated file, created by auto-tester" << endl;
textStream << "// This is an automatically generated file, created by nitpick" << endl;
// Include 'autoTest.js'
// Include 'nitpick.js'
QString branch = nitpick->getSelectedBranch();
QString user = nitpick->getSelectedUser();
@ -758,7 +758,7 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
"/tests/utils/branchUtils.js\";"
<< endl;
textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << endl;
textStream << "var nitpick = createAutoTester(Script.resolvePath(\".\"));" << endl << endl;
textStream << "var nitpick = createNitpick(Script.resolvePath(\".\"));" << endl << endl;
textStream << "var testsRootPath = nitpick.getTestsRootPath();" << endl << endl;

View file

@ -332,23 +332,23 @@ void TestRunner::verifyInstallationSucceeded() {
}
void TestRunner::saveExistingHighFidelityAppDataFolder() {
#ifdef Q_OS_WIN
QString dataDirectory{ "NOT FOUND" };
#ifdef Q_OS_WIN
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
#elif defined Q_OS_MAC
dataDirectory = QDir::homePath() + "/Library/Application Support";
#endif
if (_runLatest->isChecked()) {
_appDataFolder = dataDirectory + "\\High Fidelity";
_appDataFolder = dataDirectory + "/High Fidelity";
} else {
// We are running a PR build
_appDataFolder = dataDirectory + "\\High Fidelity - " + getPRNumberFromURL(_url->text());
_appDataFolder = dataDirectory + "/High Fidelity - " + getPRNumberFromURL(_url->text());
}
_savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME;
if (_savedAppDataFolder.exists()) {
if (QDir(_savedAppDataFolder).exists()) {
_savedAppDataFolder.removeRecursively();
}
if (_appDataFolder.exists()) {
// The original folder is saved in a unique name
_appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path());
@ -356,9 +356,6 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() {
// Copy an "empty" AppData folder (i.e. no entities)
copyFolder(QDir::currentPath() + "/AppDataHighFidelity", _appDataFolder.path());
#elif defined Q_OS_MAC
// TODO: find Mac equivalent of AppData
#endif
}
void TestRunner::createSnapshotFolder() {
@ -469,12 +466,7 @@ void TestRunner::runInterfaceWithTestScript() {
// Move to an empty area
url = "file:///~serverless/tutorial.json";
} else {
#ifdef Q_OS_WIN
url = "hifi://localhost";
#elif defined Q_OS_MAC
// TODO: Find out Mac equivalent of AppData, then this won't be needed
url = "hifi://localhost/9999,9999,9999";
#endif
}
QString testScript =
@ -535,8 +527,6 @@ void TestRunner::runInterfaceWithTestScript() {
}
void TestRunner::interfaceExecutionComplete() {
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\nExisting images will be evaluated");
@ -544,6 +534,8 @@ void TestRunner::interfaceExecutionComplete() {
evaluateResults();
killProcesses();
// The High Fidelity AppData folder will be restored after evaluation has completed
}
@ -589,15 +581,11 @@ void TestRunner::addBuildNumberToResults(QString zippedFolderName) {
}
void TestRunner::restoreHighFidelityAppDataFolder() {
#ifdef Q_OS_WIN
_appDataFolder.removeRecursively();
if (_savedAppDataFolder != QDir()) {
_appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path());
}
#elif defined Q_OS_MAC
// TODO: find Mac equivalent of AppData
#endif
}
// Copies a folder recursively

View file

@ -36,7 +36,7 @@ Nitpick::Nitpick(QWidget* parent) : QMainWindow(parent) {
_ui.statusLabel->setText("");
_ui.plainTextEdit->setReadOnly(true);
setWindowTitle("Nitpick - v1.0");
setWindowTitle("Nitpick - v1.1");
// Coming soon to a nitpick near you...
//// _helpWindow.textBrowser->setText()