Skip to content

Commit

Permalink
e2e tests: continue when test is hanging
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Feb 7, 2024
1 parent f6ba751 commit a993410
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/e2e/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ const runTests = async () => {
mockNetwork: true,
});

const onError = (e) => {
testLog.done();
if (i === 0) {
// If the error happened on the first test run, the test is broken
// and we should not continue running it
throw e;
}
console.error(e);
};

// Wait for a test to finish by waiting on its done call to the http server
try {
await withFailTimeout(
Expand All @@ -352,9 +362,7 @@ const runTests = async () => {
progressText,
);
} catch (e) {
// When we fail due to a timeout it's interesting to take a screenshot of the emulator to see whats going on
testLog.done();
throw e; // Rethrow to abort execution
onError(e);
}

Logger.log('Killing main app');
Expand All @@ -378,9 +386,7 @@ const runTests = async () => {
progressText,
);
} catch (e) {
// When we fail due to a timeout it's interesting to take a screenshot of the emulator to see whats going on
testLog.done();
throw e; // Rethrow to abort execution
onError(e);
}
}
testLog.done();
Expand Down

0 comments on commit a993410

Please sign in to comment.