Skip to content

Add seeCurrentPathEquals method to ignore query strings#5435

Open
DavertMik wants to merge 2 commits into4.xfrom
feature/see-current-path-equals
Open

Add seeCurrentPathEquals method to ignore query strings#5435
DavertMik wants to merge 2 commits into4.xfrom
feature/see-current-path-equals

Conversation

@DavertMik
Copy link
Contributor

Adds new assertion method to check URL path equality while ignoring query parameters and URL fragments.

Usage

I.seeCurrentPathEquals('/info'); // passes for '/info', '/info?user=1', '/info#section'
I.seeCurrentPathEquals('/');     // passes for '/', '/?user=ok', '/#top'

Implementation

  • Uses native URL class for pathname extraction
  • Added to Playwright, Puppeteer, and WebDriver helpers
  • Includes tests and documentation

Closes #{add-issue-number-if-any}

DavertMik and others added 2 commits February 6, 2026 07:24
Adds new assertion method to check URL path equality while ignoring
query parameters and URL fragments.

- I.seeCurrentPathEquals('/info') passes for '/info?user=1', '/info#section'
- I.seeCurrentPathEquals('/') passes for '/', '/?user=ok', '/#top'

Implemented in Playwright, Puppeteer, and WebDriver helpers using native
URL class for pathname extraction.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds the negative counterpart to seeCurrentPathEquals for checking
that URL paths do not match, ignoring query strings and fragments.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
const actualPath = new URL(currentUrl, baseUrl).pathname
const errorMessage = `expected url path not to be ${path}, but found ${actualPath}`
const isEqual = path === actualPath
if (isEqual) throw new Error(errorMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a similar function for Playwright and Puppeteer, without custom logic at the end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants