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
|
@context = context
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def does_not_exist?(**args)
|
||||||
|
exists?(**args, does_not_exist: true)
|
||||||
|
end
|
||||||
|
|
||||||
def exists?(**args)
|
def exists?(**args)
|
||||||
selectors = SELECTOR
|
selectors = SELECTOR
|
||||||
selectors += "[data-id=\"#{args[:id]}\"]" if args[:id]
|
selectors += "[data-id=\"#{args[:id]}\"]" if args[:id]
|
||||||
selectors += ".is-persisted" if args[:persisted]
|
selectors += ".is-persisted" if args[:persisted]
|
||||||
selectors += ".is-staged" if args[:staged]
|
selectors += ".is-staged" if args[:staged]
|
||||||
|
selector_method = args[:does_not_exist] ? :has_no_selector? : :has_selector?
|
||||||
|
|
||||||
if args[:text]
|
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
|
else
|
||||||
find(context).has_selector?(selectors)
|
find(context).send(selector_method, selectors)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ module PageObjects
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_no_message?(**args)
|
def has_no_message?(**args)
|
||||||
!has_message?(**args)
|
PageObjects::Components::Chat::Message.new(".chat-channel").does_not_exist?(**args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_x_messages?(count)
|
def has_x_messages?(count)
|
||||||
|
|
Loading…
Reference in New Issue