Skip to content

Commit db2bff1

Browse files
committed
include actual error in waitUrlEquals when URL matches
1 parent d815dfc commit db2bff1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/helper/Playwright.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3557,7 +3557,11 @@ class Playwright extends Helper {
35573557
.catch(async e => {
35583558
const currUrl = await this._getPageUrl() // Required because the waitForFunction can't return data.
35593559
if (/Timeout/i.test(e.message)) {
3560-
throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`)
3560+
if (urlPart !== currUrl) {
3561+
throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`)
3562+
} else {
3563+
throw new Error(`expected url not loaded, error message: ${e.message}`)
3564+
}
35613565
} else {
35623566
throw e
35633567
}

lib/helper/Puppeteer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,11 @@ class Puppeteer extends Helper {
24672467
.catch(async e => {
24682468
const currUrl = await this._getPageUrl() // Required because the waitForFunction can't return data.
24692469
if (/Waiting failed/i.test(e.message) || /failed: timeout/i.test(e.message)) {
2470-
throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`)
2470+
if (urlPart !== currUrl) {
2471+
throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`)
2472+
} else {
2473+
throw new Error(`expected url not loaded, error message: ${e.message}`)
2474+
}
24712475
} else {
24722476
throw e
24732477
}

0 commit comments

Comments
 (0)