Skip to content

Check for hostname before setting isMac to true#10297

Merged
christian-bromann merged 5 commits intowebdriverio:mainfrom
therealbrad:fix-ctrl-on-remote-instances
May 4, 2023
Merged

Check for hostname before setting isMac to true#10297
christian-bromann merged 5 commits intowebdriverio:mainfrom
therealbrad:fix-ctrl-on-remote-instances

Conversation

@therealbrad
Copy link
Contributor

@therealbrad therealbrad commented May 1, 2023

Proposed changes

//: # Check if hostname is set when determining if instance is running locally. Without this check, a local mac os instance can send Command key to a remote Window instance.

Types of changes

  • 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

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 necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 1, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@christian-bromann
Copy link
Member

@therealbrad thanks for taking a stab at this. Let's make sure we add proper unit tests so we don't run into any regressions moving on. There are already existing unit tests for this case. Also we need you to have the CLA signed. Thank you!

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.

LGTM 👍

Once the CLA is signed I can go ahead and merge this.

@therealbrad
Copy link
Contributor Author

/easycla

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.

Thank you 👍

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label May 2, 2023
@christian-bromann
Copy link
Member

@therealbrad there seems to be an failure in the test?

@therealbrad
Copy link
Contributor Author

@christian-bromann My bad. I meant to remove that test because I didn't see a way to run unit tests and set browser.options.hostname to null. Is there a way to do that?

@christian-bromann
Copy link
Member

I thought browser.options.hostname = 'local' would do the trick because it is the same value as this.instance if not we should track down where this.instance is defined and find a way to modify that value for our test purposes. You are always free to write an individual unit test for the action class itself if it makes writing the test easier.

@therealbrad
Copy link
Contributor Author

@christian-bromann I changed it to explicitly check if running locally via hostname instead of assuming it. Seems to work but I don't know if this breaks anything else.

@christian-bromann
Copy link
Member

Thank you @therealbrad

@christian-bromann christian-bromann merged commit b30eb47 into webdriverio:main May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants