diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-03-01 00:19:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-01 00:19:18 +0300 |
commit | bfc5d69e05f3003f1dd606f01424151a89c535c9 (patch) | |
tree | 23f81a51bbbca00931b1aea031f8c668c8bb8065 /tests/lib | |
parent | dfafa5720f14e7a7419a25e0d59ad86806b6113c (diff) |
place failure screenshots in plugin directory if plugin option is given (#15643)
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/screenshot-testing/support/app.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/lib/screenshot-testing/support/app.js b/tests/lib/screenshot-testing/support/app.js index 1290ac4b81..ba809d1e71 100644 --- a/tests/lib/screenshot-testing/support/app.js +++ b/tests/lib/screenshot-testing/support/app.js @@ -236,10 +236,17 @@ Application.prototype.loadTestModules = function () { message += "\n" + indent + indent + "Url to reproduce: " + url + "\n"; if (message.indexOf('Generated screenshot') === -1) { - if (!fs.existsSync(path.join(PIWIK_INCLUDE_PATH, 'tests/UI/processed-ui-screenshots'))) { - fsExtra.mkdirsSync(path.join(PIWIK_INCLUDE_PATH, 'tests/UI/processed-ui-screenshots')); + + var processedPath = path.join(PIWIK_INCLUDE_PATH, 'tests/UI/processed-ui-screenshots'); + + if (options.plugin) { + processedPath = path.join(PIWIK_INCLUDE_PATH, 'plugins', options.plugin, 'tests/UI/processed-ui-screenshots'); + } + + if (!fs.existsSync(processedPath)) { + fsExtra.mkdirsSync(processedPath); } - const failurePath = path.join(PIWIK_INCLUDE_PATH, 'tests/UI/processed-ui-screenshots', test.title.replace(/(\s|[^a-zA-Z0-9_])+/g, '_') + '_failure.png'); + const failurePath = path.join(processedPath, test.title.replace(/(\s|[^a-zA-Z0-9_])+/g, '_') + '_failure.png'); message += indent + indent + "Screenshot of failure: " + failurePath + "\n"; |