-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[grid] Remove browserName
capability from stereotype and SlotMatcher when using Relay Node to test a mobile application
#15537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
…d browser and native app Signed-off-by: Viet Nguyen Duc <[email protected]>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the handling of relay sessions for Appium by refining capability matching and filtering logic in both DefaultSlotMatcher and RelaySessionFactory. Key changes include:
- Enhancements to DefaultSlotMatcher to incorporate Appium-specific capabilities.
- Integration of capability filtering in RelaySessionFactory to remove conflicting browserName settings.
- Addition of comprehensive test cases to validate both new matching and filtering behavior, along with an update to the Bazel build configuration for Mockito.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java | Enhanced matching logic for Appium-specific relay capabilities |
java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java | Added filtering logic to remove conflicting browserName settings |
java/test/org/openqa/selenium/grid/node/relay/RelaySessionFactoryTest.java | Added unit tests for capability filtering behavior |
java/test/org/openqa/selenium/grid/data/DefaultSlotMatcherTest.java | Added unit tests for new slot matching scenarios |
java/test/org/openqa/selenium/grid/node/relay/BUILD.bazel | Updated build configuration to include the Mockito dependency |
Files not reviewed (1)
- java/test/org/openqa/selenium/grid/node/relay/BUILD.bazel: Language not supported
Comments suppressed due to low confidence (1)
java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java:178
- [nitpick] There are two overloaded methods named 'browserVersionMatch' (one accepting strings and one accepting Capabilities). Consider renaming one of them for better clarity of intent.
private boolean browserVersionMatch(String stereotype, String capabilities) {
PR Code Suggestions ✨Explore these optional code suggestions:
|
CI Feedback 🧐(Feedback updated until commit b56648b)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Signed-off-by: Viet Nguyen Duc <[email protected]>
4079ca3
to
36f83af
Compare
public static final List<String> SPECIFIC_RELAY_CAPABILITIES_APP = | ||
Arrays.asList("appium:app", "appium:appPackage", "appium:bundleId"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do a match on these Appium capabilities? Those should be just passed along the session request.
Maybe I am misunderstanding what this PR is trying to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diemol, I tried to change the PR name to understand better.
[grid] Remove
browserName
capability from stereotype and SlotMatcher when using Relay Node to test a mobile application
To recognise when a Relay Node is used to forward a test for native app or hybrid browser session to Appium, we have to rely on these capabilities.
Definitely, we don't do a match on these Appium capabilities. The ultimate goal is to check if any capability is present in the request capabilities, we remove browserName
from both stereotype (skip browserName
match in SlotMatcher), assign to a Relay Node and forward the session to Appium (let Appium launch the native app, instead of launching the browser session there, which is #14247 tried to do).
browserName
capability from stereotype and SlotMatcher when using Relay Node
browserName
capability from stereotype and SlotMatcher when using Relay NodebrowserName
capability from stereotype and SlotMatcher when using Relay Node to test a mobile application
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Motivation and Context
The fix in PR #14247 looks like not work.
In this fix, try to make logic in DefaultSlotMatcher and RelaySessionFactory to be same. Since before coming to RelaySessionFactory.test(), a basic match of W3C caps has already been done (in DefaultSlotMatcher).
Besides unit tests, here is the end2end tests
Relay Node config
This code for native app can be reached 2 slots
And this code for hybrid browser session, which can be reached 1st slot (platformVersion 14), where
browserName
is set in Node stereotype.Types of changes
Checklist
PR Type
Bug fix, Tests
Description
Enhanced
DefaultSlotMatcher
to handle hybrid browser and native app sessions.Added logic to filter conflicting capabilities in
RelaySessionFactory
.Introduced new test cases for relay node matching and capability filtering.
Updated Bazel build configuration to include Mockito dependency.
Changes walkthrough 📝
DefaultSlotMatcher.java
Enhanced SlotMatcher for Appium and hybrid session handling
java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java
specificRelayCapabilitiesAppMatch
for Appium-relatedcapabilities.
RelaySessionFactory.java
Added capability filtering in RelaySessionFactory
java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java
filterRelayCapabilities
to handle conflicting capabilities.DefaultSlotMatcherTest.java
Added tests for DefaultSlotMatcher enhancements
java/test/org/openqa/selenium/grid/data/DefaultSlotMatcherTest.java
RelaySessionFactoryTest.java
Added tests for RelaySessionFactory capability filtering
java/test/org/openqa/selenium/grid/node/relay/RelaySessionFactoryTest.java
filterRelayCapabilities
method.BUILD.bazel
Updated Bazel build for Mockito dependency
java/test/org/openqa/selenium/grid/node/relay/BUILD.bazel