Skip to content

Commit

Permalink
fix: provider video download failure should not stop tests (#233)
Browse files Browse the repository at this point in the history
* fix: device provider video fix

* chore: added changeset

* chore: updated changeset
  • Loading branch information
pushpam5 authored Nov 28, 2024
1 parent 131021a commit ed2762a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-cherries-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"appwright": patch
---

fix: provider video download failure should not stop tests
6 changes: 4 additions & 2 deletions src/providers/browserstack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,15 @@ export class BrowserStackDeviceProvider implements DeviceProvider {
});
if (response.status !== 200) {
// Retry if not 200
throw new Error(
logger.error(
`Video not found: ${response.status} (URL: ${videoURL})`,
);
return;
}
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body.");
logger.error("Failed to get reader from response body.");
return;
}
const streamToFile = async () => {
// eslint-disable-next-line no-constant-condition
Expand Down
6 changes: 4 additions & 2 deletions src/providers/lambdatest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ export class LambdaTestDeviceProvider implements DeviceProvider {
});
if (response.status !== 200) {
// Retry if not 200
throw new Error(
logger.error(
`Video not found: ${response.status} (URL: ${videoURL})`,
);
return;
}
const reader = response.body?.getReader();
if (!reader) {
throw new Error("Failed to get reader from response body.");
logger.error("Failed to get reader from response body.");
return;
}
const streamToFile = async () => {
// eslint-disable-next-line no-constant-condition
Expand Down

0 comments on commit ed2762a

Please sign in to comment.