mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 02:49:29 +08:00
DEV: Speed chat channel system test (#21820)
Why is this change required? In the `PageObjects::Components::Chat::Messages#has_no_message?` method, it ended up calling `has_selector` when trying to assert that the selector is not present. This is an anti-pattern which results in us waiting the full Capybara default wait time
This commit is contained in:
parent
289fb8f29c
commit
e7b55c11df
|
@ -12,16 +12,25 @@ module PageObjects
|
|||
@context = context
|
||||
end
|
||||
|
||||
def does_not_exist?(**args)
|
||||
exists?(**args, does_not_exist: true)
|
||||
end
|
||||
|
||||
def exists?(**args)
|
||||
selectors = SELECTOR
|
||||
selectors += "[data-id=\"#{args[:id]}\"]" if args[:id]
|
||||
selectors += ".is-persisted" if args[:persisted]
|
||||
selectors += ".is-staged" if args[:staged]
|
||||
selector_method = args[:does_not_exist] ? :has_no_selector? : :has_selector?
|
||||
|
||||
if args[:text]
|
||||
find(context).has_selector?(selectors + " " + ".chat-message-text", text: args[:text])
|
||||
find(context).send(
|
||||
selector_method,
|
||||
selectors + " " + ".chat-message-text",
|
||||
text: args[:text],
|
||||
)
|
||||
else
|
||||
find(context).has_selector?(selectors)
|
||||
find(context).send(selector_method, selectors)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module PageObjects
|
|||
end
|
||||
|
||||
def has_no_message?(**args)
|
||||
!has_message?(**args)
|
||||
PageObjects::Components::Chat::Message.new(".chat-channel").does_not_exist?(**args)
|
||||
end
|
||||
|
||||
def has_x_messages?(count)
|
||||
|
|
Loading…
Reference in New Issue
Block a user