Commit 92cd96d3 authored by Rebecca Blundell's avatar Rebecca Blundell Committed by Robert Lyon
Browse files

Bug 1733995: fix for targetting hidden select2 search box

Change-Id: I62bf8065c82fba34f9eea1a3e3e004523b19abee
parent d9ce7d92
......@@ -218,6 +218,28 @@ class BehatForms extends BehatBase {
$this->i_click_on_element($locator, $selectortype);
}
/**
*
* Step to select from a previously hidden search box
* needs to be called after calling with share_with_select2's "Search for..." option
*
* @When I select :user from select2 search box in row number :row_num
* @param string $user
* @param int $row_num
*/
public function select_from_search_box($user, $row_num) {
$row_num = $row_num -1;
//create xpath for correct search box
$search_xpath = "//*[@id=\"select2-hidden-user-search-[$row_num]-container\"]";
$this->i_click_on_element($search_xpath, 'xpath_element');
//create xpath for the user being searched for
$user_xpath = "//*[@id[starts-with(., 'select2-hidden-user-search')]]/span[contains(text(), \"$user\")]";
$this->i_click_on_element($user_xpath, 'xpath_element');
}
/**
* Select value in choice list
*
......
......@@ -16,6 +16,8 @@ Background:
| Page UserA_02 | Page 02 | user | UserA |
| Page UserB_01 | Page 03 | user | UserB |
| Page UserB_02 | Page 04 | user | UserB |
| Page UserB_03 | Page 05 | user | UserB |
| Page UserB_04 | Page 06 | user | UserB |
Scenario: Create users and search for them (Bug 897586)
# Log in as the student user
......@@ -33,7 +35,7 @@ Scenario: Create users and search for them (Bug 897586)
And I log in as "UserB" with password "Kupuh1pa!"
# Verifying log in was successful
And I should see "Bob User"
# Sharing both of the pages Bob created
# Sharing 2 of the pages Bob created to public
And I choose "Shared by me" in "Portfolio" from main menu
And I click on "Edit access" in "Page UserB_01" row
And I set the select2 value "Page UserB_01, Page UserB_02" for "editaccess_views"
......@@ -41,6 +43,15 @@ Scenario: Create users and search for them (Bug 897586)
And I press "Save"
# Verifying that both of the pages have been shared
And I should see "Access rules were updated for 2 pages."
# Sharing 1 of the pages Bob created to admin user
And I choose "Shared by me" in "Portfolio" from main menu
And I click on "Edit access" in "Page UserB_01" row
And I set the select2 value "Page UserB_03" for "editaccess_views"
And I select "Users" from "accesslist[0][searchtype]"
And I select "Admin User" from select2 search box in row number "1"
And I press "Save"
# Verifying that the page has been shared
And I should see "Access rules were updated for 1 page."
And I log out
# Logging back in as admin to search for users on the shared with me page
And I log in as "admin" with password "Kupuh1pa!"
......@@ -50,9 +61,16 @@ Scenario: Create users and search for them (Bug 897586)
| Search: | Angela |
And I check "Public"
And I press "search_submit"
# Verifying I can see Angela's pages
# Verifying I can see an Angela's page
Then I should see "Page UserA_01"
And I should see "Page UserA_02"
# Verifying I cannot see Bob's pages
And I should not see "Page UserB_03"
# Verifying I can see some of Bob's pages
# Entering Bob name in the search box
And I fill in the following:
| Search: | Bob |
And I check "Public"
And I press "search_submit"
And I should see "Page UserB_02"
And I should see "Page UserB_03"
# Verifying I cannot see Bob's page not shared
And I should not see "Page UserB_04"
And I should not see "Page UserA_01"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment