mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:37:20 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into punk
This commit is contained in:
commit
7efd5964bd
32 changed files with 2312 additions and 209 deletions
|
@ -112,11 +112,14 @@ void MaterialEntityRenderer::doRender(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.setModelTransform(renderTransform);
|
batch.setModelTransform(renderTransform);
|
||||||
drawMaterial->setTextureTransforms(textureTransform);
|
|
||||||
|
|
||||||
// bind the material
|
if (args->_renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) {
|
||||||
RenderPipelines::bindMaterial(drawMaterial, batch, args->_enableTexturing);
|
drawMaterial->setTextureTransforms(textureTransform);
|
||||||
args->_details._materialSwitches++;
|
|
||||||
|
// bind the material
|
||||||
|
RenderPipelines::bindMaterial(drawMaterial, batch, args->_enableTexturing);
|
||||||
|
args->_details._materialSwitches++;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw!
|
// Draw!
|
||||||
DependencyManager::get<GeometryCache>()->renderSphere(batch);
|
DependencyManager::get<GeometryCache>()->renderSphere(batch);
|
||||||
|
|
|
@ -268,8 +268,10 @@ void ShapeEntityRenderer::doRender(RenderArgs* args) {
|
||||||
geometryCache->renderSolidShapeInstance(args, batch, geometryShape, outColor, pipeline);
|
geometryCache->renderSolidShapeInstance(args, batch, geometryShape, outColor, pipeline);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RenderPipelines::bindMaterial(mat, batch, args->_enableTexturing);
|
if (args->_renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) {
|
||||||
args->_details._materialSwitches++;
|
RenderPipelines::bindMaterial(mat, batch, args->_enableTexturing);
|
||||||
|
args->_details._materialSwitches++;
|
||||||
|
}
|
||||||
|
|
||||||
geometryCache->renderShape(batch, geometryShape);
|
geometryCache->renderShape(batch, geometryShape);
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,14 @@ vec3 fetchLightmapMap(vec2 uv) {
|
||||||
|
|
||||||
<@func discardTransparent(opacity)@>
|
<@func discardTransparent(opacity)@>
|
||||||
{
|
{
|
||||||
if (<$opacity$> < 1e-6) {
|
if (<$opacity$> < 1.0) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<@endfunc@>
|
||||||
|
<@func discardInvisible(opacity)@>
|
||||||
|
{
|
||||||
|
if (<$opacity$> < 1.e-6) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,8 +157,10 @@ void MeshPartPayload::render(RenderArgs* args) {
|
||||||
bindMesh(batch);
|
bindMesh(batch);
|
||||||
|
|
||||||
// apply material properties
|
// apply material properties
|
||||||
RenderPipelines::bindMaterial(!_drawMaterials.empty() ? _drawMaterials.top().material : DEFAULT_MATERIAL, batch, args->_enableTexturing);
|
if (args->_renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) {
|
||||||
args->_details._materialSwitches++;
|
RenderPipelines::bindMaterial(!_drawMaterials.empty() ? _drawMaterials.top().material : DEFAULT_MATERIAL, batch, args->_enableTexturing);
|
||||||
|
args->_details._materialSwitches++;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw!
|
// Draw!
|
||||||
{
|
{
|
||||||
|
@ -417,8 +419,10 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
|
||||||
bindMesh(batch);
|
bindMesh(batch);
|
||||||
|
|
||||||
// apply material properties
|
// apply material properties
|
||||||
RenderPipelines::bindMaterial(!_drawMaterials.empty() ? _drawMaterials.top().material : DEFAULT_MATERIAL, batch, args->_enableTexturing);
|
if (args->_renderMode != render::Args::RenderMode::SHADOW_RENDER_MODE) {
|
||||||
args->_details._materialSwitches++;
|
RenderPipelines::bindMaterial(!_drawMaterials.empty() ? _drawMaterials.top().material : DEFAULT_MATERIAL, batch, args->_enableTexturing);
|
||||||
|
args->_details._materialSwitches++;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw!
|
// Draw!
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -47,7 +47,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -57,7 +57,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -34,7 +34,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void main(void) {
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||||
<$discardTransparent(opacity)$>;
|
<$discardInvisible(opacity)$>;
|
||||||
|
|
||||||
vec3 albedo = getMaterialAlbedo(mat);
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
|
|
@ -294,7 +294,19 @@ glm::vec3 safeEulerAngles(const glm::quat& q) {
|
||||||
|
|
||||||
// Helper function returns the positive angle (in radians) between two 3D vectors
|
// Helper function returns the positive angle (in radians) between two 3D vectors
|
||||||
float angleBetween(const glm::vec3& v1, const glm::vec3& v2) {
|
float angleBetween(const glm::vec3& v1, const glm::vec3& v2) {
|
||||||
return acosf((glm::dot(v1, v2)) / (glm::length(v1) * glm::length(v2)));
|
float lengthFactor = glm::length(v1) * glm::length(v2);
|
||||||
|
|
||||||
|
if (lengthFactor < EPSILON) {
|
||||||
|
qWarning() << "DANGER: don't supply zero-length vec3's as arguments";
|
||||||
|
}
|
||||||
|
|
||||||
|
float cosAngle = glm::dot(v1, v2) / lengthFactor;
|
||||||
|
// If v1 and v2 are colinear, then floating point rounding errors might cause
|
||||||
|
// cosAngle to be slightly higher than 1 or slightly lower than -1
|
||||||
|
// which is are values for which acos is not defined and result in a NaN
|
||||||
|
// So we clamp the value to insure the value is in the correct range
|
||||||
|
cosAngle = glm::clamp(cosAngle, -1.0f, 1.0f);
|
||||||
|
return acosf(cosAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function return the rotation from the first vector onto the second
|
// Helper function return the rotation from the first vector onto the second
|
||||||
|
|
|
@ -38,30 +38,34 @@ getGrabPointSphereOffset = function(handController, ignoreSensorToWorldScale) {
|
||||||
getControllerWorldLocation = function (handController, doOffset) {
|
getControllerWorldLocation = function (handController, doOffset) {
|
||||||
var orientation;
|
var orientation;
|
||||||
var position;
|
var position;
|
||||||
var pose = Controller.getPoseValue(handController);
|
var valid = false;
|
||||||
var valid = pose.valid;
|
|
||||||
var controllerJointIndex;
|
if (handController >= 0) {
|
||||||
if (pose.valid) {
|
var pose = Controller.getPoseValue(handController);
|
||||||
if (handController === Controller.Standard.RightHand) {
|
valid = pose.valid;
|
||||||
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND");
|
var controllerJointIndex;
|
||||||
} else {
|
if (pose.valid) {
|
||||||
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
if (handController === Controller.Standard.RightHand) {
|
||||||
}
|
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND");
|
||||||
orientation = Quat.multiply(MyAvatar.orientation, MyAvatar.getAbsoluteJointRotationInObjectFrame(controllerJointIndex));
|
} else {
|
||||||
position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, MyAvatar.getAbsoluteJointTranslationInObjectFrame(controllerJointIndex)));
|
controllerJointIndex = MyAvatar.getJointIndex("_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
|
||||||
|
}
|
||||||
|
orientation = Quat.multiply(MyAvatar.orientation, MyAvatar.getAbsoluteJointRotationInObjectFrame(controllerJointIndex));
|
||||||
|
position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, MyAvatar.getAbsoluteJointTranslationInObjectFrame(controllerJointIndex)));
|
||||||
|
|
||||||
// add to the real position so the grab-point is out in front of the hand, a bit
|
// add to the real position so the grab-point is out in front of the hand, a bit
|
||||||
if (doOffset) {
|
if (doOffset) {
|
||||||
var offset = getGrabPointSphereOffset(handController);
|
var offset = getGrabPointSphereOffset(handController);
|
||||||
position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, offset));
|
position = Vec3.sum(position, Vec3.multiplyQbyV(orientation, offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!HMD.isHandControllerAvailable()) {
|
} else if (!HMD.isHandControllerAvailable()) {
|
||||||
// NOTE: keep this offset in sync with scripts/system/controllers/handControllerPointer.js:493
|
// NOTE: keep this offset in sync with scripts/system/controllers/handControllerPointer.js:493
|
||||||
var VERTICAL_HEAD_LASER_OFFSET = 0.1 * MyAvatar.sensorToWorldScale;
|
var VERTICAL_HEAD_LASER_OFFSET = 0.1 * MyAvatar.sensorToWorldScale;
|
||||||
position = Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, {x: 0, y: VERTICAL_HEAD_LASER_OFFSET, z: 0}));
|
position = Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, {x: 0, y: VERTICAL_HEAD_LASER_OFFSET, z: 0}));
|
||||||
orientation = Quat.multiply(Camera.orientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
|
orientation = Quat.multiply(Camera.orientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
|
||||||
valid = true;
|
valid = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {position: position,
|
return {position: position,
|
||||||
|
|
|
@ -5,7 +5,7 @@ project(${TARGET_NAME})
|
||||||
SET (CMAKE_AUTOUIC ON)
|
SET (CMAKE_AUTOUIC ON)
|
||||||
SET (CMAKE_AUTOMOC ON)
|
SET (CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
setup_hifi_project (Core Widgets Network)
|
setup_hifi_project (Core Widgets Network Xml)
|
||||||
link_hifi_libraries ()
|
link_hifi_libraries ()
|
||||||
|
|
||||||
# FIX: Qt was built with -reduce-relocations
|
# FIX: Qt was built with -reduce-relocations
|
||||||
|
@ -18,7 +18,7 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
include_directories (${Qt5Core_INCLUDE_DIRS})
|
include_directories (${Qt5Core_INCLUDE_DIRS})
|
||||||
include_directories (${Qt5Widgets_INCLUDE_DIRS})
|
include_directories (${Qt5Widgets_INCLUDE_DIRS})
|
||||||
|
|
||||||
set (QT_LIBRARIES Qt5::Core Qt5::Widgets)
|
set (QT_LIBRARIES Qt5::Core Qt5::Widgets QT::Gui Qt5::Xml)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Do not show Console
|
# Do not show Console
|
||||||
|
|
|
@ -24,7 +24,7 @@ extern AutoTester* autoTester;
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
Test::Test() {
|
Test::Test() {
|
||||||
mismatchWindow.setModal(true);
|
_mismatchWindow.setModal(true);
|
||||||
|
|
||||||
if (autoTester) {
|
if (autoTester) {
|
||||||
autoTester->setUserText("highfidelity");
|
autoTester->setUserText("highfidelity");
|
||||||
|
@ -34,35 +34,35 @@ Test::Test() {
|
||||||
|
|
||||||
bool Test::createTestResultsFolderPath(const QString& directory) {
|
bool Test::createTestResultsFolderPath(const QString& directory) {
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
testResultsFolderPath = directory + "/" + TEST_RESULTS_FOLDER + "--" + now.toString(DATETIME_FORMAT);
|
_testResultsFolderPath = directory + "/" + TEST_RESULTS_FOLDER + "--" + now.toString(DATETIME_FORMAT);
|
||||||
QDir testResultsFolder(testResultsFolderPath);
|
QDir testResultsFolder(_testResultsFolderPath);
|
||||||
|
|
||||||
// Create a new test results folder
|
// Create a new test results folder
|
||||||
return QDir().mkdir(testResultsFolderPath);
|
return QDir().mkdir(_testResultsFolderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::zipAndDeleteTestResultsFolder() {
|
void Test::zipAndDeleteTestResultsFolder() {
|
||||||
QString zippedResultsFileName { testResultsFolderPath + ".zip" };
|
QString zippedResultsFileName { _testResultsFolderPath + ".zip" };
|
||||||
QFileInfo fileInfo(zippedResultsFileName);
|
QFileInfo fileInfo(zippedResultsFileName);
|
||||||
if (!fileInfo.exists()) {
|
if (!fileInfo.exists()) {
|
||||||
QFile::remove(zippedResultsFileName);
|
QFile::remove(zippedResultsFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir testResultsFolder(testResultsFolderPath);
|
QDir testResultsFolder(_testResultsFolderPath);
|
||||||
if (!testResultsFolder.isEmpty()) {
|
if (!testResultsFolder.isEmpty()) {
|
||||||
JlCompress::compressDir(testResultsFolderPath + ".zip", testResultsFolderPath);
|
JlCompress::compressDir(_testResultsFolderPath + ".zip", _testResultsFolderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
testResultsFolder.removeRecursively();
|
testResultsFolder.removeRecursively();
|
||||||
|
|
||||||
//In all cases, for the next evaluation
|
//In all cases, for the next evaluation
|
||||||
testResultsFolderPath = "";
|
_testResultsFolderPath = "";
|
||||||
index = 1;
|
_index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar) {
|
bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar) {
|
||||||
progressBar->setMinimum(0);
|
progressBar->setMinimum(0);
|
||||||
progressBar->setMaximum(expectedImagesFullFilenames.length() - 1);
|
progressBar->setMaximum(_expectedImagesFullFilenames.length() - 1);
|
||||||
progressBar->setValue(0);
|
progressBar->setValue(0);
|
||||||
progressBar->setVisible(true);
|
progressBar->setVisible(true);
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar)
|
||||||
// Quit loop if user has aborted due to a failed test.
|
// Quit loop if user has aborted due to a failed test.
|
||||||
bool success{ true };
|
bool success{ true };
|
||||||
bool keepOn{ true };
|
bool keepOn{ true };
|
||||||
for (int i = 0; keepOn && i < expectedImagesFullFilenames.length(); ++i) {
|
for (int i = 0; keepOn && i < _expectedImagesFullFilenames.length(); ++i) {
|
||||||
// First check that images are the same size
|
// First check that images are the same size
|
||||||
QImage resultImage(resultImagesFullFilenames[i]);
|
QImage resultImage(_resultImagesFullFilenames[i]);
|
||||||
QImage expectedImage(expectedImagesFullFilenames[i]);
|
QImage expectedImage(_expectedImagesFullFilenames[i]);
|
||||||
|
|
||||||
double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical
|
double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical
|
||||||
|
|
||||||
|
@ -82,30 +82,30 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar)
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size");
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size");
|
||||||
similarityIndex = -100.0;
|
similarityIndex = -100.0;
|
||||||
} else {
|
} else {
|
||||||
similarityIndex = imageComparer.compareImages(resultImage, expectedImage);
|
similarityIndex = _imageComparer.compareImages(resultImage, expectedImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (similarityIndex < THRESHOLD) {
|
if (similarityIndex < THRESHOLD) {
|
||||||
TestFailure testFailure = TestFailure{
|
TestFailure testFailure = TestFailure{
|
||||||
(float)similarityIndex,
|
(float)similarityIndex,
|
||||||
expectedImagesFullFilenames[i].left(expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /)
|
_expectedImagesFullFilenames[i].left(_expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /)
|
||||||
QFileInfo(expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image
|
QFileInfo(_expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image
|
||||||
QFileInfo(resultImagesFullFilenames[i].toStdString().c_str()).fileName() // filename of result image
|
QFileInfo(_resultImagesFullFilenames[i].toStdString().c_str()).fileName() // filename of result image
|
||||||
};
|
};
|
||||||
|
|
||||||
mismatchWindow.setTestFailure(testFailure);
|
_mismatchWindow.setTestFailure(testFailure);
|
||||||
|
|
||||||
if (!isInteractiveMode) {
|
if (!isInteractiveMode) {
|
||||||
appendTestResultsToFile(testResultsFolderPath, testFailure, mismatchWindow.getComparisonImage());
|
appendTestResultsToFile(_testResultsFolderPath, testFailure, _mismatchWindow.getComparisonImage());
|
||||||
success = false;
|
success = false;
|
||||||
} else {
|
} else {
|
||||||
mismatchWindow.exec();
|
_mismatchWindow.exec();
|
||||||
|
|
||||||
switch (mismatchWindow.getUserResponse()) {
|
switch (_mismatchWindow.getUserResponse()) {
|
||||||
case USER_RESPONSE_PASS:
|
case USER_RESPONSE_PASS:
|
||||||
break;
|
break;
|
||||||
case USE_RESPONSE_FAIL:
|
case USE_RESPONSE_FAIL:
|
||||||
appendTestResultsToFile(testResultsFolderPath, testFailure, mismatchWindow.getComparisonImage());
|
appendTestResultsToFile(_testResultsFolderPath, testFailure, _mismatchWindow.getComparisonImage());
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
case USER_RESPONSE_ABORT:
|
case USER_RESPONSE_ABORT:
|
||||||
|
@ -126,20 +126,20 @@ bool Test::compareImageLists(bool isInteractiveMode, QProgressBar* progressBar)
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage) {
|
void Test::appendTestResultsToFile(const QString& _testResultsFolderPath, TestFailure testFailure, QPixmap comparisonImage) {
|
||||||
if (!QDir().exists(testResultsFolderPath)) {
|
if (!QDir().exists(_testResultsFolderPath)) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Folder " + testResultsFolderPath + " not found");
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Folder " + _testResultsFolderPath + " not found");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString err = QString::number(testFailure._error).left(6);
|
QString err = QString::number(testFailure._error).left(6);
|
||||||
|
|
||||||
QString failureFolderPath { testResultsFolderPath + "/" + err + "-Failure_" + QString::number(index) + "--" + testFailure._actualImageFilename.left(testFailure._actualImageFilename.length() - 4) };
|
QString failureFolderPath { _testResultsFolderPath + "/" + err + "-Failure_" + QString::number(_index) + "--" + testFailure._actualImageFilename.left(testFailure._actualImageFilename.length() - 4) };
|
||||||
if (!QDir().mkdir(failureFolderPath)) {
|
if (!QDir().mkdir(failureFolderPath)) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create folder " + failureFolderPath);
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create folder " + failureFolderPath);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
++index;
|
++_index;
|
||||||
|
|
||||||
QFile descriptionFile(failureFolderPath + "/" + TEST_RESULTS_FILENAME);
|
QFile descriptionFile(failureFolderPath + "/" + TEST_RESULTS_FILENAME);
|
||||||
if (!descriptionFile.open(QIODevice::ReadWrite)) {
|
if (!descriptionFile.open(QIODevice::ReadWrite)) {
|
||||||
|
@ -152,7 +152,7 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai
|
||||||
stream << "Test failed in folder " << testFailure._pathname.left(testFailure._pathname.length() - 1) << endl; // remove trailing '/'
|
stream << "Test failed in folder " << testFailure._pathname.left(testFailure._pathname.length() - 1) << endl; // remove trailing '/'
|
||||||
stream << "Expected image was " << testFailure._expectedImageFilename << endl;
|
stream << "Expected image was " << testFailure._expectedImageFilename << endl;
|
||||||
stream << "Actual image was " << testFailure._actualImageFilename << endl;
|
stream << "Actual image was " << testFailure._actualImageFilename << endl;
|
||||||
stream << "Similarity index was " << testFailure._error << endl;
|
stream << "Similarity _index was " << testFailure._error << endl;
|
||||||
|
|
||||||
descriptionFile.close();
|
descriptionFile.close();
|
||||||
|
|
||||||
|
@ -180,26 +180,26 @@ void Test::appendTestResultsToFile(const QString& testResultsFolderPath, TestFai
|
||||||
void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine, const QString& userFromCommandLine) {
|
void Test::startTestsEvaluation(const QString& testFolder, const QString& branchFromCommandLine, const QString& userFromCommandLine) {
|
||||||
if (testFolder.isNull()) {
|
if (testFolder.isNull()) {
|
||||||
// Get list of JPEG images in folder, sorted by name
|
// Get list of JPEG images in folder, sorted by name
|
||||||
QString previousSelection = snapshotDirectory;
|
QString previousSelection = _snapshotDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (snapshotDirectory == "") {
|
if (_snapshotDirectory == "") {
|
||||||
snapshotDirectory = previousSelection;
|
_snapshotDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
snapshotDirectory = testFolder;
|
_snapshotDirectory = testFolder;
|
||||||
exitWhenComplete = true;
|
_exitWhenComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit if test results folder could not be created
|
// Quit if test results folder could not be created
|
||||||
if (!createTestResultsFolderPath(snapshotDirectory)) {
|
if (!createTestResultsFolderPath(_snapshotDirectory)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,20 +207,20 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch
|
||||||
// The expected images are represented as a URL to enable download from GitHub
|
// The expected images are represented as a URL to enable download from GitHub
|
||||||
// Images that are in the wrong format are ignored.
|
// Images that are in the wrong format are ignored.
|
||||||
|
|
||||||
QStringList sortedTestResultsFilenames = createListOfAll_imagesInDirectory("png", snapshotDirectory);
|
QStringList sortedTestResultsFilenames = createListOfAll_imagesInDirectory("png", _snapshotDirectory);
|
||||||
QStringList expectedImagesURLs;
|
QStringList expectedImagesURLs;
|
||||||
|
|
||||||
resultImagesFullFilenames.clear();
|
_resultImagesFullFilenames.clear();
|
||||||
expectedImagesFilenames.clear();
|
_expectedImagesFilenames.clear();
|
||||||
expectedImagesFullFilenames.clear();
|
_expectedImagesFullFilenames.clear();
|
||||||
|
|
||||||
QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine;
|
QString branch = (branchFromCommandLine.isNull()) ? autoTester->getSelectedBranch() : branchFromCommandLine;
|
||||||
QString user = (userFromCommandLine.isNull()) ? autoTester->getSelectedUser() : userFromCommandLine;
|
QString user = (userFromCommandLine.isNull()) ? autoTester->getSelectedUser() : userFromCommandLine;
|
||||||
|
|
||||||
foreach(QString currentFilename, sortedTestResultsFilenames) {
|
foreach(QString currentFilename, sortedTestResultsFilenames) {
|
||||||
QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename;
|
QString fullCurrentFilename = _snapshotDirectory + "/" + currentFilename;
|
||||||
if (isInSnapshotFilenameFormat("png", currentFilename)) {
|
if (isInSnapshotFilenameFormat("png", currentFilename)) {
|
||||||
resultImagesFullFilenames << fullCurrentFilename;
|
_resultImagesFullFilenames << fullCurrentFilename;
|
||||||
|
|
||||||
QString expectedImagePartialSourceDirectory = getExpectedImagePartialSourceDirectory(currentFilename);
|
QString expectedImagePartialSourceDirectory = getExpectedImagePartialSourceDirectory(currentFilename);
|
||||||
|
|
||||||
|
@ -237,12 +237,12 @@ void Test::startTestsEvaluation(const QString& testFolder, const QString& branch
|
||||||
// The image retrieved from GitHub needs a unique name
|
// The image retrieved from GitHub needs a unique name
|
||||||
QString expectedImageFilename = currentFilename.replace("/", "_").replace(".png", "_EI.png");
|
QString expectedImageFilename = currentFilename.replace("/", "_").replace(".png", "_EI.png");
|
||||||
|
|
||||||
expectedImagesFilenames << expectedImageFilename;
|
_expectedImagesFilenames << expectedImageFilename;
|
||||||
expectedImagesFullFilenames << snapshotDirectory + "/" + expectedImageFilename;
|
_expectedImagesFullFilenames << _snapshotDirectory + "/" + expectedImageFilename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoTester->downloadImages(expectedImagesURLs, snapshotDirectory, expectedImagesFilenames);
|
autoTester->downloadImages(expectedImagesURLs, _snapshotDirectory, _expectedImagesFilenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar) {
|
void Test::finishTestsEvaluation(bool isRunningFromCommandline, bool interactiveMode, QProgressBar* progressBar) {
|
||||||
|
@ -258,7 +258,7 @@ void Test::finishTestsEvaluation(bool isRunningFromCommandline, bool interactive
|
||||||
|
|
||||||
zipAndDeleteTestResultsFolder();
|
zipAndDeleteTestResultsFolder();
|
||||||
|
|
||||||
if (exitWhenComplete) {
|
if (_exitWhenComplete) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,46 +310,46 @@ void Test::includeTest(QTextStream& textStream, const QString& testPathname) {
|
||||||
// This script will run all text.js scripts in every applicable sub-folder
|
// This script will run all text.js scripts in every applicable sub-folder
|
||||||
void Test::createRecursiveScript() {
|
void Test::createRecursiveScript() {
|
||||||
// Select folder to start recursing from
|
// Select folder to start recursing from
|
||||||
QString previousSelection = testDirectory;
|
QString previousSelection = _testDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testDirectory =
|
_testDirectory =
|
||||||
QFileDialog::getExistingDirectory(nullptr, "Please select folder that will contain the top level test script", parent,
|
QFileDialog::getExistingDirectory(nullptr, "Please select folder that will contain the top level test script", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testDirectory == "") {
|
if (_testDirectory == "") {
|
||||||
testDirectory = previousSelection;
|
_testDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createRecursiveScript(testDirectory, true);
|
createRecursiveScript(_testDirectory, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method creates a `testRecursive.js` script in every sub-folder.
|
// This method creates a `testRecursive.js` script in every sub-folder.
|
||||||
void Test::createAllRecursiveScripts() {
|
void Test::createAllRecursiveScripts() {
|
||||||
// Select folder to start recursing from
|
// Select folder to start recursing from
|
||||||
QString previousSelection = testsRootDirectory;
|
QString previousSelection = _testsRootDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the recursive scripts",
|
_testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the recursive scripts",
|
||||||
parent, QFileDialog::ShowDirsOnly);
|
parent, QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testsRootDirectory == "") {
|
if (_testsRootDirectory == "") {
|
||||||
testsRootDirectory = previousSelection;
|
_testsRootDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createRecursiveScript(testsRootDirectory, false);
|
createRecursiveScript(_testsRootDirectory, false);
|
||||||
|
|
||||||
QDirIterator it(testsRootDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
QDirIterator it(_testsRootDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QString directory = it.next();
|
QString directory = it.next();
|
||||||
|
|
||||||
|
@ -477,42 +477,42 @@ void Test::createRecursiveScript(const QString& topLevelDirectory, bool interact
|
||||||
void Test::createTests() {
|
void Test::createTests() {
|
||||||
// Rename files sequentially, as ExpectedResult_00000.jpeg, ExpectedResult_00001.jpg and so on
|
// Rename files sequentially, as ExpectedResult_00000.jpeg, ExpectedResult_00001.jpg and so on
|
||||||
// Any existing expected result images will be deleted
|
// Any existing expected result images will be deleted
|
||||||
QString previousSelection = snapshotDirectory;
|
QString previousSelection = _snapshotDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
_snapshotDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test images", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (snapshotDirectory == "") {
|
if (_snapshotDirectory == "") {
|
||||||
snapshotDirectory = previousSelection;
|
_snapshotDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
previousSelection = testsRootDirectory;
|
previousSelection = _testsRootDirectory;
|
||||||
parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select test root folder", parent,
|
_testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select test root folder", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testsRootDirectory == "") {
|
if (_testsRootDirectory == "") {
|
||||||
testsRootDirectory = previousSelection;
|
_testsRootDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList sortedImageFilenames = createListOfAll_imagesInDirectory("png", snapshotDirectory);
|
QStringList sortedImageFilenames = createListOfAll_imagesInDirectory("png", _snapshotDirectory);
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
const int maxImages = pow(10, NUM_DIGITS);
|
const int maxImages = pow(10, NUM_DIGITS);
|
||||||
foreach (QString currentFilename, sortedImageFilenames) {
|
foreach (QString currentFilename, sortedImageFilenames) {
|
||||||
QString fullCurrentFilename = snapshotDirectory + "/" + currentFilename;
|
QString fullCurrentFilename = _snapshotDirectory + "/" + currentFilename;
|
||||||
if (isInSnapshotFilenameFormat("png", currentFilename)) {
|
if (isInSnapshotFilenameFormat("png", currentFilename)) {
|
||||||
if (i >= maxImages) {
|
if (i >= maxImages) {
|
||||||
QMessageBox::critical(0, "Error", "More than " + QString::number(maxImages) + " images not supported");
|
QMessageBox::critical(0, "Error", "More than " + QString::number(maxImages) + " images not supported");
|
||||||
|
@ -522,17 +522,17 @@ void Test::createTests() {
|
||||||
// Path to test is extracted from the file name
|
// Path to test is extracted from the file name
|
||||||
// Example:
|
// Example:
|
||||||
// filename is tests.engine.interaction.pointer.laser.distanceScaleEnd.00000.jpg
|
// filename is tests.engine.interaction.pointer.laser.distanceScaleEnd.00000.jpg
|
||||||
// path is <testDirectory>/engine/interaction/pointer/laser/distanceScaleEnd
|
// path is <_testDirectory>/engine/interaction/pointer/laser/distanceScaleEnd
|
||||||
//
|
//
|
||||||
// Note: we don't use the first part and the last 2 parts of the filename at this stage
|
// Note: we don't use the first part and the last 2 parts of the filename at this stage
|
||||||
//
|
//
|
||||||
QStringList pathParts = currentFilename.split(".");
|
QStringList pathParts = currentFilename.split(".");
|
||||||
QString fullNewFileName = testsRootDirectory;
|
QString fullNewFileName = _testsRootDirectory;
|
||||||
for (int j = 1; j < pathParts.size() - 2; ++j) {
|
for (int j = 1; j < pathParts.size() - 2; ++j) {
|
||||||
fullNewFileName += "/" + pathParts[j];
|
fullNewFileName += "/" + pathParts[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
// The image index is the penultimate component of the path parts (the last being the file extension)
|
// The image _index is the penultimate component of the path parts (the last being the file extension)
|
||||||
QString newFilename = "ExpectedImage_" + pathParts[pathParts.size() - 2].rightJustified(5, '0') + ".png";
|
QString newFilename = "ExpectedImage_" + pathParts[pathParts.size() - 2].rightJustified(5, '0') + ".png";
|
||||||
fullNewFileName += "/" + newFilename;
|
fullNewFileName += "/" + newFilename;
|
||||||
|
|
||||||
|
@ -621,51 +621,51 @@ ExtractedText Test::getTestScriptLines(QString testFileName) {
|
||||||
// The folder selected must contain a script named "test.js", the file produced is named "test.md"
|
// The folder selected must contain a script named "test.js", the file produced is named "test.md"
|
||||||
void Test::createMDFile() {
|
void Test::createMDFile() {
|
||||||
// Folder selection
|
// Folder selection
|
||||||
QString previousSelection = testDirectory;
|
QString previousSelection = _testDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test", parent,
|
_testDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select folder containing the test", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testDirectory == "") {
|
if (_testDirectory == "") {
|
||||||
testDirectory = previousSelection;
|
_testDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createMDFile(testDirectory);
|
createMDFile(_testDirectory);
|
||||||
|
|
||||||
QMessageBox::information(0, "Success", "MD file has been created");
|
QMessageBox::information(0, "Success", "MD file has been created");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::createAllMDFiles() {
|
void Test::createAllMDFiles() {
|
||||||
// Select folder to start recursing from
|
// Select folder to start recursing from
|
||||||
QString previousSelection = testsRootDirectory;
|
QString previousSelection = _testsRootDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the MD files", parent,
|
_testsRootDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select the root folder for the MD files", parent,
|
||||||
QFileDialog::ShowDirsOnly);
|
QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testsRootDirectory == "") {
|
if (_testsRootDirectory == "") {
|
||||||
testsRootDirectory = previousSelection;
|
_testsRootDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First test if top-level folder has a test.js file
|
// First test if top-level folder has a test.js file
|
||||||
const QString testPathname{ testsRootDirectory + "/" + TEST_FILENAME };
|
const QString testPathname{ _testsRootDirectory + "/" + TEST_FILENAME };
|
||||||
QFileInfo fileInfo(testPathname);
|
QFileInfo fileInfo(testPathname);
|
||||||
if (fileInfo.exists()) {
|
if (fileInfo.exists()) {
|
||||||
createMDFile(testsRootDirectory);
|
createMDFile(_testsRootDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDirIterator it(testsRootDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
QDirIterator it(_testsRootDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QString directory = it.next();
|
QString directory = it.next();
|
||||||
|
|
||||||
|
@ -685,9 +685,9 @@ void Test::createAllMDFiles() {
|
||||||
QMessageBox::information(0, "Success", "MD files have been created");
|
QMessageBox::information(0, "Success", "MD files have been created");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::createMDFile(const QString& testDirectory) {
|
void Test::createMDFile(const QString& _testDirectory) {
|
||||||
// Verify folder contains test.js file
|
// Verify folder contains test.js file
|
||||||
QString testFileName(testDirectory + "/" + TEST_FILENAME);
|
QString testFileName(_testDirectory + "/" + TEST_FILENAME);
|
||||||
QFileInfo testFileInfo(testFileName);
|
QFileInfo testFileInfo(testFileName);
|
||||||
if (!testFileInfo.exists()) {
|
if (!testFileInfo.exists()) {
|
||||||
QMessageBox::critical(0, "Error", "Could not find file: " + TEST_FILENAME);
|
QMessageBox::critical(0, "Error", "Could not find file: " + TEST_FILENAME);
|
||||||
|
@ -696,7 +696,7 @@ void Test::createMDFile(const QString& testDirectory) {
|
||||||
|
|
||||||
ExtractedText testScriptLines = getTestScriptLines(testFileName);
|
ExtractedText testScriptLines = getTestScriptLines(testFileName);
|
||||||
|
|
||||||
QString mdFilename(testDirectory + "/" + "test.md");
|
QString mdFilename(_testDirectory + "/" + "test.md");
|
||||||
QFile mdFile(mdFilename);
|
QFile mdFile(mdFilename);
|
||||||
if (!mdFile.open(QIODevice::WriteOnly)) {
|
if (!mdFile.open(QIODevice::WriteOnly)) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create file " + mdFilename);
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create file " + mdFilename);
|
||||||
|
@ -710,7 +710,7 @@ void Test::createMDFile(const QString& testDirectory) {
|
||||||
stream << "# " << testName << "\n";
|
stream << "# " << testName << "\n";
|
||||||
|
|
||||||
// Find the relevant part of the path to the test (i.e. from "tests" down
|
// Find the relevant part of the path to the test (i.e. from "tests" down
|
||||||
QString partialPath = extractPathFromTestsDown(testDirectory);
|
QString partialPath = extractPathFromTestsDown(_testDirectory);
|
||||||
|
|
||||||
stream << "## Run this script URL: [Manual](./test.js?raw=true) [Auto](./testAuto.js?raw=true)(from menu/Edit/Open and Run scripts from URL...)." << "\n\n";
|
stream << "## Run this script URL: [Manual](./test.js?raw=true) [Auto](./testAuto.js?raw=true)(from menu/Edit/Open and Run scripts from URL...)." << "\n\n";
|
||||||
|
|
||||||
|
@ -734,23 +734,23 @@ void Test::createMDFile(const QString& testDirectory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::createTestsOutline() {
|
void Test::createTestsOutline() {
|
||||||
QString previousSelection = testDirectory;
|
QString previousSelection = _testDirectory;
|
||||||
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
if (!parent.isNull() && parent.right(1) != "/") {
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
parent += "/";
|
parent += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
testDirectory =
|
_testDirectory =
|
||||||
QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", parent, QFileDialog::ShowDirsOnly);
|
QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", parent, QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
// If user cancelled then restore previous selection and return
|
// If user cancelled then restore previous selection and return
|
||||||
if (testDirectory == "") {
|
if (_testDirectory == "") {
|
||||||
testDirectory = previousSelection;
|
_testDirectory = previousSelection;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString testsOutlineFilename { "testsOutline.md" };
|
const QString testsOutlineFilename { "testsOutline.md" };
|
||||||
QString mdFilename(testDirectory + "/" + testsOutlineFilename);
|
QString mdFilename(_testDirectory + "/" + testsOutlineFilename);
|
||||||
QFile mdFile(mdFilename);
|
QFile mdFile(mdFilename);
|
||||||
if (!mdFile.open(QIODevice::WriteOnly)) {
|
if (!mdFile.open(QIODevice::WriteOnly)) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create file " + mdFilename);
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Failed to create file " + mdFilename);
|
||||||
|
@ -764,10 +764,10 @@ void Test::createTestsOutline() {
|
||||||
stream << "Directories with an appended (*) have an automatic test\n\n";
|
stream << "Directories with an appended (*) have an automatic test\n\n";
|
||||||
|
|
||||||
// We need to know our current depth, as this isn't given by QDirIterator
|
// We need to know our current depth, as this isn't given by QDirIterator
|
||||||
int rootDepth { testDirectory.count('/') };
|
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
|
// 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(testDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
QDirIterator it(_testDirectory.toStdString().c_str(), QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QString directory = it.next();
|
QString directory = it.next();
|
||||||
|
|
||||||
|
@ -821,12 +821,51 @@ void Test::createTestsOutline() {
|
||||||
QMessageBox::information(0, "Success", "Test outline file " + testsOutlineFilename + " has been created");
|
QMessageBox::information(0, "Success", "Test outline file " + testsOutlineFilename + " has been created");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test::createTestRailTestCases() {
|
||||||
|
QString previousSelection = _testDirectory;
|
||||||
|
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
|
||||||
|
if (!parent.isNull() && parent.right(1) != "/") {
|
||||||
|
parent += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
_testDirectory =
|
||||||
|
QFileDialog::getExistingDirectory(nullptr, "Please select the tests root folder", parent, QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
|
// If user cancelled then restore previous selection and return
|
||||||
|
if (_testDirectory == "") {
|
||||||
|
_testDirectory = previousSelection;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString outputDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select a folder to store generated files in",
|
||||||
|
nullptr, QFileDialog::ShowDirsOnly);
|
||||||
|
|
||||||
|
// If user cancelled then return
|
||||||
|
if (outputDirectory == "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_testRailCreateMode == PYTHON) {
|
||||||
|
_testRailInterface.createTestSuitePython(_testDirectory, outputDirectory, autoTester->getSelectedUser(),
|
||||||
|
autoTester->getSelectedBranch());
|
||||||
|
} else {
|
||||||
|
_testRailInterface.createTestSuiteXML(_testDirectory, outputDirectory, autoTester->getSelectedUser(),
|
||||||
|
autoTester->getSelectedBranch());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test::createTestRailRun() {
|
||||||
|
QString outputDirectory = QFileDialog::getExistingDirectory(nullptr, "Please select a folder to store generated files in",
|
||||||
|
nullptr, QFileDialog::ShowDirsOnly);
|
||||||
|
_testRailInterface.createTestRailRun(outputDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) {
|
QStringList Test::createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory) {
|
||||||
imageDirectory = QDir(pathToImageDirectory);
|
_imageDirectory = QDir(pathToImageDirectory);
|
||||||
QStringList nameFilters;
|
QStringList nameFilters;
|
||||||
nameFilters << "*." + imageFormat;
|
nameFilters << "*." + imageFormat;
|
||||||
|
|
||||||
return imageDirectory.entryList(nameFilters, QDir::Files, QDir::Name);
|
return _imageDirectory.entryList(nameFilters, QDir::Files, QDir::Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snapshots are files in the following format:
|
// Snapshots are files in the following format:
|
||||||
|
@ -889,3 +928,7 @@ QString Test::getExpectedImagePartialSourceDirectory(const QString& filename) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test::setTestRailCreateMode(TestRailCreateMode testRailCreateMode) {
|
||||||
|
_testRailCreateMode = testRailCreateMode;
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "ImageComparer.h"
|
#include "ImageComparer.h"
|
||||||
#include "ui/MismatchWindow.h"
|
#include "ui/MismatchWindow.h"
|
||||||
|
#include "TestRailInterface.h"
|
||||||
|
|
||||||
class Step {
|
class Step {
|
||||||
public:
|
public:
|
||||||
|
@ -33,6 +34,11 @@ public:
|
||||||
StepList stepList;
|
StepList stepList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TestRailCreateMode {
|
||||||
|
PYTHON,
|
||||||
|
XML
|
||||||
|
};
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
public:
|
public:
|
||||||
Test();
|
Test();
|
||||||
|
@ -51,6 +57,9 @@ public:
|
||||||
|
|
||||||
void createTestsOutline();
|
void createTestsOutline();
|
||||||
|
|
||||||
|
void createTestRailTestCases();
|
||||||
|
void createTestRailRun();
|
||||||
|
|
||||||
bool compareImageLists(bool isInteractiveMode, QProgressBar* progressBar);
|
bool compareImageLists(bool isInteractiveMode, QProgressBar* progressBar);
|
||||||
|
|
||||||
QStringList createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory);
|
QStringList createListOfAll_imagesInDirectory(const QString& imageFormat, const QString& pathToImageDirectory);
|
||||||
|
@ -64,11 +73,15 @@ public:
|
||||||
bool createTestResultsFolderPath(const QString& directory);
|
bool createTestResultsFolderPath(const QString& directory);
|
||||||
void zipAndDeleteTestResultsFolder();
|
void zipAndDeleteTestResultsFolder();
|
||||||
|
|
||||||
bool isAValidDirectory(const QString& pathname);
|
static bool isAValidDirectory(const QString& pathname);
|
||||||
QString extractPathFromTestsDown(const QString& fullPath);
|
QString extractPathFromTestsDown(const QString& fullPath);
|
||||||
QString getExpectedImageDestinationDirectory(const QString& filename);
|
QString getExpectedImageDestinationDirectory(const QString& filename);
|
||||||
QString getExpectedImagePartialSourceDirectory(const QString& filename);
|
QString getExpectedImagePartialSourceDirectory(const QString& filename);
|
||||||
|
|
||||||
|
ExtractedText getTestScriptLines(QString testFileName);
|
||||||
|
|
||||||
|
void setTestRailCreateMode(TestRailCreateMode testRailCreateMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString TEST_FILENAME { "test.js" };
|
const QString TEST_FILENAME { "test.js" };
|
||||||
const QString TEST_RESULTS_FOLDER { "TestResults" };
|
const QString TEST_RESULTS_FOLDER { "TestResults" };
|
||||||
|
@ -76,14 +89,14 @@ private:
|
||||||
|
|
||||||
const double THRESHOLD{ 0.96 };
|
const double THRESHOLD{ 0.96 };
|
||||||
|
|
||||||
QDir imageDirectory;
|
QDir _imageDirectory;
|
||||||
|
|
||||||
MismatchWindow mismatchWindow;
|
MismatchWindow _mismatchWindow;
|
||||||
|
|
||||||
ImageComparer imageComparer;
|
ImageComparer _imageComparer;
|
||||||
|
|
||||||
QString testResultsFolderPath;
|
QString _testResultsFolderPath;
|
||||||
int index { 1 };
|
int _index { 1 };
|
||||||
|
|
||||||
// Expected images are in the format ExpectedImage_dddd.jpg (d == decimal digit)
|
// Expected images are in the format ExpectedImage_dddd.jpg (d == decimal digit)
|
||||||
const int NUM_DIGITS { 5 };
|
const int NUM_DIGITS { 5 };
|
||||||
|
@ -93,28 +106,30 @@ private:
|
||||||
// The first is the directory containing the test we are working with
|
// The first is the directory containing the test we are working with
|
||||||
// The second is the root directory of all tests
|
// The second is the root directory of all tests
|
||||||
// The third contains the snapshots taken for test runs that need to be evaluated
|
// The third contains the snapshots taken for test runs that need to be evaluated
|
||||||
QString testDirectory;
|
QString _testDirectory;
|
||||||
QString testsRootDirectory;
|
QString _testsRootDirectory;
|
||||||
QString snapshotDirectory;
|
QString _snapshotDirectory;
|
||||||
|
|
||||||
QStringList expectedImagesFilenames;
|
QStringList _expectedImagesFilenames;
|
||||||
QStringList expectedImagesFullFilenames;
|
QStringList _expectedImagesFullFilenames;
|
||||||
QStringList resultImagesFullFilenames;
|
QStringList _resultImagesFullFilenames;
|
||||||
|
|
||||||
// Used for accessing GitHub
|
// Used for accessing GitHub
|
||||||
const QString GIT_HUB_REPOSITORY{ "hifi_tests" };
|
const QString GIT_HUB_REPOSITORY{ "hifi_tests" };
|
||||||
|
|
||||||
const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" };
|
const QString DATETIME_FORMAT{ "yyyy-MM-dd_hh-mm-ss" };
|
||||||
|
|
||||||
ExtractedText getTestScriptLines(QString testFileName);
|
|
||||||
|
|
||||||
// NOTE: these need to match the appropriate var's in autoTester.js
|
// NOTE: these need to match the appropriate var's in autoTester.js
|
||||||
// var advanceKey = "n";
|
// var advanceKey = "n";
|
||||||
// var pathSeparator = ".";
|
// var pathSeparator = ".";
|
||||||
const QString ADVANCE_KEY{ "n" };
|
const QString ADVANCE_KEY{ "n" };
|
||||||
const QString PATH_SEPARATOR{ "." };
|
const QString PATH_SEPARATOR{ "." };
|
||||||
|
|
||||||
bool exitWhenComplete{ false };
|
bool _exitWhenComplete{ false };
|
||||||
|
|
||||||
|
TestRailInterface _testRailInterface;
|
||||||
|
|
||||||
|
TestRailCreateMode _testRailCreateMode { PYTHON };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_test_h
|
#endif // hifi_test_h
|
837
tools/auto-tester/src/TestRailInterface.cpp
Normal file
837
tools/auto-tester/src/TestRailInterface.cpp
Normal file
|
@ -0,0 +1,837 @@
|
||||||
|
//
|
||||||
|
// TestRailInterface.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 6 Jul 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "TestRailInterface.h"
|
||||||
|
#include "Test.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
TestRailInterface::TestRailInterface() {
|
||||||
|
_testRailTestCasesSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||||
|
////_testRailTestCasesSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
||||||
|
_testRailTestCasesSelectorWindow.setUser("@highfidelity.io");
|
||||||
|
////_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
||||||
|
|
||||||
|
_testRailTestCasesSelectorWindow.setProjectID(INTERFACE_PROJECT_ID);
|
||||||
|
////_testRailSelectorWindow.setProject(1);
|
||||||
|
|
||||||
|
_testRailTestCasesSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
||||||
|
|
||||||
|
_testRailRunSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||||
|
////_testRailRunSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
||||||
|
_testRailRunSelectorWindow.setUser("@highfidelity.io");
|
||||||
|
////_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
||||||
|
|
||||||
|
_testRailRunSelectorWindow.setProjectID(INTERFACE_PROJECT_ID);
|
||||||
|
////_testRailSelectorWindow.setProject(1);
|
||||||
|
|
||||||
|
_testRailRunSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailInterface::getObject(const QString& path) {
|
||||||
|
return path.right(path.length() - path.lastIndexOf("/") - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool TestRailInterface::setPythonCommand() {
|
||||||
|
if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) {
|
||||||
|
QString _pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH");
|
||||||
|
if (!QFile::exists(_pythonPath + "/" + pythonExe)) {
|
||||||
|
QMessageBox::critical(0, pythonExe, QString("Python executable not found in ") + _pythonPath);
|
||||||
|
}
|
||||||
|
_pythonCommand = _pythonPath + "/" + pythonExe;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(0, "PYTHON_PATH not defined",
|
||||||
|
"Please set PYTHON_PATH to directory containing the Python executable");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates the testrail.py script
|
||||||
|
// This is the file linked to from http://docs.gurock.com/testrail-api2/bindings-python
|
||||||
|
void TestRailInterface::createTestRailDotPyScript() {
|
||||||
|
QFile file(_outputDirectory + "/testrail.py");
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create 'testrail.py'");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
stream << "#\n";
|
||||||
|
stream << "# TestRail API binding for Python 3.x (API v2, available since \n";
|
||||||
|
stream << "# TestRail 3.0)\n";
|
||||||
|
stream << "#\n";
|
||||||
|
stream << "# Learn more:\n";
|
||||||
|
stream << "#\n";
|
||||||
|
stream << "# http://docs.gurock.com/testrail-api2/start\n";
|
||||||
|
stream << "# http://docs.gurock.com/testrail-api2/accessing\n";
|
||||||
|
stream << "#\n";
|
||||||
|
stream << "# Copyright Gurock Software GmbH. See license.md for details.\n";
|
||||||
|
stream << "#\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "import urllib.request, urllib.error\n";
|
||||||
|
stream << "import json, base64\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "class APIClient:\n";
|
||||||
|
stream << "\tdef __init__(self, base_url):\n";
|
||||||
|
stream << "\t\tself.user = ''\n";
|
||||||
|
stream << "\t\tself.password = ''\n";
|
||||||
|
stream << "\t\tif not base_url.endswith('/'):\n";
|
||||||
|
stream << "\t\t\tbase_url += '/'\n";
|
||||||
|
stream << "\t\tself.__url = base_url + 'index.php?/api/v2/'\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Send Get\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Issues a GET request (read) against the API and returns the result\n";
|
||||||
|
stream << "\t# (as Python dict).\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Arguments:\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# uri The API method to call including parameters\n";
|
||||||
|
stream << "\t# (e.g. get_case/1)\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\tdef send_get(self, uri):\n";
|
||||||
|
stream << "\t\treturn self.__send_request('GET', uri, None)\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Send POST\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Issues a POST request (write) against the API and returns the result\n";
|
||||||
|
stream << "\t# (as Python dict).\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# Arguments:\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\t# uri The API method to call including parameters\n";
|
||||||
|
stream << "\t# (e.g. add_case/1)\n";
|
||||||
|
stream << "\t# data The data to submit as part of the request (as\n";
|
||||||
|
stream << "\t# Python dict, strings must be UTF-8 encoded)\n";
|
||||||
|
stream << "\t#\n";
|
||||||
|
stream << "\tdef send_post(self, uri, data):\n";
|
||||||
|
stream << "\t\treturn self.__send_request('POST', uri, data)\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\tdef __send_request(self, method, uri, data):\n";
|
||||||
|
stream << "\t\turl = self.__url + uri\n";
|
||||||
|
stream << "\t\trequest = urllib.request.Request(url)\n";
|
||||||
|
stream << "\t\tif (method == 'POST'):\n";
|
||||||
|
stream << "\t\t\trequest.data = bytes(json.dumps(data), 'utf-8')\n";
|
||||||
|
stream << "\t\tauth = str(\n";
|
||||||
|
stream << "\t\t\tbase64.b64encode(\n";
|
||||||
|
stream << "\t\t\t\tbytes('%s:%s' % (self.user, self.password), 'utf-8')\n";
|
||||||
|
stream << "\t\t\t),\n";
|
||||||
|
stream << "\t\t\t'ascii'\n";
|
||||||
|
stream << "\t\t).strip()\n";
|
||||||
|
stream << "\t\trequest.add_header('Authorization', 'Basic %s' % auth)\n";
|
||||||
|
stream << "\t\trequest.add_header('Content-Type', 'application/json')\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t\te = None\n";
|
||||||
|
stream << "\t\ttry:\n";
|
||||||
|
stream << "\t\t\tresponse = urllib.request.urlopen(request).read()\n";
|
||||||
|
stream << "\t\texcept urllib.error.HTTPError as ex:\n";
|
||||||
|
stream << "\t\t\tresponse = ex.read()\n";
|
||||||
|
stream << "\t\t\te = ex\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t\tif response:\n";
|
||||||
|
stream << "\t\t\tresult = json.loads(response.decode())\n";
|
||||||
|
stream << "\t\telse:\n";
|
||||||
|
stream << "\t\t\tresult = {}\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t\tif e != None:\n";
|
||||||
|
stream << "\t\t\tif result and 'error' in result:\n";
|
||||||
|
stream << "\t\t\t\terror = '\"' + result['error'] + '\"'\n";
|
||||||
|
stream << "\t\t\telse:\n";
|
||||||
|
stream << "\t\t\t\terror = 'No additional error message received'\n";
|
||||||
|
stream << "\t\t\traise APIError('TestRail API returned HTTP %s (%s)' % \n";
|
||||||
|
stream << "\t\t\t\t(e.code, error))\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "\t\treturn result\n";
|
||||||
|
stream << "\n";
|
||||||
|
stream << "class APIError(Exception):\n";
|
||||||
|
stream << "\tpass\n";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates a Stack class
|
||||||
|
void TestRailInterface::createStackDotPyScript() {
|
||||||
|
QString filename = _outputDirectory + "/stack.py";
|
||||||
|
if (QFile::exists(filename)) {
|
||||||
|
QFile::remove(filename);
|
||||||
|
}
|
||||||
|
QFile file(filename);
|
||||||
|
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create 'stack.py'");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
stream << "class Stack:\n";
|
||||||
|
|
||||||
|
stream << "\tdef __init__(self):\n";
|
||||||
|
stream << "\t\tself.items = []\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
stream << "\tdef is_empty(self):\n";
|
||||||
|
stream << "\t\treturn self.items == []\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
stream << "\tdef push(self, item):\n";
|
||||||
|
stream << "\t\tself.items.append(item)\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
stream << "\tdef pop(self):\n";
|
||||||
|
stream << "\t\treturn self.items.pop()\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
stream << "\tdef peek(self):\n";
|
||||||
|
stream << "\t\treturn self.items[len(self.items)-1]\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
stream << "\tdef size(self):\n";
|
||||||
|
stream << "\t\treturn len(self.items)\n";
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::requestTestRailTestCasesDataFromUser() {
|
||||||
|
// Make sure correct fields are enabled before calling
|
||||||
|
_testRailTestCasesSelectorWindow.reset();
|
||||||
|
_testRailTestCasesSelectorWindow.exec();
|
||||||
|
|
||||||
|
if (_testRailTestCasesSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_url = _testRailTestCasesSelectorWindow.getURL() + "/";
|
||||||
|
_user = _testRailTestCasesSelectorWindow.getUser();
|
||||||
|
_password = _testRailTestCasesSelectorWindow.getPassword();
|
||||||
|
////_password = "tutKA76";
|
||||||
|
_projectID = QString::number(_testRailTestCasesSelectorWindow.getProjectID());
|
||||||
|
_suiteID = QString::number(_testRailTestCasesSelectorWindow.getSuiteID());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
||||||
|
if (Test::isAValidDirectory(directory)) {
|
||||||
|
// Ignore the utils and preformance directories
|
||||||
|
if (directory.right(QString("utils").length()) == "utils" ||
|
||||||
|
directory.right(QString("performance").length()) == "performance") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::processDirectoryPython(const QString& directory,
|
||||||
|
QTextStream& stream,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub) {
|
||||||
|
// Loop over all entries in directory
|
||||||
|
QDirIterator it(directory.toStdString().c_str());
|
||||||
|
while (it.hasNext()) {
|
||||||
|
QString nextDirectory = it.next();
|
||||||
|
|
||||||
|
QString objectName = getObject(nextDirectory);
|
||||||
|
|
||||||
|
if (isAValidTestDirectory(nextDirectory)) {
|
||||||
|
// The name of the section is the directory at the end of the path
|
||||||
|
stream << "parent_id = parent_ids.peek()\n";
|
||||||
|
stream << "data = { 'name': '" << objectName << "', 'suite_id': " + _suiteID + ", 'parent_id': parent_id }\n";
|
||||||
|
|
||||||
|
stream << "section = client.send_post('add_section/' + str(" << _projectID << "), data)\n";
|
||||||
|
|
||||||
|
// Now we push the parent_id, and recursively process each directory
|
||||||
|
stream << "parent_ids.push(section['id'])\n\n";
|
||||||
|
processDirectoryPython(nextDirectory, stream, userGitHub, branchGitHub);
|
||||||
|
} else if (objectName == "test.js") {
|
||||||
|
processTestPython(nextDirectory, stream, userGitHub, branchGitHub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// pop the parent directory before leaving
|
||||||
|
stream << "parent_ids.pop()\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// A suite of TestRail test cases contains trees.
|
||||||
|
// The nodes of the trees are sections
|
||||||
|
// The leaves are the test cases
|
||||||
|
//
|
||||||
|
// Each node and leaf have an ID and a parent ID.
|
||||||
|
// Therefore, the tree is built top-down, using a stack to store the IDs of each node
|
||||||
|
//
|
||||||
|
void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub) {
|
||||||
|
QString filename = _outputDirectory + "/addTestCases.py";
|
||||||
|
if (QFile::exists(filename)) {
|
||||||
|
QFile::remove(filename);
|
||||||
|
}
|
||||||
|
QFile file(filename);
|
||||||
|
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create 'addTestCases.py'");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
// Code to access TestRail
|
||||||
|
stream << "from testrail import *\n";
|
||||||
|
stream << "client = APIClient('" << _url.toStdString().c_str() << "')\n";
|
||||||
|
stream << "client.user = '" << _user << "'\n";
|
||||||
|
stream << "client.password = '" << _password << "'\n\n";
|
||||||
|
|
||||||
|
stream << "from stack import *\n";
|
||||||
|
stream << "parent_ids = Stack()\n\n";
|
||||||
|
|
||||||
|
// top-level section
|
||||||
|
stream << "data = { 'name': '"
|
||||||
|
<< "Test Suite - " << QDateTime::currentDateTime().toString("yyyy-MM-ddTHH:mm") + "', "
|
||||||
|
<< "'suite_id': " + _suiteID + "}\n";
|
||||||
|
|
||||||
|
stream << "section = client.send_post('add_section/' + str(" << _projectID << "), data)\n";
|
||||||
|
|
||||||
|
// Now we push the parent_id, and recursively process each directory
|
||||||
|
stream << "parent_ids.push(section['id'])\n\n";
|
||||||
|
processDirectoryPython(testDirectory, stream, userGitHub, branchGitHub);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
if (QMessageBox::Yes == QMessageBox(QMessageBox::Information, "Python script has been created",
|
||||||
|
"Do you want to run the script and update TestRail?",
|
||||||
|
QMessageBox::Yes | QMessageBox::No)
|
||||||
|
.exec()) {
|
||||||
|
QProcess* process = new QProcess();
|
||||||
|
connect(process, &QProcess::started, this, [=]() { _busyWindow.exec(); });
|
||||||
|
|
||||||
|
connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this,
|
||||||
|
[=](int exitCode, QProcess::ExitStatus exitStatus) { _busyWindow.hide(); });
|
||||||
|
|
||||||
|
QStringList parameters = QStringList() << _outputDirectory + "/addTestCases.py";
|
||||||
|
process->start(_pythonCommand, parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
|
// Quit if user has previously cancelled
|
||||||
|
if (_testRailTestCasesSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if process completed successfully
|
||||||
|
if (exitStatus != QProcess::NormalExit) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not get milestones from TestRail");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create map of milestones from the file created by the process
|
||||||
|
_milestoneNames.clear();
|
||||||
|
|
||||||
|
QString filename = _outputDirectory + "/milestones.txt";
|
||||||
|
if (!QFile::exists(filename)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not find milestones.txt in " + _outputDirectory);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(filename);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not open " + _outputDirectory + "/milestones.txt");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream in(&file);
|
||||||
|
QString line = in.readLine();
|
||||||
|
while (!line.isNull()) {
|
||||||
|
QStringList words = line.split(' ');
|
||||||
|
_milestones[words[0]] = words[1].toInt();
|
||||||
|
_milestoneNames << words[0];
|
||||||
|
|
||||||
|
line = in.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
// Update the combo
|
||||||
|
_testRailTestCasesSelectorWindow.updateMilestonesComboBoxData(_milestoneNames);
|
||||||
|
|
||||||
|
_testRailTestCasesSelectorWindow.exec();
|
||||||
|
|
||||||
|
if (_testRailTestCasesSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createAddTestCasesPythonScript(_testDirectory, _userGitHub, _branchGitHub);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::updateSectionsComboData(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
|
// Quit if user has previously cancelled
|
||||||
|
if (_testRailRunSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if process completed successfully
|
||||||
|
if (exitStatus != QProcess::NormalExit) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not get sections from TestRail");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create map of sections from the file created by the process
|
||||||
|
_sectionNames.clear();
|
||||||
|
|
||||||
|
QString filename = _outputDirectory + "/sections.txt";
|
||||||
|
if (!QFile::exists(filename)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not find sections.txt in " + _outputDirectory);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file(filename);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not open " + _outputDirectory + "/sections.txt");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream in(&file);
|
||||||
|
QString line = in.readLine();
|
||||||
|
while (!line.isNull()) {
|
||||||
|
// The section name is all the words except for the last
|
||||||
|
// The id is the last word
|
||||||
|
QString section = line.left(line.lastIndexOf(" "));
|
||||||
|
QString id = line.right(line.length() - line.lastIndexOf(" ") - 1);
|
||||||
|
|
||||||
|
_sections[section] = id.toInt();
|
||||||
|
_sectionNames << section;
|
||||||
|
|
||||||
|
line = in.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
// Update the combo
|
||||||
|
_testRailRunSelectorWindow.updateSectionsComboBoxData(_sectionNames);
|
||||||
|
|
||||||
|
_testRailRunSelectorWindow.exec();
|
||||||
|
|
||||||
|
if (_testRailRunSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
////createAddTestCasesPythonScript(_testDirectory, _userGitHub, _branchGitHub);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::getMilestonesFromTestRail() {
|
||||||
|
QString filename = _outputDirectory + "/getMilestones.py";
|
||||||
|
if (QFile::exists(filename)) {
|
||||||
|
QFile::remove(filename);
|
||||||
|
}
|
||||||
|
QFile file(filename);
|
||||||
|
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create 'getMilestones.py'");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
// Code to access TestRail
|
||||||
|
stream << "from testrail import *\n";
|
||||||
|
stream << "client = APIClient('" << _url.toStdString().c_str() << "')\n";
|
||||||
|
stream << "client.user = '" << _user << "'\n";
|
||||||
|
stream << "client.password = '" << _password << "'\n\n";
|
||||||
|
|
||||||
|
// Print the list of uncompleted milestones
|
||||||
|
stream << "file = open('" + _outputDirectory + "/milestones.txt', 'w')\n\n";
|
||||||
|
stream << "milestones = client.send_get('get_milestones/" + _projectID + "')\n";
|
||||||
|
stream << "for milestone in milestones:\n";
|
||||||
|
stream << "\tif milestone['is_completed'] == False:\n";
|
||||||
|
stream << "\t\tfile.write(milestone['name'] + ' ' + str(milestone['id']) + '\\n')\n\n";
|
||||||
|
stream << "file.close()\n";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QProcess* process = new QProcess();
|
||||||
|
connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this,
|
||||||
|
[=](int exitCode, QProcess::ExitStatus exitStatus) { updateMilestonesComboData(exitCode, exitStatus); });
|
||||||
|
|
||||||
|
QStringList parameters = QStringList() << _outputDirectory + "/getMilestones.py ";
|
||||||
|
process->start(_pythonCommand, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::createTestSuitePython(const QString& testDirectory,
|
||||||
|
const QString& outputDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub) {
|
||||||
|
_testDirectory = testDirectory;
|
||||||
|
_outputDirectory = outputDirectory;
|
||||||
|
_userGitHub = userGitHub;
|
||||||
|
_branchGitHub = branchGitHub;
|
||||||
|
|
||||||
|
if (!setPythonCommand()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestTestRailTestCasesDataFromUser();
|
||||||
|
createTestRailDotPyScript();
|
||||||
|
createStackDotPyScript();
|
||||||
|
|
||||||
|
// TestRail will be updated after the process initiated by getMilestonesFromTestRail has completed
|
||||||
|
getMilestonesFromTestRail();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::createTestSuiteXML(const QString& testDirectory,
|
||||||
|
const QString& outputDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub) {
|
||||||
|
_outputDirectory = outputDirectory;
|
||||||
|
|
||||||
|
QDomProcessingInstruction instruction = _document.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
|
||||||
|
_document.appendChild(instruction);
|
||||||
|
|
||||||
|
// We create a single section, within sections
|
||||||
|
QDomElement root = _document.createElement("sections");
|
||||||
|
_document.appendChild(root);
|
||||||
|
|
||||||
|
QDomElement topLevelSection = _document.createElement("section");
|
||||||
|
|
||||||
|
QDomElement suiteName = _document.createElement("name");
|
||||||
|
suiteName.appendChild(
|
||||||
|
_document.createTextNode("Test Suite - " + QDateTime::currentDateTime().toString("yyyy-MM-ddTHH:mm")));
|
||||||
|
topLevelSection.appendChild(suiteName);
|
||||||
|
|
||||||
|
// This is the first call to 'process'. This is then called recursively to build the full XML tree
|
||||||
|
QDomElement secondLevelSections = _document.createElement("sections");
|
||||||
|
topLevelSection.appendChild(processDirectoryXML(testDirectory, userGitHub, branchGitHub, secondLevelSections));
|
||||||
|
|
||||||
|
topLevelSection.appendChild(secondLevelSections);
|
||||||
|
root.appendChild(topLevelSection);
|
||||||
|
|
||||||
|
// Write to file
|
||||||
|
const QString testRailsFilename{ _outputDirectory + "/TestRailSuite.xml" };
|
||||||
|
QFile file(testRailsFilename);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create XML file");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
stream << _document.toString();
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QMessageBox::information(0, "Success", "TestRail XML file has been created");
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement TestRailInterface::processDirectoryXML(const QString& directory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub,
|
||||||
|
const QDomElement& element) {
|
||||||
|
QDomElement result = element;
|
||||||
|
|
||||||
|
// Loop over all entries in directory
|
||||||
|
QDirIterator it(directory.toStdString().c_str());
|
||||||
|
while (it.hasNext()) {
|
||||||
|
QString nextDirectory = it.next();
|
||||||
|
|
||||||
|
// The object name appears after the last slash (we are assured there is at least 1).
|
||||||
|
QString objectName = getObject(nextDirectory);
|
||||||
|
|
||||||
|
// Only process directories
|
||||||
|
if (isAValidTestDirectory(nextDirectory)) {
|
||||||
|
// Create a section and process it
|
||||||
|
QDomElement sectionElement = _document.createElement("section");
|
||||||
|
|
||||||
|
QDomElement sectionElementName = _document.createElement("name");
|
||||||
|
sectionElementName.appendChild(_document.createTextNode(objectName));
|
||||||
|
sectionElement.appendChild(sectionElementName);
|
||||||
|
|
||||||
|
QDomElement testsElement = _document.createElement("sections");
|
||||||
|
sectionElement.appendChild(processDirectoryXML(nextDirectory, userGitHub, branchGitHub, testsElement));
|
||||||
|
|
||||||
|
result.appendChild(sectionElement);
|
||||||
|
} else if (objectName == "test.js" || objectName == "testStory.js") {
|
||||||
|
QDomElement sectionElement = _document.createElement("section");
|
||||||
|
QDomElement sectionElementName = _document.createElement("name");
|
||||||
|
sectionElementName.appendChild(_document.createTextNode("all"));
|
||||||
|
sectionElement.appendChild(sectionElementName);
|
||||||
|
sectionElement.appendChild(
|
||||||
|
processTestXML(nextDirectory, objectName, userGitHub, branchGitHub, _document.createElement("cases")));
|
||||||
|
|
||||||
|
result.appendChild(sectionElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement TestRailInterface::processTestXML(const QString& fullDirectory,
|
||||||
|
const QString& test,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub,
|
||||||
|
const QDomElement& element) {
|
||||||
|
QDomElement result = element;
|
||||||
|
|
||||||
|
QDomElement caseElement = _document.createElement("case");
|
||||||
|
|
||||||
|
caseElement.appendChild(_document.createElement("id"));
|
||||||
|
|
||||||
|
// The name of the test is derived from the full path.
|
||||||
|
// The first term is the first word after "tests"
|
||||||
|
// The last word is the penultimate word
|
||||||
|
QStringList words = fullDirectory.split('/');
|
||||||
|
int i = 0;
|
||||||
|
while (words[i] != "tests") {
|
||||||
|
++i;
|
||||||
|
if (i >= words.length() - 1) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Folder \"tests\" not found in " + fullDirectory);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
QString title{ words[i] };
|
||||||
|
for (++i; i < words.length() - 1; ++i) {
|
||||||
|
title += " / " + words[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement titleElement = _document.createElement("title");
|
||||||
|
titleElement.appendChild(_document.createTextNode(title));
|
||||||
|
caseElement.appendChild(titleElement);
|
||||||
|
|
||||||
|
QDomElement templateElement = _document.createElement("template");
|
||||||
|
templateElement.appendChild(_document.createTextNode("Test Case (Steps)"));
|
||||||
|
caseElement.appendChild(templateElement);
|
||||||
|
|
||||||
|
QDomElement typeElement = _document.createElement("type");
|
||||||
|
typeElement.appendChild(_document.createTextNode("3 - Regression"));
|
||||||
|
caseElement.appendChild(typeElement);
|
||||||
|
|
||||||
|
QDomElement priorityElement = _document.createElement("priority");
|
||||||
|
priorityElement.appendChild(_document.createTextNode("Medium"));
|
||||||
|
caseElement.appendChild(priorityElement);
|
||||||
|
|
||||||
|
QDomElement estimateElementName = _document.createElement("estimate");
|
||||||
|
estimateElementName.appendChild(_document.createTextNode("60"));
|
||||||
|
caseElement.appendChild(estimateElementName);
|
||||||
|
|
||||||
|
caseElement.appendChild(_document.createElement("references"));
|
||||||
|
|
||||||
|
QDomElement customElement = _document.createElement("custom");
|
||||||
|
|
||||||
|
QDomElement tester_countElement = _document.createElement("tester_count");
|
||||||
|
tester_countElement.appendChild(_document.createTextNode("1"));
|
||||||
|
customElement.appendChild(tester_countElement);
|
||||||
|
|
||||||
|
QDomElement domain_bot_loadElement = _document.createElement("domain_bot_load");
|
||||||
|
QDomElement domain_bot_loadElementId = _document.createElement("id");
|
||||||
|
domain_bot_loadElementId.appendChild(_document.createTextNode("1"));
|
||||||
|
domain_bot_loadElement.appendChild(domain_bot_loadElementId);
|
||||||
|
QDomElement domain_bot_loadElementValue = _document.createElement("value");
|
||||||
|
domain_bot_loadElementValue.appendChild(
|
||||||
|
_document.createTextNode(" Without Bots (hifiqa-rc / hifi-qa-stable / hifiqa-master)"));
|
||||||
|
domain_bot_loadElement.appendChild(domain_bot_loadElementValue);
|
||||||
|
customElement.appendChild(domain_bot_loadElement);
|
||||||
|
|
||||||
|
QDomElement automation_typeElement = _document.createElement("automation_type");
|
||||||
|
QDomElement automation_typeElementId = _document.createElement("id");
|
||||||
|
automation_typeElementId.appendChild(_document.createTextNode("0"));
|
||||||
|
automation_typeElement.appendChild(automation_typeElementId);
|
||||||
|
QDomElement automation_typeElementValue = _document.createElement("value");
|
||||||
|
automation_typeElementValue.appendChild(_document.createTextNode("None"));
|
||||||
|
automation_typeElement.appendChild(automation_typeElementValue);
|
||||||
|
customElement.appendChild(automation_typeElement);
|
||||||
|
|
||||||
|
QDomElement added_to_releaseElement = _document.createElement("added_to_release");
|
||||||
|
QDomElement added_to_releaseElementId = _document.createElement("id");
|
||||||
|
added_to_releaseElementId.appendChild(_document.createTextNode("4"));
|
||||||
|
added_to_releaseElement.appendChild(added_to_releaseElementId);
|
||||||
|
QDomElement added_to_releaseElementValue = _document.createElement("value");
|
||||||
|
added_to_releaseElementValue.appendChild(_document.createTextNode(branchGitHub));
|
||||||
|
added_to_releaseElement.appendChild(added_to_releaseElementValue);
|
||||||
|
customElement.appendChild(added_to_releaseElement);
|
||||||
|
|
||||||
|
QDomElement precondsElement = _document.createElement("preconds");
|
||||||
|
precondsElement.appendChild(_document.createTextNode(
|
||||||
|
"Tester is in an empty region of a domain in which they have edit rights\n\n*Note: Press 'n' to advance test script"));
|
||||||
|
customElement.appendChild(precondsElement);
|
||||||
|
|
||||||
|
QString testMDName = QString("https://github.com/") + userGitHub + "/hifi_tests/blob/" + branchGitHub +
|
||||||
|
"/tests/content/entity/light/point/create/test.md";
|
||||||
|
|
||||||
|
QDomElement steps_seperatedElement = _document.createElement("steps_separated");
|
||||||
|
QDomElement stepElement = _document.createElement("step");
|
||||||
|
QDomElement stepIndexElement = _document.createElement("index");
|
||||||
|
stepIndexElement.appendChild(_document.createTextNode("1"));
|
||||||
|
stepElement.appendChild(stepIndexElement);
|
||||||
|
QDomElement stepContentElement = _document.createElement("content");
|
||||||
|
stepContentElement.appendChild(
|
||||||
|
_document.createTextNode(QString("Execute instructions in [THIS TEST](") + testMDName + ")"));
|
||||||
|
stepElement.appendChild(stepContentElement);
|
||||||
|
QDomElement stepExpectedElement = _document.createElement("expected");
|
||||||
|
stepExpectedElement.appendChild(_document.createTextNode("Refer to the expected result in the linked description."));
|
||||||
|
stepElement.appendChild(stepExpectedElement);
|
||||||
|
steps_seperatedElement.appendChild(stepElement);
|
||||||
|
customElement.appendChild(steps_seperatedElement);
|
||||||
|
|
||||||
|
QDomElement notesElement = _document.createElement("notes");
|
||||||
|
notesElement.appendChild(_document.createTextNode(testMDName));
|
||||||
|
customElement.appendChild(notesElement);
|
||||||
|
|
||||||
|
caseElement.appendChild(customElement);
|
||||||
|
|
||||||
|
result.appendChild(caseElement);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::processTestPython(const QString& fullDirectory,
|
||||||
|
QTextStream& stream,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub) {
|
||||||
|
// The name of the test is derived from the full path.
|
||||||
|
// The first term is the first word after "tests"
|
||||||
|
// The last word is the penultimate word
|
||||||
|
QStringList words = fullDirectory.split('/');
|
||||||
|
int i = 0;
|
||||||
|
while (words[i] != "tests") {
|
||||||
|
++i;
|
||||||
|
if (i >= words.length() - 1) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Folder \"tests\" not found in " + fullDirectory);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
QString title{ words[i] };
|
||||||
|
for (++i; i < words.length() - 1; ++i) {
|
||||||
|
title += " / " + words[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// To create the path to test.md, prefix by tests, and remove blanks
|
||||||
|
QString pathToTestMD = QString("/tests/") + title.remove(" ");
|
||||||
|
|
||||||
|
stream << "section_id = parent_ids.peek()\n";
|
||||||
|
|
||||||
|
QString testMDName =
|
||||||
|
QString("https://github.com/") + userGitHub + "/hifi_tests/blob/" + branchGitHub + pathToTestMD + "/test.md ";
|
||||||
|
|
||||||
|
QString testContent = QString("Execute instructions in [THIS TEST](") + testMDName + ")";
|
||||||
|
QString testExpected = QString("Refer to the expected result in the linked description.");
|
||||||
|
|
||||||
|
int milestone_id = _milestones[_milestoneNames[_testRailTestCasesSelectorWindow.getMilestoneID()]];
|
||||||
|
|
||||||
|
stream << "data = {\n"
|
||||||
|
<< "\t'title': '" << title << "',\n"
|
||||||
|
<< "\t'template_id': 2,\n"
|
||||||
|
<< "\t'milestone_id': " << milestone_id << ",\n"
|
||||||
|
<< "\t'custom_tester_count': 1,\n"
|
||||||
|
<< "\t'custom_domain_bot_load': 1,\n"
|
||||||
|
<< "\t'custom_added_to_release': 4,\n"
|
||||||
|
<< "\t'custom_preconds': "
|
||||||
|
<< "'Tester is in an empty region of a domain in which they have edit rights\\n\\n*Note: Press \\'n\\' to advance "
|
||||||
|
"test script',\n"
|
||||||
|
<< "\t'custom_steps_separated': "
|
||||||
|
<< "[\n\t\t{\n\t\t\t'content': '" << testContent << "',\n\t\t\t'expected': '" << testExpected << "'\n\t\t}\n\t]\n"
|
||||||
|
<< "}\n";
|
||||||
|
|
||||||
|
stream << "case = client.send_post('add_case/' + str(section_id), data)\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::requestTestRailRunDataFromUser() {
|
||||||
|
_testRailRunSelectorWindow.reset();
|
||||||
|
_testRailRunSelectorWindow.exec();
|
||||||
|
|
||||||
|
if (_testRailRunSelectorWindow.getUserCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_url = _testRailRunSelectorWindow.getURL() + "/";
|
||||||
|
_user = _testRailRunSelectorWindow.getUser();
|
||||||
|
_password = _testRailRunSelectorWindow.getPassword();
|
||||||
|
////_password = "tutKA76";
|
||||||
|
_projectID = QString::number(_testRailRunSelectorWindow.getProjectID());
|
||||||
|
_suiteID = QString::number(_testRailRunSelectorWindow.getSuiteID());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::getTestSectionsFromTestRail() {
|
||||||
|
QString filename = _outputDirectory + "/getSections.py";
|
||||||
|
if (QFile::exists(filename)) {
|
||||||
|
QFile::remove(filename);
|
||||||
|
}
|
||||||
|
QFile file(filename);
|
||||||
|
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"Could not create 'getSections.py'");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
|
||||||
|
// Code to access TestRail
|
||||||
|
stream << "from testrail import *\n";
|
||||||
|
stream << "client = APIClient('" << _url.toStdString().c_str() << "')\n";
|
||||||
|
stream << "client.user = '" << _user << "'\n";
|
||||||
|
stream << "client.password = '" << _password << "'\n\n";
|
||||||
|
|
||||||
|
// Print the list of sections without parents
|
||||||
|
stream << "sections = client.send_get('get_sections/" + _projectID + "&suite_id=" + _suiteID + "')\n\n";
|
||||||
|
stream << "file = open('" + _outputDirectory + "/sections.txt', 'w')\n\n";
|
||||||
|
stream << "for section in sections:\n";
|
||||||
|
stream << "\tif section['parent_id'] == None:\n";
|
||||||
|
stream << "\t\tfile.write(section['name'] + ' ' + str(section['id']) + '\\n')\n\n";
|
||||||
|
stream << "file.close()\n";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QProcess* process = new QProcess();
|
||||||
|
connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this,
|
||||||
|
[=](int exitCode, QProcess::ExitStatus exitStatus) { updateSectionsComboData(exitCode, exitStatus); });
|
||||||
|
|
||||||
|
QStringList parameters = QStringList() << _outputDirectory + "/getSections.py ";
|
||||||
|
process->start(_pythonCommand, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailInterface::createTestRailRun(const QString& outputDirectory) {
|
||||||
|
_outputDirectory = outputDirectory;
|
||||||
|
|
||||||
|
if (!setPythonCommand()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestTestRailRunDataFromUser();
|
||||||
|
createTestRailDotPyScript();
|
||||||
|
createStackDotPyScript();
|
||||||
|
|
||||||
|
// TestRail will be updated after the process initiated by getTestCasesFromTestRail has completed
|
||||||
|
getTestSectionsFromTestRail();
|
||||||
|
}
|
119
tools/auto-tester/src/TestRailInterface.h
Normal file
119
tools/auto-tester/src/TestRailInterface.h
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
//
|
||||||
|
// TestRailInterface.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 6 Jul 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_test_testrail_interface_h
|
||||||
|
#define hifi_test_testrail_interface_h
|
||||||
|
|
||||||
|
#include "ui/BusyWindow.h"
|
||||||
|
|
||||||
|
#include "ui/TestRailTestCasesSelectorWindow.h"
|
||||||
|
#include "ui/TestRailRunSelectorWindow.h"
|
||||||
|
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <QtXml/QDomDocument>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class TestRailInterface : public QObject{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TestRailInterface();
|
||||||
|
|
||||||
|
void createTestSuiteXML(const QString& testDirectory,
|
||||||
|
const QString& outputDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub);
|
||||||
|
|
||||||
|
void createTestSuitePython(const QString& testDirectory,
|
||||||
|
const QString& outputDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub);
|
||||||
|
|
||||||
|
QDomElement processDirectoryXML(const QString& directory,
|
||||||
|
const QString& useGitHubr,
|
||||||
|
const QString& branchGitHub,
|
||||||
|
const QDomElement& element);
|
||||||
|
|
||||||
|
QDomElement processTestXML(const QString& fullDirectory,
|
||||||
|
const QString& test,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub,
|
||||||
|
const QDomElement& element);
|
||||||
|
|
||||||
|
void processTestPython(const QString& fullDirectory,
|
||||||
|
QTextStream& stream,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub);
|
||||||
|
|
||||||
|
void getMilestonesFromTestRail();
|
||||||
|
void getTestSectionsFromTestRail();
|
||||||
|
|
||||||
|
void createTestRailDotPyScript();
|
||||||
|
void createStackDotPyScript();
|
||||||
|
|
||||||
|
void requestTestRailTestCasesDataFromUser();
|
||||||
|
void requestTestRailRunDataFromUser();
|
||||||
|
|
||||||
|
void createAddTestCasesPythonScript(const QString& testDirectory,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub);
|
||||||
|
|
||||||
|
void processDirectoryPython(const QString& directory,
|
||||||
|
QTextStream& stream,
|
||||||
|
const QString& userGitHub,
|
||||||
|
const QString& branchGitHub);
|
||||||
|
|
||||||
|
bool isAValidTestDirectory(const QString& directory);
|
||||||
|
|
||||||
|
QString getObject(const QString& path);
|
||||||
|
|
||||||
|
void updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
void updateSectionsComboData(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
|
||||||
|
void createTestRailRun(const QString& outputDirectory);
|
||||||
|
|
||||||
|
bool setPythonCommand();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// HighFidelity Interface project ID in TestRail
|
||||||
|
const int INTERFACE_PROJECT_ID{ 24 };
|
||||||
|
|
||||||
|
// Rendering suite ID
|
||||||
|
const int INTERFACE_SUITE_ID{ 1147 };
|
||||||
|
|
||||||
|
QDomDocument _document;
|
||||||
|
|
||||||
|
BusyWindow _busyWindow;
|
||||||
|
TestRailTestCasesSelectorWindow _testRailTestCasesSelectorWindow;
|
||||||
|
TestRailRunSelectorWindow _testRailRunSelectorWindow;
|
||||||
|
|
||||||
|
QString _url;
|
||||||
|
QString _user;
|
||||||
|
QString _password;
|
||||||
|
QString _projectID;
|
||||||
|
QString _suiteID;
|
||||||
|
|
||||||
|
QString _testDirectory;
|
||||||
|
QString _outputDirectory;
|
||||||
|
QString _userGitHub;
|
||||||
|
QString _branchGitHub;
|
||||||
|
|
||||||
|
const QString pythonExe{ "python.exe" };
|
||||||
|
QString _pythonCommand;
|
||||||
|
|
||||||
|
std::map<QString, int> _milestones;
|
||||||
|
QStringList _milestoneNames;
|
||||||
|
|
||||||
|
std::map<QString, int> _sections;
|
||||||
|
QStringList _sectionNames;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -16,56 +16,64 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) {
|
AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) {
|
||||||
ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
ui.checkBoxInteractiveMode->setChecked(true);
|
_ui.checkBoxInteractiveMode->setChecked(true);
|
||||||
ui.progressBar->setVisible(false);
|
_ui.progressBar->setVisible(false);
|
||||||
|
|
||||||
signalMapper = new QSignalMapper();
|
_signalMapper = new QSignalMapper();
|
||||||
|
|
||||||
connect(ui.actionClose, &QAction::triggered, this, &AutoTester::on_closeButton_clicked);
|
connect(_ui.actionClose, &QAction::triggered, this, &AutoTester::on_closeButton_clicked);
|
||||||
connect(ui.actionAbout, &QAction::triggered, this, &AutoTester::about);
|
connect(_ui.actionAbout, &QAction::triggered, this, &AutoTester::about);
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
ui.hideTaskbarButton->setVisible(false);
|
_ui.hideTaskbarButton->setVisible(false);
|
||||||
ui.showTaskbarButton->setVisible(false);
|
_ui.showTaskbarButton->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::setup() {
|
void AutoTester::setup() {
|
||||||
test = new Test();
|
_test = new Test();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user) {
|
void AutoTester::runFromCommandLine(const QString& testFolder, const QString& branch, const QString& user) {
|
||||||
isRunningFromCommandline = true;
|
_isRunningFromCommandline = true;
|
||||||
test->startTestsEvaluation(testFolder, branch, user);
|
_test->startTestsEvaluation(testFolder, branch, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_evaluateTestsButton_clicked() {
|
void AutoTester::on_evaluateTestsButton_clicked() {
|
||||||
test->startTestsEvaluation();
|
_test->startTestsEvaluation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createRecursiveScriptButton_clicked() {
|
void AutoTester::on_createRecursiveScriptButton_clicked() {
|
||||||
test->createRecursiveScript();
|
_test->createRecursiveScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createAllRecursiveScriptsButton_clicked() {
|
void AutoTester::on_createAllRecursiveScriptsButton_clicked() {
|
||||||
test->createAllRecursiveScripts();
|
_test->createAllRecursiveScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createTestsButton_clicked() {
|
void AutoTester::on_createTestsButton_clicked() {
|
||||||
test->createTests();
|
_test->createTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createMDFileButton_clicked() {
|
void AutoTester::on_createMDFileButton_clicked() {
|
||||||
test->createMDFile();
|
_test->createMDFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createAllMDFilesButton_clicked() {
|
void AutoTester::on_createAllMDFilesButton_clicked() {
|
||||||
test->createAllMDFiles();
|
_test->createAllMDFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::on_createTestsOutlineButton_clicked() {
|
void AutoTester::on_createTestsOutlineButton_clicked() {
|
||||||
test->createTestsOutline();
|
_test->createTestsOutline();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoTester::on_createTestRailTestCasesButton_clicked() {
|
||||||
|
_test->createTestRailTestCases();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoTester::on_createTestRailRunButton_clicked() {
|
||||||
|
_test->createTestRailRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
// To toggle between show and hide
|
// To toggle between show and hide
|
||||||
|
@ -96,11 +104,19 @@ void AutoTester::on_closeButton_clicked() {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::downloadImage(const QUrl& url) {
|
void AutoTester::on_createPythonScriptRadioButton_clicked() {
|
||||||
downloaders.emplace_back(new Downloader(url, this));
|
_test->setTestRailCreateMode(PYTHON);
|
||||||
connect(downloaders[_index], SIGNAL (downloaded()), signalMapper, SLOT (map()));
|
}
|
||||||
|
|
||||||
signalMapper->setMapping(downloaders[_index], _index);
|
void AutoTester::on_createXMLScriptRadioButton_clicked() {
|
||||||
|
_test->setTestRailCreateMode(XML);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoTester::downloadImage(const QUrl& url) {
|
||||||
|
_downloaders.emplace_back(new Downloader(url, this));
|
||||||
|
connect(_downloaders[_index], SIGNAL (downloaded()), _signalMapper, SLOT (map()));
|
||||||
|
|
||||||
|
_signalMapper->setMapping(_downloaders[_index], _index);
|
||||||
|
|
||||||
++_index;
|
++_index;
|
||||||
}
|
}
|
||||||
|
@ -113,39 +129,39 @@ void AutoTester::downloadImages(const QStringList& URLs, const QString& director
|
||||||
_numberOfImagesDownloaded = 0;
|
_numberOfImagesDownloaded = 0;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
|
|
||||||
ui.progressBar->setMinimum(0);
|
_ui.progressBar->setMinimum(0);
|
||||||
ui.progressBar->setMaximum(_numberOfImagesToDownload - 1);
|
_ui.progressBar->setMaximum(_numberOfImagesToDownload - 1);
|
||||||
ui.progressBar->setValue(0);
|
_ui.progressBar->setValue(0);
|
||||||
ui.progressBar->setVisible(true);
|
_ui.progressBar->setVisible(true);
|
||||||
|
|
||||||
downloaders.clear();
|
_downloaders.clear();
|
||||||
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
for (int i = 0; i < _numberOfImagesToDownload; ++i) {
|
||||||
QUrl imageURL(URLs[i]);
|
QUrl imageURL(URLs[i]);
|
||||||
downloadImage(imageURL);
|
downloadImage(imageURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int)));
|
connect(_signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::saveImage(int index) {
|
void AutoTester::saveImage(int index) {
|
||||||
try {
|
try {
|
||||||
QFile file(_directoryName + "/" + _filenames[index]);
|
QFile file(_directoryName + "/" + _filenames[index]);
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
file.write(downloaders[index]->downloadedData());
|
file.write(_downloaders[index]->downloadedData());
|
||||||
file.close();
|
file.close();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
QMessageBox::information(0, "Test Aborted", "Failed to save image: " + _filenames[index]);
|
QMessageBox::information(0, "Test Aborted", "Failed to save image: " + _filenames[index]);
|
||||||
ui.progressBar->setVisible(false);
|
_ui.progressBar->setVisible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
++_numberOfImagesDownloaded;
|
++_numberOfImagesDownloaded;
|
||||||
|
|
||||||
if (_numberOfImagesDownloaded == _numberOfImagesToDownload) {
|
if (_numberOfImagesDownloaded == _numberOfImagesToDownload) {
|
||||||
disconnect(signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int)));
|
disconnect(_signalMapper, SIGNAL (mapped(int)), this, SLOT (saveImage(int)));
|
||||||
test->finishTestsEvaluation(isRunningFromCommandline, ui.checkBoxInteractiveMode->isChecked(), ui.progressBar);
|
_test->finishTestsEvaluation(_isRunningFromCommandline, _ui.checkBoxInteractiveMode->isChecked(), _ui.progressBar);
|
||||||
} else {
|
} else {
|
||||||
ui.progressBar->setValue(_numberOfImagesDownloaded);
|
_ui.progressBar->setValue(_numberOfImagesDownloaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,18 +170,18 @@ void AutoTester::about() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::setUserText(const QString& user) {
|
void AutoTester::setUserText(const QString& user) {
|
||||||
ui.userTextEdit->setText(user);
|
_ui.userTextEdit->setText(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AutoTester::getSelectedUser()
|
QString AutoTester::getSelectedUser()
|
||||||
{
|
{
|
||||||
return ui.userTextEdit->toPlainText();
|
return _ui.userTextEdit->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTester::setBranchText(const QString& branch) {
|
void AutoTester::setBranchText(const QString& branch) {
|
||||||
ui.branchTextEdit->setText(branch);
|
_ui.branchTextEdit->setText(branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AutoTester::getSelectedBranch() {
|
QString AutoTester::getSelectedBranch() {
|
||||||
return ui.branchTextEdit->toPlainText();
|
return _ui.branchTextEdit->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,15 @@ private slots:
|
||||||
void on_createMDFileButton_clicked();
|
void on_createMDFileButton_clicked();
|
||||||
void on_createAllMDFilesButton_clicked();
|
void on_createAllMDFilesButton_clicked();
|
||||||
void on_createTestsOutlineButton_clicked();
|
void on_createTestsOutlineButton_clicked();
|
||||||
|
void on_createTestRailTestCasesButton_clicked();
|
||||||
|
void on_createTestRailRunButton_clicked();
|
||||||
|
|
||||||
void on_hideTaskbarButton_clicked();
|
void on_hideTaskbarButton_clicked();
|
||||||
void on_showTaskbarButton_clicked();
|
void on_showTaskbarButton_clicked();
|
||||||
|
|
||||||
|
void on_createPythonScriptRadioButton_clicked();
|
||||||
|
void on_createXMLScriptRadioButton_clicked();
|
||||||
|
|
||||||
void on_closeButton_clicked();
|
void on_closeButton_clicked();
|
||||||
|
|
||||||
void saveImage(int index);
|
void saveImage(int index);
|
||||||
|
@ -56,23 +61,23 @@ private slots:
|
||||||
void about();
|
void about();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AutoTesterClass ui;
|
Ui::AutoTesterClass _ui;
|
||||||
Test* test;
|
Test* _test;
|
||||||
|
|
||||||
std::vector<Downloader*> downloaders;
|
std::vector<Downloader*> _downloaders;
|
||||||
|
|
||||||
// local storage for parameters - folder to store downloaded files in, and a list of their names
|
// local storage for parameters - folder to store downloaded files in, and a list of their names
|
||||||
QString _directoryName;
|
QString _directoryName;
|
||||||
QStringList _filenames;
|
QStringList _filenames;
|
||||||
|
|
||||||
// Used to enable passing a parameter to slots
|
// Used to enable passing a parameter to slots
|
||||||
QSignalMapper* signalMapper;
|
QSignalMapper* _signalMapper;
|
||||||
|
|
||||||
int _numberOfImagesToDownload { 0 };
|
int _numberOfImagesToDownload { 0 };
|
||||||
int _numberOfImagesDownloaded { 0 };
|
int _numberOfImagesDownloaded { 0 };
|
||||||
int _index { 0 };
|
int _index { 0 };
|
||||||
|
|
||||||
bool isRunningFromCommandline { false };
|
bool _isRunningFromCommandline { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AutoTester_h
|
#endif // hifi_AutoTester_h
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>612</width>
|
<width>645</width>
|
||||||
<height>537</height>
|
<height>814</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>380</x>
|
<x>380</x>
|
||||||
<y>430</y>
|
<y>620</y>
|
||||||
<width>101</width>
|
<width>101</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>430</x>
|
<x>430</x>
|
||||||
<y>270</y>
|
<y>490</y>
|
||||||
<width>101</width>
|
<width>101</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>330</x>
|
<x>330</x>
|
||||||
<y>110</y>
|
<y>340</y>
|
||||||
<width>220</width>
|
<width>220</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>320</x>
|
<x>320</x>
|
||||||
<y>280</y>
|
<y>500</y>
|
||||||
<width>131</width>
|
<width>131</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>320</x>
|
<x>320</x>
|
||||||
<y>330</y>
|
<y>550</y>
|
||||||
<width>255</width>
|
<width>255</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>330</x>
|
<x>330</x>
|
||||||
<y>170</y>
|
<y>400</y>
|
||||||
<width>220</width>
|
<width>220</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -229,13 +229,68 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QPushButton" name="createTestRailTestCasesButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>410</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>140</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create TestRail Test Cases</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="createPythonScriptRadioButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>310</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>95</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Python</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="createXMLScriptRadioButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>310</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>95</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>XML</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="createTestRailRunButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>410</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>140</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create TestRail Run</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>612</width>
|
<width>645</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
18
tools/auto-tester/src/ui/BusyWindow.cpp
Normal file
18
tools/auto-tester/src/ui/BusyWindow.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// BusyWindow.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 26 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "BusyWindow.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
BusyWindow::BusyWindow(QWidget *parent) {
|
||||||
|
setupUi(this);
|
||||||
|
}
|
22
tools/auto-tester/src/ui/BusyWindow.h
Normal file
22
tools/auto-tester/src/ui/BusyWindow.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// BusyWindow.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 29 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#ifndef hifi_BusyWindow_h
|
||||||
|
#define hifi_BusyWindow_h
|
||||||
|
|
||||||
|
#include "ui_BusyWindow.h"
|
||||||
|
|
||||||
|
class BusyWindow : public QDialog, public Ui::BusyWindow {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BusyWindow(QWidget* parent = Q_NULLPTR);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
75
tools/auto-tester/src/ui/BusyWindow.ui
Normal file
75
tools/auto-tester/src/ui/BusyWindow.ui
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>BusyWindow</class>
|
||||||
|
<widget class="QDialog" name="BusyWindow">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>542</width>
|
||||||
|
<height>189</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Updating TestRail - please wait</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="errorLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>850</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>similarity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>40</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>481</width>
|
||||||
|
<height>101</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>431</width>
|
||||||
|
<height>61</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Please wait for this window to close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -66,14 +66,14 @@ void MismatchWindow::setTestFailure(TestFailure testFailure) {
|
||||||
QPixmap expectedPixmap = QPixmap(testFailure._pathname + testFailure._expectedImageFilename);
|
QPixmap expectedPixmap = QPixmap(testFailure._pathname + testFailure._expectedImageFilename);
|
||||||
QPixmap actualPixmap = QPixmap(testFailure._pathname + testFailure._actualImageFilename);
|
QPixmap actualPixmap = QPixmap(testFailure._pathname + testFailure._actualImageFilename);
|
||||||
|
|
||||||
diffPixmap = computeDiffPixmap(
|
_diffPixmap = computeDiffPixmap(
|
||||||
QImage(testFailure._pathname + testFailure._expectedImageFilename),
|
QImage(testFailure._pathname + testFailure._expectedImageFilename),
|
||||||
QImage(testFailure._pathname + testFailure._actualImageFilename)
|
QImage(testFailure._pathname + testFailure._actualImageFilename)
|
||||||
);
|
);
|
||||||
|
|
||||||
expectedImage->setPixmap(expectedPixmap);
|
expectedImage->setPixmap(expectedPixmap);
|
||||||
resultImage->setPixmap(actualPixmap);
|
resultImage->setPixmap(actualPixmap);
|
||||||
diffImage->setPixmap(diffPixmap);
|
diffImage->setPixmap(_diffPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MismatchWindow::on_passTestButton_clicked() {
|
void MismatchWindow::on_passTestButton_clicked() {
|
||||||
|
@ -92,5 +92,5 @@ void MismatchWindow::on_abortTestsButton_clicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap MismatchWindow::getComparisonImage() {
|
QPixmap MismatchWindow::getComparisonImage() {
|
||||||
return diffPixmap;
|
return _diffPixmap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
class MismatchWindow : public QDialog, public Ui::MismatchWindow
|
class MismatchWindow : public QDialog, public Ui::MismatchWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +35,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
UserResponse _userResponse{ USER_RESPONSE_INVALID };
|
UserResponse _userResponse{ USER_RESPONSE_INVALID };
|
||||||
|
|
||||||
QPixmap diffPixmap;
|
QPixmap _diffPixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MismatchWindow</class>
|
<class>MismatchWindow</class>
|
||||||
<widget class="QDialog" name="MismatchWindow">
|
<widget class="QDialog" name="MismatchWindow">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -193,4 +196,4 @@
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
101
tools/auto-tester/src/ui/TestRailRunSelectorWindow.cpp
Normal file
101
tools/auto-tester/src/ui/TestRailRunSelectorWindow.cpp
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
//
|
||||||
|
// TestRailRunSelectorWindow.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 31 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "TestRailRunSelectorWindow.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
TestRailRunSelectorWindow::TestRailRunSelectorWindow(QWidget *parent) {
|
||||||
|
setupUi(this);
|
||||||
|
|
||||||
|
projectIDLineEdit->setValidator(new QIntValidator(1, 999, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::reset() {
|
||||||
|
urlLineEdit->setDisabled(false);
|
||||||
|
userLineEdit->setDisabled(false);
|
||||||
|
passwordLineEdit->setDisabled(false);
|
||||||
|
projectIDLineEdit->setDisabled(false);
|
||||||
|
|
||||||
|
OKButton->setDisabled(true);
|
||||||
|
sectionsComboBox->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::on_acceptButton_clicked() {
|
||||||
|
urlLineEdit->setDisabled(true);
|
||||||
|
userLineEdit->setDisabled(true);
|
||||||
|
passwordLineEdit->setDisabled(true);
|
||||||
|
projectIDLineEdit->setDisabled(true);
|
||||||
|
|
||||||
|
OKButton->setDisabled(false);
|
||||||
|
sectionsComboBox->setDisabled(false);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::on_OKButton_clicked() {
|
||||||
|
userCancelled = false;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::on_cancelButton_clicked() {
|
||||||
|
userCancelled = true;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestRailRunSelectorWindow::getUserCancelled() {
|
||||||
|
return userCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::setURL(const QString& user) {
|
||||||
|
urlLineEdit->setText(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailRunSelectorWindow::getURL() {
|
||||||
|
return urlLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::setUser(const QString& user) {
|
||||||
|
userLineEdit->setText(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailRunSelectorWindow::getUser() {
|
||||||
|
return userLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailRunSelectorWindow::getPassword() {
|
||||||
|
return passwordLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::setProjectID(const int project) {
|
||||||
|
projectIDLineEdit->setText(QString::number(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailRunSelectorWindow::getProjectID() {
|
||||||
|
return projectIDLineEdit->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::setSuiteID(const int project) {
|
||||||
|
suiteIDLineEdit->setText(QString::number(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailRunSelectorWindow::getSuiteID() {
|
||||||
|
return suiteIDLineEdit->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailRunSelectorWindow::updateSectionsComboBoxData(QStringList data) {
|
||||||
|
sectionsComboBox->insertItems(0, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailRunSelectorWindow::getSectionID() {
|
||||||
|
return 0;
|
||||||
|
sectionsComboBox->currentIndex();
|
||||||
|
}
|
50
tools/auto-tester/src/ui/TestRailRunSelectorWindow.h
Normal file
50
tools/auto-tester/src/ui/TestRailRunSelectorWindow.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
//
|
||||||
|
// TestRailRunSelectorWindow.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 31 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#ifndef hifi_TestRailRunSelectorWindow_h
|
||||||
|
#define hifi_TestRailRunSelectorWindow_h
|
||||||
|
|
||||||
|
#include "ui_TestRailRunSelectorWindow.h"
|
||||||
|
|
||||||
|
class TestRailRunSelectorWindow : public QDialog, public Ui::TestRailRunSelectorWindow {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TestRailRunSelectorWindow(QWidget* parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
bool getUserCancelled();
|
||||||
|
|
||||||
|
void setURL(const QString& user);
|
||||||
|
QString getURL();
|
||||||
|
|
||||||
|
void setUser(const QString& user);
|
||||||
|
QString getUser();
|
||||||
|
|
||||||
|
QString getPassword();
|
||||||
|
|
||||||
|
void setProjectID(const int project);
|
||||||
|
int getProjectID();
|
||||||
|
|
||||||
|
void setSuiteID(const int project);
|
||||||
|
int getSuiteID();
|
||||||
|
|
||||||
|
bool userCancelled{ false };
|
||||||
|
|
||||||
|
void updateSectionsComboBoxData(QStringList data);
|
||||||
|
int getSectionID();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_acceptButton_clicked();
|
||||||
|
void on_OKButton_clicked();
|
||||||
|
void on_cancelButton_clicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
283
tools/auto-tester/src/ui/TestRailRunSelectorWindow.ui
Normal file
283
tools/auto-tester/src/ui/TestRailRunSelectorWindow.ui
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TestRailRunSelectorWindow</class>
|
||||||
|
<widget class="QDialog" name="TestRailRunSelectorWindow">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>489</width>
|
||||||
|
<height>474</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>TestRail Run Selector Window</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="errorLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>850</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>similarity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>125</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>25</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail URL</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="OKButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>120</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>93</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cancelButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>280</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>93</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="passwordLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>75</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail User</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="projectIDLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>175</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Project ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="acceptButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>270</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Accept</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="sectionsComboBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>140</x>
|
||||||
|
<y>350</y>
|
||||||
|
<width>311</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="milestoneLabel">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>350</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Sections</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="urlLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="userLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="suiteIDLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>215</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Suite ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>urlLineEdit</tabstop>
|
||||||
|
<tabstop>userLineEdit</tabstop>
|
||||||
|
<tabstop>passwordLineEdit</tabstop>
|
||||||
|
<tabstop>projectIDLineEdit</tabstop>
|
||||||
|
<tabstop>suiteIDLineEdit</tabstop>
|
||||||
|
<tabstop>acceptButton</tabstop>
|
||||||
|
<tabstop>sectionsComboBox</tabstop>
|
||||||
|
<tabstop>OKButton</tabstop>
|
||||||
|
<tabstop>cancelButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
100
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.cpp
Normal file
100
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.cpp
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
//
|
||||||
|
// TestRailTestCasesSelectorWindow.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 26 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "TestRailTestCasesSelectorWindow.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
TestRailTestCasesSelectorWindow::TestRailTestCasesSelectorWindow(QWidget *parent) {
|
||||||
|
setupUi(this);
|
||||||
|
|
||||||
|
projectIDLineEdit->setValidator(new QIntValidator(1, 999, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::reset() {
|
||||||
|
urlLineEdit->setDisabled(false);
|
||||||
|
userLineEdit->setDisabled(false);
|
||||||
|
passwordLineEdit->setDisabled(false);
|
||||||
|
projectIDLineEdit->setDisabled(false);
|
||||||
|
|
||||||
|
OKButton->setDisabled(true);
|
||||||
|
milestonesComboBox->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::on_acceptButton_clicked() {
|
||||||
|
urlLineEdit->setDisabled(true);
|
||||||
|
userLineEdit->setDisabled(true);
|
||||||
|
passwordLineEdit->setDisabled(true);
|
||||||
|
projectIDLineEdit->setDisabled(true);
|
||||||
|
|
||||||
|
OKButton->setDisabled(false);
|
||||||
|
milestonesComboBox->setDisabled(false);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::on_OKButton_clicked() {
|
||||||
|
userCancelled = false;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::on_cancelButton_clicked() {
|
||||||
|
userCancelled = true;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestRailTestCasesSelectorWindow::getUserCancelled() {
|
||||||
|
return userCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::setURL(const QString& user) {
|
||||||
|
urlLineEdit->setText(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailTestCasesSelectorWindow::getURL() {
|
||||||
|
return urlLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::setUser(const QString& user) {
|
||||||
|
userLineEdit->setText(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailTestCasesSelectorWindow::getUser() {
|
||||||
|
return userLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TestRailTestCasesSelectorWindow::getPassword() {
|
||||||
|
return passwordLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::setProjectID(const int project) {
|
||||||
|
projectIDLineEdit->setText(QString::number(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailTestCasesSelectorWindow::getProjectID() {
|
||||||
|
return projectIDLineEdit->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::setSuiteID(const int project) {
|
||||||
|
suiteIDLineEdit->setText(QString::number(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailTestCasesSelectorWindow::getSuiteID() {
|
||||||
|
return suiteIDLineEdit->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailTestCasesSelectorWindow::updateMilestonesComboBoxData(QStringList data) {
|
||||||
|
milestonesComboBox->insertItems(0, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailTestCasesSelectorWindow::getMilestoneID() {
|
||||||
|
return milestonesComboBox->currentIndex();
|
||||||
|
}
|
50
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.h
Normal file
50
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
//
|
||||||
|
// TestRailTestCasesSelectorWindow.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 26 Jul 2017.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#ifndef hifi_TestRailTestCasesSelectorWindow_h
|
||||||
|
#define hifi_TestRailTestCasesSelectorWindow_h
|
||||||
|
|
||||||
|
#include "ui_TestRailTestCasesSelectorWindow.h"
|
||||||
|
|
||||||
|
class TestRailTestCasesSelectorWindow : public QDialog, public Ui::TestRailTestCasesSelectorWindow {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TestRailTestCasesSelectorWindow(QWidget* parent = Q_NULLPTR);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
bool getUserCancelled();
|
||||||
|
|
||||||
|
void setURL(const QString& user);
|
||||||
|
QString getURL();
|
||||||
|
|
||||||
|
void setUser(const QString& user);
|
||||||
|
QString getUser();
|
||||||
|
|
||||||
|
QString getPassword();
|
||||||
|
|
||||||
|
void setProjectID(const int project);
|
||||||
|
int getProjectID();
|
||||||
|
|
||||||
|
void setSuiteID(const int project);
|
||||||
|
int getSuiteID();
|
||||||
|
|
||||||
|
bool userCancelled{ false };
|
||||||
|
|
||||||
|
void updateMilestonesComboBoxData(QStringList data);
|
||||||
|
int getMilestoneID();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_acceptButton_clicked();
|
||||||
|
void on_OKButton_clicked();
|
||||||
|
void on_cancelButton_clicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
280
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.ui
Normal file
280
tools/auto-tester/src/ui/TestRailTestCasesSelectorWindow.ui
Normal file
|
@ -0,0 +1,280 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TestRailTestCasesSelectorWindow</class>
|
||||||
|
<widget class="QDialog" name="TestRailTestCasesSelectorWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>489</width>
|
||||||
|
<height>474</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>TestRail Test Case Selector Window</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="errorLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>850</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>similarity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>125</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>25</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail URL</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="OKButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>120</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>93</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cancelButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>280</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>93</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="passwordLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>75</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail User</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="projectIDLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>175</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Project ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="acceptButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>270</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Accept</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="milestonesComboBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>270</x>
|
||||||
|
<y>350</y>
|
||||||
|
<width>161</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="milestoneLabel">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>140</x>
|
||||||
|
<y>350</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Milestone</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="urlLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="userLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="suiteIDLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>215</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Suite ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>urlLineEdit</tabstop>
|
||||||
|
<tabstop>userLineEdit</tabstop>
|
||||||
|
<tabstop>passwordLineEdit</tabstop>
|
||||||
|
<tabstop>projectIDLineEdit</tabstop>
|
||||||
|
<tabstop>suiteIDLineEdit</tabstop>
|
||||||
|
<tabstop>acceptButton</tabstop>
|
||||||
|
<tabstop>milestonesComboBox</tabstop>
|
||||||
|
<tabstop>OKButton</tabstop>
|
||||||
|
<tabstop>cancelButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in a new issue