fix(webdriverio): implement switchFrame for Bidi#13728
Merged
christian-bromann merged 8 commits intomainfrom Oct 11, 2024
Merged
fix(webdriverio): implement switchFrame for Bidi#13728christian-bromann merged 8 commits intomainfrom
christian-bromann merged 8 commits intomainfrom
Conversation
13 tasks
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/browserstack-service
@wdio/cli
@wdio/config
@wdio/concise-reporter
@wdio/cucumber-framework
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/spec-reporter
@wdio/smoke-test-service
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
webdriver
webdriverio
commit: |
beea95e to
34dfe56
Compare
| * transform context tree into a flat list of context objects with references | ||
| * to children | ||
| */ | ||
| const allContexts: Record<string, FlatContextTree> = tree.contexts.map(mapContext).flat(Infinity) |
Member
There was a problem hiding this comment.
what does the .flat(Infinite) do here? haven't seen this before
Member
Author
There was a problem hiding this comment.
.flat() by default only flattens with a depth of 1, so:
[1, [2, [3]]].flat() === [1, 2, [3]]With infinity we flatten the array infinity times:
[1, [2, [3]]].flat() === [1, 2, 3]
erwinheitzman
approved these changes
Oct 11, 2024
Member
erwinheitzman
left a comment
There was a problem hiding this comment.
Added some suggestions but nothing major, looking great Christian. Well done, love how clean and readable the code is!
Co-authored-by: Erwin Heitzman <15839059+erwinheitzman@users.noreply.github.com>
Contributor
|
This doesn't appear to work for classic frame elements. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
This is a new approach to handle frame switches with Bidi. I want to introduce a new command
switchFrame(aligned with other commands likeswitchWindow) that simplifies the way user can switch into frames.Command docs:
Switches the active context to a frame, e.g. an iframe on the page. There are multiple ways you can query a frame
on the page:
If given a string it switches to the frame with a matching context id, url or url that contains that string
If given a WebdriverIO element that references an
iframeelement it will switch to that frameIf given a function it will loop through all iframes on the page and call the function with the context
object. The function should return a boolean indicating if the frame should be selected. Within the function
you can use WebdriverIO commands to e.g. check if a certain frame element exists.
If given
nullit will switch to the top level frameTypes of changes
Checklist
Backport Request
//: # (The current
mainbranch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against thev8branch.)v9and doesn't need to be back-ported#XXXXXFurther comments
Reviewers: @webdriverio/project-committers