Removed unneeded sort order and renamed folder.

This commit is contained in:
NissimHadar 2018-11-30 18:54:33 -08:00
parent 5f9f1ab092
commit 6491ea23eb
5 changed files with 34 additions and 34 deletions

View file

@ -22,11 +22,11 @@ AWSInterface::AWSInterface(QObject* parent) : QObject(parent) {
}
void AWSInterface::createWebPageFromResults(const QString& testResults,
const QString& snapshotDirectory,
const QString& workingDirectory,
QCheckBox* updateAWSCheckBox,
QLineEdit* urlLineEdit) {
_testResults = testResults;
_snapshotDirectory = snapshotDirectory;
_workingDirectory = workingDirectory;
_urlLineEdit = urlLineEdit;
_urlLineEdit->setEnabled(false);
@ -44,13 +44,13 @@ void AWSInterface::extractTestFailuresFromZippedFolder() {
// the folder will be called `TestResults--2018-10-02_16-54-11(9426)[DESKTOP-PMKNLSQ]`
// and, this folder will be in the working directory
QStringList parts =_testResults.split('/');
QString zipFolderName = _snapshotDirectory + "/" + parts[parts.length() - 1].split('.')[0];
QString zipFolderName = _workingDirectory + "/" + parts[parts.length() - 1].split('.')[0];
if (QDir(zipFolderName).exists()) {
QDir dir = zipFolderName;
dir.removeRecursively();
}
JlCompress::extractDir(_testResults, _snapshotDirectory);
JlCompress::extractDir(_testResults, _workingDirectory);
}
void AWSInterface::createHTMLFile() {
@ -60,7 +60,7 @@ void AWSInterface::createHTMLFile() {
QString filename = pathComponents[pathComponents.length() - 1];
_resultsFolder = filename.left(filename.length() - 4);
QString resultsPath = _snapshotDirectory + "/" + _resultsFolder + "/";
QString resultsPath = _workingDirectory + "/" + _resultsFolder + "/";
QDir().mkdir(resultsPath);
_htmlFilename = resultsPath + HTML_FILENAME;
@ -156,7 +156,7 @@ void AWSInterface::writeTable(QTextStream& stream) {
// Note that failures are processed first, then successes
QStringList originalNamesFailures;
QStringList originalNamesSuccesses;
QDirIterator it1(QDir(_snapshotDirectory, "", QDir::Name));
QDirIterator it1(_workingDirectory);
while (it1.hasNext()) {
QString nextDirectory = it1.next();
@ -190,10 +190,10 @@ void AWSInterface::writeTable(QTextStream& stream) {
newNamesSuccesses.append(originalNamesSuccesses[i].split("--tests.")[1]);
}
_htmlFailuresFolder = _snapshotDirectory + "/" + _resultsFolder + "/" + FAILURES_FOLDER;
_htmlFailuresFolder = _workingDirectory + "/" + _resultsFolder + "/" + FAILURES_FOLDER;
QDir().mkdir(_htmlFailuresFolder);
_htmlSuccessesFolder = _snapshotDirectory + "/" + _resultsFolder + "/" + SUCCESSES_FOLDER;
_htmlSuccessesFolder = _workingDirectory + "/" + _resultsFolder + "/" + SUCCESSES_FOLDER;
QDir().mkdir(_htmlSuccessesFolder);
for (int i = 0; i < newNamesFailures.length(); ++i) {
@ -204,7 +204,7 @@ void AWSInterface::writeTable(QTextStream& stream) {
QDir().rename(originalNamesSuccesses[i], _htmlSuccessesFolder + "/" + newNamesSuccesses[i]);
}
QDirIterator it2(QDir(_htmlFailuresFolder, "", QDir::Name));
QDirIterator it2(_htmlFailuresFolder);
while (it2.hasNext()) {
QString nextDirectory = it2.next();
@ -239,7 +239,7 @@ void AWSInterface::writeTable(QTextStream& stream) {
stream << "\t" << "\t" << "<font color=\"blue\">\n";
stream << "\t" << "\t" << "<h1>The following tests passed:</h1>";
QDirIterator it3(QDir(_htmlSuccessesFolder, "", QDir::Name));
QDirIterator it3(_htmlSuccessesFolder);
while (it3.hasNext()) {
QString nextDirectory = it3.next();
@ -320,7 +320,7 @@ void AWSInterface::createEntry(int index, const QString& testResult, QTextStream
}
void AWSInterface::updateAWS() {
QString filename = _snapshotDirectory + "/updateAWS.py";
QString filename = _workingDirectory + "/updateAWS.py";
if (QFile::exists(filename)) {
QFile::remove(filename);
}
@ -337,7 +337,7 @@ void AWSInterface::updateAWS() {
stream << "import boto3\n";
stream << "s3 = boto3.resource('s3')\n\n";
QDirIterator it1(QDir(_htmlFailuresFolder, "", QDir::Name));
QDirIterator it1(_htmlFailuresFolder);
while (it1.hasNext()) {
QString nextDirectory = it1.next();
@ -351,20 +351,20 @@ void AWSInterface::updateAWS() {
QStringList parts = nextDirectory.split('/');
QString filename = parts[parts.length() - 3] + "/" + parts[parts.length() - 2] + "/" + parts[parts.length() - 1];
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Actual Image.png"
<< "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << filename << "/" << "Actual Image.png" << "', Body=data)\n\n";
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Expected Image.png"
<< "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << filename << "/" << "Expected Image.png" << "', Body=data)\n\n";
if (QFile::exists(_htmlFailuresFolder + "/" + parts[parts.length() - 1] + "/Difference Image.png")) {
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Difference Image.png"
<< "', 'rb')\n";
@ -372,7 +372,7 @@ void AWSInterface::updateAWS() {
}
}
QDirIterator it2(QDir(_htmlSuccessesFolder, "", QDir::Name));
QDirIterator it2(_htmlSuccessesFolder);
while (it2.hasNext()) {
QString nextDirectory = it2.next();
@ -386,20 +386,20 @@ void AWSInterface::updateAWS() {
QStringList parts = nextDirectory.split('/');
QString filename = parts[parts.length() - 3] + "/" + parts[parts.length() - 2] + "/" + parts[parts.length() - 1];
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Actual Image.png"
<< "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << filename << "/" << "Actual Image.png" << "', Body=data)\n\n";
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Expected Image.png"
<< "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << filename << "/" << "Expected Image.png" << "', Body=data)\n\n";
if (QFile::exists(_htmlSuccessesFolder + "/" + parts[parts.length() - 1] + "/Difference Image.png")) {
stream << "data = open('" << _snapshotDirectory << "/" << filename << "/"
stream << "data = open('" << _workingDirectory << "/" << filename << "/"
<< "Difference Image.png"
<< "', 'rb')\n";
@ -407,7 +407,7 @@ void AWSInterface::updateAWS() {
}
}
stream << "data = open('" << _snapshotDirectory << "/" << _resultsFolder << "/" << HTML_FILENAME << "', 'rb')\n";
stream << "data = open('" << _workingDirectory << "/" << _resultsFolder << "/" << HTML_FILENAME << "', 'rb')\n";
stream << "s3.Bucket('hifi-content').put_object(Bucket='" << AWS_BUCKET << "', Key='" << _resultsFolder << "/"
<< HTML_FILENAME << "', Body=data, ContentType='text/html')\n";

View file

@ -26,7 +26,7 @@ public:
explicit AWSInterface(QObject* parent = 0);
void createWebPageFromResults(const QString& testResults,
const QString& snapshotDirectory,
const QString& workingDirectory,
QCheckBox* updateAWSCheckBox,
QLineEdit* urlLineEdit);
@ -49,7 +49,7 @@ public:
private:
QString _testResults;
QString _snapshotDirectory;
QString _workingDirectory;
QString _resultsFolder;
QString _htmlFailuresFolder;
QString _htmlSuccessesFolder;

View file

@ -542,7 +542,7 @@ void Test::createAllMDFiles() {
createMDFile(_testsRootDirectory);
}
QDirIterator it(QDir(_testsRootDirectory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it(_testsRootDirectory, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString directory = it.next();
@ -636,7 +636,7 @@ void Test::createAllTestAutoScripts() {
createTestAutoScript(_testsRootDirectory);
}
QDirIterator it(QDir(_testsRootDirectory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it(_testsRootDirectory, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString directory = it.next();
@ -704,7 +704,7 @@ void Test::createAllRecursiveScripts() {
createRecursiveScript(_testsRootDirectory, false);
QDirIterator it(QDir(_testsRootDirectory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it(_testsRootDirectory, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString directory = it.next();
@ -716,7 +716,7 @@ void Test::createAllRecursiveScripts() {
// Only process directories that have sub-directories
bool hasNoSubDirectories{ true };
QDirIterator it2(QDir(directory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it2(directory, QDirIterator::Subdirectories);
while (it2.hasNext()) {
QString directory2 = it2.next();
@ -787,7 +787,7 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
testFound = true;
}
QDirIterator it(QDir(topLevelDirectory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it(topLevelDirectory, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString directory = it.next();
@ -858,7 +858,7 @@ void Test::createTestsOutline() {
int rootDepth { _testDirectory.count('/') };
// Each test is shown as the folder name linking to the matching GitHub URL, and the path to the associated test.md file
QDirIterator it(QDir(_testDirectory, "", QDir::Name), QDirIterator::Subdirectories);
QDirIterator it(_testDirectory, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString directory = it.next();
@ -1052,11 +1052,11 @@ void Test::createWebPage(QCheckBox* updateAWSCheckBox, QLineEdit* urlLineEdit) {
return;
}
QString snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select a folder to store temporary files in",
QString workingDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select a folder to store temporary files in",
nullptr, QFileDialog::ShowDirsOnly);
if (snapshotDirectory.isNull()) {
if (workingDirectory.isNull()) {
return;
}
_awsInterface.createWebPageFromResults(testResults, snapshotDirectory, updateAWSCheckBox, urlLineEdit);
_awsInterface.createWebPageFromResults(testResults, workingDirectory, updateAWSCheckBox, urlLineEdit);
}

View file

@ -275,7 +275,7 @@ void TestRailInterface::processDirectoryPython(const QString& directory,
const QString& userGitHub,
const QString& branchGitHub) {
// Loop over all entries in directory
QDirIterator it(QDir(directory, "", QDir::Name));
QDirIterator it(directory);
while (it.hasNext()) {
QString nextDirectory = it.next();
@ -855,7 +855,7 @@ QDomElement TestRailInterface::processDirectoryXML(const QString& directory,
QDomElement result = element;
// Loop over all entries in directory
QDirIterator it(QDir(directory, "", QDir::Name));
QDirIterator it(directory);
while (it.hasNext()) {
QString nextDirectory = it.next();

View file

@ -366,7 +366,7 @@ void TestRunner::createSnapshotFolder() {
// 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(QDir(_snapshotFolder, "", QDir::Name));
QDirIterator it(_snapshotFolder);
while (it.hasNext()) {
QString filename = it.next();
if (filename.right(4) == ".png" || filename.right(4) == ".jpg" || filename.right(4) == ".txt") {