Skip to content

[java] bug(#12791) Grid vnc session is not using the --sub-path argument #13219

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

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

VietND96
Copy link
Member

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.

Description

Fix: WebSocket connection for vnc session is not using the --sub-path argument #12791

Motivation and Context

When --grid-url is set with subPath e.g via docker env

        - name: SE_NODE_GRID_URL
          value: "http://selenium-hub:4444/qlabv2"

but in node Capabilities, the URL still not have sub path

  "se:cdp": "ws://selenium-hub:4444/session/623cb93cd9438c195578b7edc5b0b534/se/cdp",
  "se:cdpVersion": "119.0.6045.105",
  "se:vnc": "ws://selenium-hub:4444/session/623cb93cd9438c195578b7edc5b0b534/se/vnc",
  "se:vncEnabled": true,

It is due to rewrite is missing to capture path from gridUrl if it has any

private URI rewrite(String path) {
try {
String scheme = "https".equals(gridUri.getScheme()) ? "wss" : "ws";
return new URI(
scheme, gridUri.getUserInfo(), gridUri.getHost(), gridUri.getPort(), path, null, null);

This leads to the issue on grid UI, NoVNC live preview WebSocket connection incorrect, since the URL is constructed based on URL of se:vnc
let vnc: string = parsed['se:vnc'] ?? ''
if (vnc.length > 0) {
try {
const url = new URL(origin)
const vncUrl = new URL(vnc)
url.pathname = vncUrl.pathname
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
vnc = url.href

Types of changes

  • Bug fix (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 change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (82f5c18) 57.95% compared to head (0c4d7b8) 57.95%.
Report is 4 commits behind head on trunk.

❗ Current head 0c4d7b8 differs from pull request most recent head 8a5803c. Consider uploading reports for the commit 8a5803c to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #13219   +/-   ##
=======================================
  Coverage   57.95%   57.95%           
=======================================
  Files          88       88           
  Lines        5333     5333           
  Branches      224      224           
=======================================
  Hits         3091     3091           
  Misses       2018     2018           
  Partials      224      224           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@titusfortner titusfortner added the B-grid Everything grid and server related label Nov 29, 2023
@pujagani pujagani requested a review from diemol November 30, 2023 05:11
@VietND96
Copy link
Member Author

VietND96 commented Dec 4, 2023

@diemol, can you review this update?

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

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

Thank you, @VietND96!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-grid Everything grid and server related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: WebSocket connection for vnc session is not using the --sub-path argument
4 participants