mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: adds a tooltip system spec component (#28275)
Usage: ``` tooltip = PageObjects::Components::Tooltips.new(identifier) expect(tooltip).to be_present(text: "Welcome") expect(tooltip).to be_not_present(text: "Welcome") tooltip.find(".my-button).click ```
This commit is contained in:
27
spec/system/page_objects/components/tooltips.rb
Normal file
27
spec/system/page_objects/components/tooltips.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Components
|
||||
class Tooltips < PageObjects::Components::Base
|
||||
SELECTOR = ".fk-d-tooltip__content"
|
||||
|
||||
attr_reader :identifier
|
||||
|
||||
def initialize(identifier)
|
||||
@identifier = identifier
|
||||
end
|
||||
|
||||
def find(selector, **kwargs)
|
||||
page.find("#{SELECTOR}[data-identifier='#{identifier}'] #{selector}", **kwargs)
|
||||
end
|
||||
|
||||
def present?(**kwargs)
|
||||
page.has_selector?("#{SELECTOR}[data-identifier='#{identifier}']", **kwargs)
|
||||
end
|
||||
|
||||
def not_present?(**kwargs)
|
||||
page.has_no_selector?("#{SELECTOR}[data-identifier='#{identifier}']", **kwargs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user