Hello,

I faced the following issue while
1)Go to project issues page http://drupal.org/project/issues.
2)When we write a scenario for selecting a project name under project field (for ex "Userda"),then after after selecting "Userdashboard"
3)When I press "Search"(project issues filter search).It is taking the top Search button eventhough I mentioned the id for project search button.It is giving the error Click failed.
I guess there is a conflict between to search boxes in the same page.

To fix the above issue.
1)We have written a seperate call back for this search button(project issues filter search) and we have field with value and then used the pressButton method.
Then its working fine.

Please suggest if there is an alternative approach to solve this issue.

Thanks,
Suresh

CommentFileSizeAuthor
#3 project-search-feature-1681444.patch2.68 KBeliza411

Comments

sachin2dhoni’s picture

Hi,
I pushed the scenario(search.feature) which we are facing the issue with the search button existing more than once in the same page.
http://drupalcode.org/sandbox/eliza411/1663360.git/blob/6f7ad10d19939af2...
Also pushed the scenario(projectsearch.feature) where i have added a separate call back(iPressSearchToFilter) for the search button for resolving the issue.
http://drupalcode.org/sandbox/eliza411/1663360.git/blob/f477a8c6d8b3a846...

Please suggest.

Thanks,
Suresh

eliza411’s picture

A few thoughts:

For buttons, you can use the label, id, or name. Since we seem to get a "begins with" or "contains" match (I haven't tested which) we fail on both label and id:

Site Search:
Label - Search drupal.org
Id - edit-search-theme-form-1
Name - search_theme_form

Project Search:
Label - Search for
Id - edit-text
Name - text

Maybe name would work, but it seems awfully generic.

Cases like this are where I think the things Sundar is working on in #1676758: Problem with page containing the same string more than once will come in handy. Since Drupal has the concept of regions, we should be able to get a more reusable step by saying:

And I press "Search Drupal.org" in the "header" region ... we're not there yet and I think we'll get clarification on this approach next week during training.

What you've done seems like a perfectly appropriate, client-readable choice!

I'm also interested in finding out whether we can refine the included steps to be more precise in their matching. I'll put this on the list of question for training, too.

eliza411’s picture

Title: Problem with the submit button existing more than once in the same page. » Problem with the submit button existing more than once in the same page. (search.feature)
Assigned: Unassigned » sachin2dhoni
Status: Active » Needs review
StatusFileSize
new2.68 KB

I've implemented a new step for another feature:

/**
* @When /^I search sitewide for "([^"]*)"$/
*/
public function iSearchFor($searchterm) {
$element = $this->getSession()->getPage();
$element->fillField('edit-search-theme-form-1', $searchterm);
$submit = $element->findById('search-theme-form-submit');
if (empty($submit)) {
throw new Exception('No submit button at ' . $session->getCurrentUrl());
}
$submit->click();
}

I'm still giving thought to how to narrow down the other searches on the page.

In the meantime, I'm attaching a patch that gets the language into the Gherkin syntax of just one Given/When/Then. Sadly, every line appears replaced so it's harder to see what's going on.

eliza411’s picture

Also ... I think this file would more properly be called project_search.feature to distinguish it from the sitewide search and Issue searches elsewhere on the site. If you make and commit that change, would you update the title accordingly?

eliza411’s picture

Issue tags: +sprint 1

tagging

sachin2dhoni’s picture

Hi,

I have added the feature file project_search.feature and done the necessary changes and added few more scenarios and implemented proper indentation and syntax standards as suggested.

In the same feature file for one of the scenario below
Scenario: For Searching issues with all filters(Line no:59)
When I select the following with
| fields | values |
| Status | active |
| Priority | normal |
| Category | Any |
etc..

Here we can select the multiple select boxes in a single step.For this I have written a step definition earlier, "iSelectTheFollowingFieldsWithValues" in the Feature Context and I hope this is much helpful if there are multiple select-boxes in the form.

Please check this and let me know if there any better approach.
And also please suggest if any necessary changes to be done on the same .

Thanks,
Suresh

eliza411’s picture

Title: Problem with the submit button existing more than once in the same page. (search.feature) » Problem with the submit button existing more than once in the same page. (search.feature project_search.feature)
Status: Needs review » Needs work

Please double check the indentation which is off in a couple of places.

None of these passed in Goutte so I ran them in selenium. Is that expected? The page seems usable in a text-based browser. In selenium they all passed except the last two.

The multiselect step definition seems like it will be quite useful!

sachin2dhoni’s picture

Assigned: sachin2dhoni » Unassigned
Status: Needs work » Needs review

"None of these passed in Goutte" - this is because httpuser/httppass was renamed to username/password and was not updated in beforeScenario function. This has been corrected by Sundar and it seems to work fine now.

Only one of the scenario requires to run selenium because it has autocomplete functionality.

I have corrected the indentation as well.

eliza411’s picture

Status: Needs review » Fixed

These are committed.
Relevant commits are:
http://drupalcode.org/project/doobie.git/commit/6f269438
http://drupalcode.org/project/doobie.git/commit/2dfae72

I'm opening a new issue regarding a more generic way of handling the fact that the sitewide search conflicts with so many other forms.

#1704922: Create a step definition for Search buttons that excludes the sitewide search

Automatically closed -- issue fixed for 2 weeks with no activity.