Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(navigation): do not count random failures as navigation cancel (#1055)

Dmitry Gozman9f1edadbff88
diff --git a/src/frames.ts b/src/frames.ts
index adc5b17dc2..fee3c2e0e6 100644
--- a/src/frames.ts
+++ b/src/frames.ts
@@ -428,9 +428,10 @@ export class Frame {
let resolve: (error: Error|void) => void;
const promise = new Promise<Error|void>(x => resolve = x);
const watch = (documentId: string, error?: Error) => {
- if (documentId !== expectedDocumentId)
- return resolve(new Error('Navigation interrupted by another one'));
- resolve(error);
+ if (documentId === expectedDocumentId)
+ resolve(error);
+ else if (!error)
+ resolve(new Error('Navigation interrupted by another one'));
};
const dispose = () => this._documentWatchers.delete(watch);
this._documentWatchers.add(watch);