diff --git a/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_aborter_timeout.json b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_aborter_timeout.json new file mode 100644 index 000000000000..bb63b15219eb --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_aborter_timeout.json @@ -0,0 +1,6 @@ +{ + "recordings": [], + "uniqueTestInfo": { + "queue": "queue156332152913504024" + } +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_calls_abort.json b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_calls_abort.json new file mode 100644 index 000000000000..a3d672fa6407 --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_calls_abort.json @@ -0,0 +1,6 @@ +{ + "recordings": [], + "uniqueTestInfo": { + "queue": "queue156332152914004887" + } +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_timeout.json b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_timeout.json new file mode 100644 index 000000000000..d353c2ac7263 --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_after_parent_aborter_timeout.json @@ -0,0 +1,6 @@ +{ + "recordings": [], + "uniqueTestInfo": { + "queue": "queue156332152914507000" + } +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_when_calling_abort_before_request_finishes.json b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_when_calling_abort_before_request_finishes.json new file mode 100644 index 000000000000..3101886c61cb --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/aborter/recording_should_abort_when_calling_abort_before_request_finishes.json @@ -0,0 +1,6 @@ +{ + "recordings": [], + "uniqueTestInfo": { + "queue": "queue156332152881302622" + } +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/test/aborter.spec.ts b/sdk/storage/storage-queue/test/aborter.spec.ts index f55038123b1a..650e430f91a4 100644 --- a/sdk/storage/storage-queue/test/aborter.spec.ts +++ b/sdk/storage/storage-queue/test/aborter.spec.ts @@ -37,6 +37,7 @@ describe("Aborter", () => { }); it("should abort when calling abort() before request finishes", async () => { + recorder.skip("browser"); const aborter = Aborter.none; const response = queueClient.create({ abortSignal: aborter }); aborter.abort(); @@ -54,6 +55,7 @@ describe("Aborter", () => { }); it("should abort after aborter timeout", async () => { + recorder.skip("browser"); try { await queueClient.create({ abortSignal: Aborter.timeout(1) }); assert.fail(); @@ -61,6 +63,7 @@ describe("Aborter", () => { }); it("should abort after parent aborter calls abort()", async () => { + recorder.skip("browser"); try { const aborter = Aborter.none; const response = queueClient.create({ abortSignal: aborter.withTimeout(10 * 60 * 1000) }); @@ -71,6 +74,7 @@ describe("Aborter", () => { }); it("should abort after parent aborter timeout", async () => { + recorder.skip("browser"); try { const aborter = Aborter.timeout(1); const response = queueClient.create({ abortSignal: aborter.withTimeout(10 * 60 * 1000) }); diff --git a/sdk/storage/storage-queue/test/utils/recorder.ts b/sdk/storage/storage-queue/test/utils/recorder.ts index 30293272e200..3ca39cb9d458 100644 --- a/sdk/storage/storage-queue/test/utils/recorder.ts +++ b/sdk/storage/storage-queue/test/utils/recorder.ts @@ -93,18 +93,18 @@ export function delay(milliseconds: number): Promise | null { * * Tempfile: the request makes use of a random tempfile created locally, and the recorder does not support recording it as unique information * * UUID: a UUID is randomly generated within the SDK and used in an HTTP request, resulting in Nock being unable to recognize it */ -const skip = [ - // Abort - "browsers/aborter/recording_should_abort_after_aborter_timeout.json", - // Abort - "browsers/aborter/recording_should_abort_after_parent_aborter_calls_abort.json", - // Abort - "browsers/aborter/recording_should_abort_after_parent_aborter_timeout.json", - // Abort - "browsers/aborter/recording_should_abort_when_calling_abort_before_request_finishes.json", - // Character - "browsers/messagesurl/recording_enqueue_peek_dequeue_special_characters.json" -]; +// const skip = [ +// // Abort +// "browsers/aborter/recording_should_abort_after_aborter_timeout.json", +// // Abort +// "browsers/aborter/recording_should_abort_after_parent_aborter_calls_abort.json", +// // Abort +// "browsers/aborter/recording_should_abort_after_parent_aborter_timeout.json", +// // Abort +// "browsers/aborter/recording_should_abort_when_calling_abort_before_request_finishes.json", +// // Character +// "browsers/messagesurl/recording_enqueue_peek_dequeue_special_characters.json" +// ]; abstract class Recorder { protected readonly filepath: string; @@ -153,9 +153,9 @@ abstract class Recorder { return updatedRecording; } - public skip(): boolean { - return skip.includes(this.filepath); - } + // public skip(): boolean { + // return skip.includes(this.filepath); + // } public abstract record(): void; public abstract playback(): void; @@ -436,9 +436,9 @@ export function record(testContext: any) { recorder = new NockRecorder(testHierarchy, testTitle); } - if (recorder.skip() && (isRecording || isPlayingBack)) { - testContext.skip(); - } + // if (recorder.skip() && (isRecording || isPlayingBack)) { + // testContext.skip(); + // } // If neither recording nor playback is enabled, requests hit the live-service and no recordings are generated if (isRecording) { @@ -453,6 +453,26 @@ export function record(testContext: any) { recorder.stop(); } }, + /** + * @param runtime [string] Let the recorder know when to skip the test - browser or node.js runtime. + */ + skip: function(runtime: string) { + if (isRecording) { + if (runtime === "node" && !isBrowser()) { + recorder.stop(); + testContext.skip(); + } else if (runtime === "browser" && isBrowser()) { + recorder.stop(); + testContext.skip(); + } + } else if (isPlayingBack) { + if (runtime === "node" && !isBrowser()) { + testContext.skip(); + } else if (runtime === "browser" && isBrowser()) { + testContext.skip(); + } + } + }, getUniqueName: function(prefix: string, recorderId?: string): string { let name: string; if (!recorderId) {