0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-12 05:37:26 +08:00
discourse/plugins/discourse-captcha/spec/system/page_objects/components/captcha.rb
Juan David Martínez Cubillos 04b5530f34
DEV: Plugin rename discourse captcha (#39350)
####  Description:
This PR renames the `discourse-hcaptcha` plugin to `discourse-captcha`
to better reflect its support for multiple captcha providers (hCaptcha
and reCAPTCHA)

#### Changes

- Renamed plugin directory from plugins/discourse-hcaptcha to
plugins/discourse-captcha
- Updated Ruby module namespace from DiscourseHcaptcha to
DiscourseCaptcha
  - Updated references in:
    - .gitignore
    - pnpm-workspace.yaml
    - tsconfig.json
    - config/official_plugins.json
    - translator.yml
    - migrations/core/config/intermediate_db.yml
    - `hosted-site` plugin
- Migration file preserved to handle existing discourse_hcaptcha_enabled
setting migration

---------

Co-authored-by: Gabriel Grubba <gabriel@discourse.org>
2026-07-21 17:21:39 -05:00

40 lines
920 B
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Components
class Captcha < PageObjects::Components::Base
def has_hcaptcha_container?
page.has_css?("#h-captcha-field")
end
def has_no_hcaptcha_container?
page.has_no_css?("#h-captcha-field")
end
def has_recaptcha_container?
page.has_css?("#g-recaptcha")
end
def has_no_recaptcha_container?
page.has_no_css?("#g-recaptcha")
end
def has_captcha_error?
page.has_css?(".captcha-container + .alert-error") ||
page.has_css?(".captcha-service-tip .bad")
end
def has_captcha_widget?
has_hcaptcha_widget? || has_recaptcha_widget?
end
def has_hcaptcha_widget?
page.has_css?("#h-captcha-field iframe")
end
def has_recaptcha_widget?
page.has_css?("#g-recaptcha iframe")
end
end
end
end