From 17eb3dc2160e11d12ce8a0ec436698862a111191 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Wed, 20 Dec 2023 10:40:20 +0100 Subject: [PATCH] fix: screenshot not found --- lib/testrail.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/testrail.js b/lib/testrail.js index 5f4b9ae..7b6ad58 100644 --- a/lib/testrail.js +++ b/lib/testrail.js @@ -175,12 +175,12 @@ class TestRail { } async addAttachmentToResult(resultId, imageFile) { - - const isFileExisting = await holdBeforeFileExists(imageFile); + const screenshotPath = path.join(global.output_dir, imageFile.toString()); + const isFileExisting = await holdBeforeFileExists(screenshotPath); if (isFileExisting) { let form = new FormData(); - form.append('attachment', fs.createReadStream(path.join(global.output_dir, imageFile.toString()))); + form.append('attachment', fs.createReadStream(screenshotPath)); await this.axios({ method: 'post', @@ -219,7 +219,7 @@ module.exports = TestRail; * @param {Number} timeout in millisecond * @returns {Promise} */ -const holdBeforeFileExists = async (filePath, timeout = 3000) => { +const holdBeforeFileExists = async (filePath, timeout = 5000) => { timeout = timeout < 1000 ? 1000 : timeout; try { let nom = 0;