Skip to content

Commit 06fe960

Browse files
DavertMikclaude
andcommitted
Refactor WebDriver seeCurrentPathEquals to use equals().assert/negate pattern
Aligns WebDriver.js implementation with Playwright.js and Puppeteer.js by using the consistent `equals('url path').assert()` and `.negate()` pattern instead of custom assert.equal and manual error throwing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e6a9649 commit 06fe960

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/helper/WebDriver.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ class WebDriver extends Helper {
18511851
const currentUrl = await this.browser.getUrl()
18521852
const baseUrl = this.options.url || 'http://localhost'
18531853
const actualPath = new URL(currentUrl, baseUrl).pathname
1854-
return assert.equal(path, actualPath, `expected url path to be ${path}, but found ${actualPath}`)
1854+
return equals('url path').assert(path, actualPath)
18551855
}
18561856

18571857
/**
@@ -1861,9 +1861,7 @@ class WebDriver extends Helper {
18611861
const currentUrl = await this.browser.getUrl()
18621862
const baseUrl = this.options.url || 'http://localhost'
18631863
const actualPath = new URL(currentUrl, baseUrl).pathname
1864-
const errorMessage = `expected url path not to be ${path}, but found ${actualPath}`
1865-
const isEqual = path === actualPath
1866-
if (isEqual) throw new Error(errorMessage)
1864+
return equals('url path').negate(path, actualPath)
18671865
}
18681866

18691867
/**

0 commit comments

Comments
 (0)