From 933f04d03f3811442c0b1b54bb7c4fde71bc73c1 Mon Sep 17 00:00:00 2001 From: Damian Osipiuk Date: Sat, 12 Jun 2021 00:42:50 +0200 Subject: [PATCH] fix: wait for attachment upload --- src/index.ts | 4 ++-- src/utils/upload-screenshots.ts | 18 ++++++++---------- src/utils/upload-videos.ts | 18 ++++++++---------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8841d70..24631c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -280,7 +280,7 @@ class TestcafeTestrailReporter { ); const { value: tests } = await throwOnApiError(testrailAPI.getTests(runId)); - uploadScreenshots({ + await uploadScreenshots({ config: this.config, tests, results, @@ -289,7 +289,7 @@ class TestcafeTestrailReporter { testrailAPI, }); - uploadVideos({ + await uploadVideos({ config: this.config, tests, results, diff --git a/src/utils/upload-screenshots.ts b/src/utils/upload-screenshots.ts index bbe294a..e612e69 100644 --- a/src/utils/upload-screenshots.ts +++ b/src/utils/upload-screenshots.ts @@ -3,7 +3,14 @@ import { TestRail, AddResultForCase, Test, Result } from "testrail-js-api"; import { throwOnApiError } from "../utils"; import type { Config, Screenshot } from "../types"; -type UploadScreenshots = (options: { +export const uploadScreenshots = async ({ + config, + tests, + results, + resultsToPush, + screenshots, + testrailAPI, +}: { config: Config; tests: Test[]; results: Result[]; @@ -12,15 +19,6 @@ type UploadScreenshots = (options: { [key: string]: Screenshot[]; }; testrailAPI: TestRail; -}) => void; - -export const uploadScreenshots: UploadScreenshots = async ({ - config, - tests, - results, - resultsToPush, - screenshots, - testrailAPI, }) => { if (config.uploadScreenshots) { console.log("[TestRail] Uploading screenshots..."); diff --git a/src/utils/upload-videos.ts b/src/utils/upload-videos.ts index 20e438e..87837a6 100644 --- a/src/utils/upload-videos.ts +++ b/src/utils/upload-videos.ts @@ -3,7 +3,14 @@ import { TestRail, AddResultForCase, Test, Result } from "testrail-js-api"; import { throwOnApiError } from "../utils"; import type { Config, Video } from "../types"; -type UploadVideos = (options: { +export const uploadVideos = async ({ + config, + tests, + results, + resultsToPush, + videos, + testrailAPI, +}: { config: Config; tests: Test[]; results: Result[]; @@ -12,15 +19,6 @@ type UploadVideos = (options: { [key: string]: Video[]; }; testrailAPI: TestRail; -}) => void; - -export const uploadVideos: UploadVideos = async ({ - config, - tests, - results, - resultsToPush, - videos, - testrailAPI, }) => { if (config.uploadVideos) { console.log("[TestRail] Uploading videos...");