Files
gitlab-foss/spec/support/helpers/testid_helpers.rb
2024-10-10 18:15:04 +00:00

20 lines
544 B
Ruby

# frozen_string_literal: true
module TestidHelpers
def has_testid?(testid, context: page, **kwargs)
context.has_selector?("[data-testid='#{testid}']", **kwargs)
end
def find_by_testid(testid, context: page, **kwargs)
context.find("[data-testid='#{testid}']", **kwargs)
end
def all_by_testid(testid, context: page, **kwargs)
context.all("[data-testid='#{testid}']", **kwargs)
end
def within_testid(testid, context: page, **kwargs, &block)
context.within("[data-testid='#{testid}']", **kwargs, &block)
end
end