Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTalank <talank@gces.edu.np>2022-03-24 08:06:19 +0300
committerGitHub <noreply@github.com>2022-03-24 08:06:19 +0300
commit2dc0817747f5b1b001eb3de0bfb39914786ae874 (patch)
tree26aa052a68ee29dd2553d8644dcd70ac7005aefa /test
parent56bb3dbfe1cf75d516a029769eb3f9cde631eccc (diff)
[Tests-Only]Enabled screenshot of desktop on test failure (#9518)
Diffstat (limited to 'test')
-rw-r--r--test/gui/drone/comment.sh10
-rw-r--r--test/gui/shared/scripts/bdd_hooks.py18
2 files changed, 27 insertions, 1 deletions
diff --git a/test/gui/drone/comment.sh b/test/gui/drone/comment.sh
index e0e463c66..730a84324 100644
--- a/test/gui/drone/comment.sh
+++ b/test/gui/drone/comment.sh
@@ -13,7 +13,7 @@ else
echo "creating comment for GUI log"
# if there is index.html generated by squishrunner then create a comment indicating link of GUI result
if [[ -f $1/index.html ]]; then
- echo ":boom: The GUI tests failed."
+ echo ":boom: The GUI tests failed." >> $1/comments.file
echo "GUI Logs: (${CACHE_ENDPOINT}/${CACHE_BUCKET}/$2/$3/guiReportUpload/index.html)" >> $1/comments.file
fi
@@ -22,4 +22,12 @@ else
echo "creating comment for server log"
echo "Server Logs: (${CACHE_ENDPOINT}/${CACHE_BUCKET}/$2/$3/guiReportUpload/serverlog.log)" >> $1/comments.file
fi
+
+ if ! [[ $(find $1/screenshots -maxdepth 0 -empty) ]]; then
+ echo "creating comment for screenshots"
+ echo "Screenshots:" >> $1/comments.file
+ for i in $(ls $1/screenshots); do
+ echo "- [$i](${CACHE_ENDPOINT}/${CACHE_BUCKET}/$2/$3/guiReportUpload/screenshots/$i)" >> $1/comments.file
+ done
+ fi
fi \ No newline at end of file
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py
index 53492bd2f..f36132868 100644
--- a/test/gui/shared/scripts/bdd_hooks.py
+++ b/test/gui/shared/scripts/bdd_hooks.py
@@ -93,6 +93,24 @@ def hook(context):
@OnScenarioEnd
def hook(context):
+ # capture screenshot if there is error in the scenario execution, and if the test is being run in CI
+ if test.resultCount("errors") > 0 and os.getenv('CI'):
+ import gi
+
+ gi.require_version('Gtk', '3.0')
+ from gi.repository import Gdk
+
+ window = Gdk.get_default_root_window()
+ pb = Gdk.pixbuf_get_from_window(window, *window.get_geometry())
+
+ filename = context._data["title"].replace(" ", "_") + ".png"
+ directory = os.environ["GUI_TEST_REPORT_DIR"] + "/screenshots"
+
+ if not os.path.exists(directory):
+ os.makedirs(directory)
+
+ pb.savev(os.path.join(directory, filename), "png", [], [])
+
# Detach (i.e. potentially terminate) all AUTs at the end of a scenario
for ctx in applicationContextList():
ctx.detach()