Skip to content

fix(selectivity): stabilize navigation coverage - #1311

Merged
KuznetsovRoman merged 3 commits into
masterfrom
TESTPLANE-1099.selectivity_navigation_v9
Aug 21, 2026
Merged

fix(selectivity): stabilize navigation coverage#1311
KuznetsovRoman merged 3 commits into
masterfrom
TESTPLANE-1099.selectivity_navigation_v9

Conversation

@KuznetsovRoman

Copy link
Copy Markdown
Member

No description provided.

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1311

commit: 78b2377

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Clicks need to be intercepted and queued, because chromedriver itself does not wait for navigation to complete, and we need to.
Order:

 startClick()
 WebDriver originalClick()
 beforeunload / coverage snapshot
 Debugger.resume
 navigation commit
 DOMContentLoaded или load
 page-start coverage flush
 click() returns the value

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pulled out existing cdp hooks from index.ts to here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

State machine module, that stores navigation state of the browser

@KuznetsovRoman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 1f0b41afc7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@KuznetsovRoman
KuznetsovRoman force-pushed the TESTPLANE-1099.selectivity_navigation_v9 branch from 1f0b41a to bf1f1bb Compare August 18, 2026 21:55
export const enableClickCommandGuard = (browser: WebdriverIO.Browser, guard: ClickCommandGuard): (() => void) => {
activeGuards.set(browser, guard);

if (!guardedBrowsers.has(browser)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would write like this:

const cb = () => {
    if (activeGuards.get(browser) === guard) {
        guard.cancelClick();
        activeGuards.delete(browser);
    }
};

if (guardedBrowsers.has(browser)) {
  return cb;
}

// a lot of code

return cb;

will allow to reduce the nesting a little bit

const guardedBrowsers = new WeakSet<WebdriverIO.Browser>();

/**
* Install one persistent click wrapper because WebdriverIO commands cannot be restored after overwriteCommand.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure that install is correct word here? in fact, nothing is installed here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The click wrapper is installed
Given how hard to undo the "overwriteCommand" effect, it pretty much looks like installation.
e.g. hooks are installed too.

@KuznetsovRoman
KuznetsovRoman force-pushed the TESTPLANE-1099.selectivity_navigation_v9 branch from 4c16f95 to 78b2377 Compare August 21, 2026 14:56
@KuznetsovRoman
KuznetsovRoman merged commit a0f6b6b into master Aug 21, 2026
9 checks passed
@KuznetsovRoman
KuznetsovRoman deleted the TESTPLANE-1099.selectivity_navigation_v9 branch August 21, 2026 15:11
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