Skip to content

reorder shadowroot removal#13800

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
ccharnkij:delete-shadowroot-order
Oct 25, 2024
Merged

reorder shadowroot removal#13800
christian-bromann merged 1 commit intowebdriverio:mainfrom
ccharnkij:delete-shadowroot-order

Conversation

@ccharnkij
Copy link
Contributor

Proposed changes

Fix for #13521. So this happens due to the sequence in which shadowRoots are removed. Currently, shadowRoots that are duplicate can be added to the children set and are removed in a first-in-first-out fashion. In the reproducible, the shadowRoot needed to find the element is the child of the first shadowRoot added in the children set. This is followed by a duplicate and a removeShadowRoot entry, which fetches and removes that first child.

For example,

root
root.addShadowElement( child('1') )
root.addShadowElement( '1', child('2') )
root.addShadowElement( '1', child('2') ) <-- now there are 2 child 2
root.addShadowElement( '2', child('3') ) <-- child 3 attached to the first child 2
root.remove( '2' ) <-- remove the first child 2 which has child 3 attached and any element that requires child 3 can't be found

I fix this by changing the order when removing and make it remove the last one first. I test this with the reproducible example and it works. However, I'm not experienced in how bidi receives shadowRoots and not sure if the current way is the intended way (maybe should have discuss with you first on discord). Let me know how it goes, and if this is not valid, please close this.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Reviewers: @webdriverio/project-committers

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 25, 2024

Open in Stackblitz

eslint-plugin-wdio

pnpm add https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@13800

@wdio/appium-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@13800

@wdio/allure-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@13800

@wdio/browser-runner

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@13800

@wdio/browserstack-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/browserstack-service@13800

@wdio/cli

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@13800

@wdio/concise-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@13800

@wdio/config

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@13800

@wdio/firefox-profile-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@13800

@wdio/dot-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@13800

@wdio/cucumber-framework

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@13800

@wdio/jasmine-framework

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@13800

@wdio/globals

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@13800

@wdio/json-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@13800

@wdio/junit-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@13800

@wdio/lighthouse-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@13800

@wdio/local-runner

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@13800

@wdio/logger

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@13800

@wdio/mocha-framework

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@13800

@wdio/protocols

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@13800

@wdio/reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@13800

@wdio/repl

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@13800

@wdio/runner

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@13800

@wdio/sauce-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@13800

@wdio/shared-store-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@13800

@wdio/smoke-test-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@13800

@wdio/smoke-test-cjs-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@13800

@wdio/smoke-test-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@13800

@wdio/spec-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@13800

@wdio/sumologic-reporter

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@13800

@wdio/static-server-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@13800

@wdio/testingbot-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@13800

@wdio/types

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@13800

@wdio/utils

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@13800

@wdio/webdriver-mock-service

pnpm add https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@13800

webdriver

pnpm add https://pkg.pr.new/webdriverio/webdriverio/webdriver@13800

webdriverio

pnpm add https://pkg.pr.new/webdriverio/webdriverio@13800

commit: 3f8d600

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Love this ❤️ thanks so much!

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Oct 25, 2024
@christian-bromann christian-bromann merged commit 62f9360 into webdriverio:main Oct 25, 2024
@wdio-bot
Copy link
Contributor

Hey ccharnkij 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

@ccharnkij ccharnkij deleted the delete-shadowroot-order branch December 5, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expensable $50 💸 PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants