Page MenuHomePhabricator

create custom RSpec matchers for when_present, when_not_present, etc
Closed, InvalidPublic

Description

see the discussion at

https://lists.wikimedia.org/pipermail/qa/2014-October/002021.html

this would allow us to not have to make 2-line Then statements along the lines of

Then(/^the top post is an open discussion$/) do

on(FlowPage) do |page|
  page.flow_first_topic_moderation_msg_element.when_not_present
  expect(page.flow_first_topic_moderation_element).not_to be_visible
end

end


Version: wmf-deployment
Severity: normal

Details

Reference
bz72149

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:43 AM
bzimport set Reference to bz72149.
bzimport added a subscriber: Unknown Object (MLST).

Zeljko and I dug into this and we discovered that refactoring has removed most instance of this sort of thing. But here is one example still in place, from reply_steps.rb in Flow:

Then(/^I should see the topic reply form$/) do

on(FlowPage) do |page|
  page.wait_until { page.new_reply_input_element.visible? }
  expect(page.new_reply_input_element).to be_visible
end

end

This should do the same thing:

Then(/^I should see the topic reply form$/) do
  expect(on(FlowPage).new_reply_input_element.when_visible).to be_visible
end

I think this should actually be

Then(/^I should see the topic reply form$/) do

  expect(on(FlowPage).new_reply_input_element.when_present).to be_visible
end

but this makes sense

(In reply to Chris McMahon from comment #3)

Then(/^I should see the topic reply form$/) do

  expect(on(FlowPage).new_reply_input_element.when_present).to be_visible
end

If it's not present, won't this actually timeout on the when_present (as S brought up in his email), before the expect runs?

refactoring actually corrected the problem instances