SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.41k stars 8.15k forks source link

[🚀 Feature]: Add rbs files to Ruby #10943

Open titusfortner opened 2 years ago

titusfortner commented 2 years ago

Feature and motivation

We're adding Type hints to Python & looking at TypeScript for JS, the equivalent for Ruby is to add rbs files.

Ruby Selenium does a lot of meta-programming which makes it more difficult to use with an IDE like RubyMine. Adding rbs files, *should make this much easier.

Usage example

I think they'll look like this?

module Selenium
  module WebDriver
    module Edge
      class Options < Selenium::WebDriver::Chrome::Options
        KEY:String
        BROWSER:String

        def enable_logging: (browser_options: Hash) -> Hash

        def binary_path: () -> String
      end
    end
  end
end

and then RubyMine and other IDEs will be able to do type hints, etc

github-actions[bot] commented 2 years ago

@titusfortner, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 1 year ago

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

aguspe commented 1 year ago

Hi I would like to help out with this, I forked the repo and created a new PR to start adding RBS files

titusfortner commented 1 year ago

That would be great, we'd appreciate the help with it.

Hah, Sparkling Watir, I like it! You didn't have to fork it, though, you could have just taken over Tap Watir. 😁 I wish I'd had the time to work on it back when people were asking for it.

aguspe commented 1 year ago

Haha, it's good to know, I assumed people were really busy, so I thought the fork was the easiest way to have something working fast.

But if it's okay, I could take over, I have a couple of PRs open in Tap Watir, which is just the extra stuff I added for Sparkling Watir, so I can update and merge them.

And use Sparkling Watir for Desktop automation with Appium, which is something I have been playing with on another gem.

titusfortner commented 1 year ago

Oh, I saw there were PRs at one point, and, well, life... I added you as maintainer to the tap watir repo There's a Watir channel on slack if you want to discuss things there - https://www.selenium.dev/support/#ChatRoom

titusfortner commented 9 months ago

We're making some great progress on this. Thanks to @aguspe / @Pexpe Do we need to track what we have and what we still need?

aguspe commented 9 months ago

We're making some great progress on this. Thanks to @aguspe / @Pexpe Do we need to track what we have and still need?

Hi @titusfortner thank you so much, right now I'm working on this draft: https://github.com/SeleniumHQ/selenium/pull/13234, I added all the generated RBS files for all classes and modules, and then I'm fixing all the steep issues that originated, I added two screenshots there but hopefully after the holidays I will be able to wrap this PR up and put it for review

titusfortner commented 9 months ago

Awesome! Is that PR everything, or how much more will still need to be worked on?

aguspe commented 9 months ago

Awesome! Is that PR everything, or how much more will still need to be worked on?

That PR is everything, except the Bazel implementation, so after that PR we should be able to add steep to Bazel and have the type check implementation

Also Happy new year!

aguspe commented 7 months ago

Just an update on this issue @titusfortner - I'm still working on it, currently there are 125 errors on 43 files, compared to the stat of 1558 errors on 151 files

Several of the errors are related to other libraries we are using so I'm looking into which steep checks we can omit, and eventually making PRs for RBS on other libraries

My goal is to hopefully put the PR up for review https://github.com/SeleniumHQ/selenium/pull/13234, at the end of this month after I solve the rest of the errors and update all the undefined types

I hope is not too much trouble for you and your team that the PR is so big

titusfortner commented 7 months ago

I mean, if it passes whatever is the appropriate tests, I'm sure we'll get feedback and PRs for anything that isn't quite right. These are just a guide after all, right? 😄

Thanks for your work.

aguspe commented 7 months ago

I mean, if it passes whatever is the appropriate tests, I'm sure we'll get feedback and PRs for anything that isn't quite right. These are just a guide after all, right? 😄

Thanks for your work.

Haha that's right, then I will drive this PR home by removing all the errors and starting making some PRs to get the right types and hopefully more people will jump in

Have a great weekend

aguspe commented 7 months ago

Just duplicating the last comment on the PR for visibility here:

The latest update after updating the ignore list, I wrote in the steep file the 62 ignore errors across 28 files, I will keep investigating in the case of overloading issues or libraries such as URI and NET::HTTP that give unwanted RBS issues:

Screenshot 2024-03-06 at 22 31 20

Then of course we will need to keep updating the files to replace all the untype signatures where is fit