Skip to content

Commit

Permalink
fix: screenshot not found
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Dec 20, 2023
1 parent cab480e commit 17eb3dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/testrail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -219,7 +219,7 @@ module.exports = TestRail;
* @param {Number} timeout in millisecond
* @returns {Promise<Boolean>}
*/
const holdBeforeFileExists = async (filePath, timeout = 3000) => {
const holdBeforeFileExists = async (filePath, timeout = 5000) => {
timeout = timeout < 1000 ? 1000 : timeout;
try {
let nom = 0;
Expand Down

0 comments on commit 17eb3dc

Please sign in to comment.