Page MenuHomePhabricator

Flow reply_moderation browser test has erroneous selector for "3rd comment on the topic"
Closed, DeclinedPublic

Description

A couple of tests use the step

When(/^I click the Post Actions link on the 3rd comment on the topic$/) do
  on(FlowPage).third_post_actions_link_element.when_present.click
end

The selector for third_post_actions_link is

a(:third_post_actions_link, css: ".flow-topic .flow-post .flow-menu-js-drop a", index: 3)

but if the first three topics only have one post each, this will happily select the action link for the first post on the third topic.

I think the selector has to get the first ".flow-topic" (there is a flow_first_topic_element already defined), and then within this look for '.flow-menu-js-drop a', index: 3. In jQuery/Sizzle, this would be $( '.flow-topic:first .flow-post .flow-menu-js-drop a:eq(2)').click() (JavaScript/jQuery uses 0-based index, so 2 is the third item).

I think the third_post_actions_menu_element has a similar flaw.

If you look at the screencast of a browser test failing near this, you see that a bunch of extraneous topics appear on the page, I think because another test is running at the same time. The test fails at `And I click Hide comment button' but the real error is before that. Fixing this bug will make the test fail at the right place, but it will still fail. What all Flow tests really need to do is target "The topic I just added", instead of assuming that the topic they've added will always be the first one on the board.

Event Timeline

Spage assigned this task to Cmcmahon.
Spage raised the priority of this task from to Needs Triage.
Spage triaged this task as Low priority.
Spage updated the task description. (Show Details)
Spage set Security to None.
Spage added a subscriber: Spage.

Thanks for filing this. I noticed this in a test run recently. I meant to fix it right away and forgot. I'll take a look at sorting this out better.

The more I look at this, the more I think I want to rearrange how the whole FlowPage is structured.

Having recently sorted all the features and steps and made them tidy, refactoring the page itself should be not unreasonable.

Cmcmahon raised the priority of this task from Low to Medium.Jan 5 2015, 4:55 PM

Looks like the page element has not changed:

a(:third_post_actions_link, css: ".flow-topic .flow-post .flow-menu-js-drop a", index: 3)

https://github.com/wikimedia/mediawiki-extensions-Flow/blob/master/tests/browser/features/support/pages/flow_page.rb#L171

zeljkofilipin claimed this task.

No reply in months, resolving. Please reopen if the problem is still present.

dduvall raised the priority of this task from Medium to Unbreak Now!.Jun 16 2015, 3:34 PM
dduvall moved this task from Waiting to Done on the Browser-Tests-Infrastructure board.
Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald Transcript