-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
[rb] Add FedCM support to the ruby selenium client #13796
base: trunk
Are you sure you want to change the base?
[rb] Add FedCM support to the ruby selenium client #13796
Conversation
…guspe/selenium into add_fedcm_support_for_the_ruby_library
…guspe/selenium into add_fedcm_support_for_the_ruby_library
PR Review 🔍
|
PR Code Suggestions ✨
|
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.
This definitely looks like a great start, thank you for working on this!
Can we add more tests to verify all the endpoints such as delays and cooldowns?
@@ -0,0 +1,10 @@ | |||
# frozen_string_literal: true |
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.
Can you move this file to common
folder?
end | ||
|
||
def fedcm_dialog | ||
@fedcm_dialog ||= Selenium::WebDriver::FedCM::Dialog.new(@bridge) |
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.
You can avoid Selenium::WebDriver::
here since it's the code is already within this module.
end | ||
|
||
def wait_for_fedcm_dialog(timeout: 5, interval: 0.2, message: nil, ignore: nil) | ||
wait = Selenium::WebDriver::Wait.new(timeout: timeout, interval: interval, message: message, ignore: ignore) |
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.
You can avoid Selenium::WebDriver:: here since it's the code is already within this module.
@@ -0,0 +1,31 @@ | |||
module Selenium |
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.
Can you move this directory to common/fedcm
folder?
@@ -1,20 +0,0 @@ | |||
module Selenium |
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.
I think you removed it by accident, can you pleas restore?
module WebDriver | ||
module FedCM | ||
describe Dialog, exclusive: {browser: :chrome} do | ||
let(:url) { 'https://fedcm-rp-demo.glitch.me/' } |
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.
Unfortunately, our tests should be atomic and not depend on external websites. Is it possible to replicate a demo similar to how we test basic authentication (
selenium/rb/spec/integration/selenium/webdriver/spec_support/rack_server.rb
Lines 122 to 123 in 2994952
when '/basicAuth' | |
authorize(env) |
expect(account.privacy_policy_url).to eq('privacy-policy-url') | ||
end | ||
|
||
it 'has a constant LOGIN_STATE_SIGNIN' 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.
I don't think it is important to test constant values, we are just testing implementation detail.
module WebDriver | ||
module FedCM | ||
describe Dialog do | ||
let(:bridge) { instance_double(Selenium::WebDriver::Remote::Bridge) } |
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.
You can avoid Selenium::WebDriver::
here since it's the code is already within this module.
module Selenium | ||
module WebDriver | ||
module FedCM | ||
describe Dialog, exclusive: {browser: :chrome} 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.
Let's switch from exclusive
to only
- this will ensure tests are run in other browsers but expected to fail.
User description
Description
As mentioned in #12088
The goal is to add support for the Federal credential management API (FedCM) so users have access to commands that will enable them to automate it
Reference Docs:
https://fedidcg.github.io/FedCM/#automation
https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API
Motivation and Context
On Chrome 108 FedCM has shipped and it's already implemented by several web solutions, by adding support to the client library we guarantee that more users can automate this functionality without work arounds
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
FedCM
module withAccount
andDialog
classes.HasFedCmDialog
driver extension for managing FedCM dialogs.Changes walkthrough 📝
12 files
webdriver.rb
Add autoload for FedCM module.
rb/lib/selenium/webdriver.rb
FedCM
.driver.rb
Include HasFedCmDialog in driver extensions.
rb/lib/selenium/webdriver/chromium/driver.rb
HasFedCmDialog
to driver extensions.common.rb
Require has_fedcm_dialog in common driver extensions.
rb/lib/selenium/webdriver/common.rb
has_fedcm_dialog
in common driver extensions.has_fedcm_dialog.rb
Add HasFedCmDialog module for FedCM dialog management.
rb/lib/selenium/webdriver/common/driver_extensions/has_fedcm_dialog.rb
HasFedCmDialog
module with methods for FedCM dialog management.fedcm.rb
Introduce FedCM module with autoload.
rb/lib/selenium/webdriver/fedcm.rb
account.rb
Add Account class for FedCM accounts.
rb/lib/selenium/webdriver/fedcm/account.rb
dialog.rb
Add Dialog class for FedCM interactions.
rb/lib/selenium/webdriver/fedcm/dialog.rb
bridge.rb
Add FedCM dialog management methods in bridge.
rb/lib/selenium/webdriver/remote/bridge.rb
commands.rb
Add FedCM commands to bridge.
rb/lib/selenium/webdriver/remote/bridge/commands.rb
account.rbs
Add type signatures for FedCM Account.
rb/sig/lib/selenium/webdriver/fedcm/account.rbs
dialog.rbs
Add type signatures for FedCM Dialog.
rb/sig/lib/selenium/webdriver/fedcm/dialog.rbs
has_fed_cm_dialog.rbs
Add type signatures for HasFedCmDialog.
rb/sig/selenium/web_driver/driver_extensions/has_fed_cm_dialog.rbs
3 files
dialog_spec.rb
Add integration tests for FedCM dialog.
rb/spec/integration/selenium/webdriver/fedcm/dialog_spec.rb
account_spec.rb
Add unit tests for FedCM Account.
rb/spec/unit/selenium/webdriver/fedcm/account_spec.rb
dialog_spec.rb
Add unit tests for FedCM Dialog.
rb/spec/unit/selenium/webdriver/fedcm/dialog_spec.rb