Commit 7ee23d03 authored by Robert Lyon's avatar Robert Lyon

Add tests to wait for css things to exist

1) On expanding node wait for the 'show' class
2) On delete resource item

Because the content is invisible until that class appears

Change-Id: Ic1ee235927d582c7195af2220511eb69f2cdae32
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 0a05b027
...@@ -1524,6 +1524,7 @@ EOF; ...@@ -1524,6 +1524,7 @@ EOF;
* *
*/ */
public function i_delete_link_resource_menu_item($item) { public function i_delete_link_resource_menu_item($item) {
$this->getSession()->wait(2000, '(jQuery("div#menuitemlist tr:contains(\'' . $item . '\') button:contains(\'Delete\')")[0].length > 0)');
$this->getSession()->executeScript('jQuery("div#menuitemlist tr:contains(\'' . $item . '\') button:contains(\'Delete\')")[0].click();'); $this->getSession()->executeScript('jQuery("div#menuitemlist tr:contains(\'' . $item . '\') button:contains(\'Delete\')")[0].click();');
usleep(10000); usleep(10000);
$this->i_accept_confirm_popup(); $this->i_accept_confirm_popup();
......
...@@ -192,8 +192,11 @@ class BehatNavigation extends BehatBase { ...@@ -192,8 +192,11 @@ class BehatNavigation extends BehatBase {
// We just want to expand the parent node as this doesn't align top left to the outer-link a link. // We just want to expand the parent node as this doesn't align top left to the outer-link a link.
$node = $node->getParent(); $node = $node->getParent();
} }
$node->click(); $node->click();
if ($node->getParent()->hasAttribute('id')) {
$id = $node->getParent()->getAttribute('id');
$this->getSession()->wait(2000, "($('#" . $id . "_target.show').length > 0)");
}
} }
/** /**
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="card-body"> <div class="card-body">
<p class="lead">{str tag=linksandresourcesmenupagedescription section=admin args=$descriptionstrargs}</p> <p class="lead">{str tag=linksandresourcesmenupagedescription section=admin args=$descriptionstrargs}</p>
<div class="dropdown form-group"> <div class="dropdown form-group">
<label for="menuselect">{str tag=edit}:</label> <label for="menuselect">{str tag=edit}</label>
<span class="picker"> <span class="picker">
<select class="form-control select" id="menuselect" name="menuselect"> <select class="form-control select" id="menuselect" name="menuselect">
{foreach from=$MENUS item=menu} {foreach from=$MENUS item=menu}
......
...@@ -9,7 +9,7 @@ Scenario: Creating and deleting external links (Selenium 1426983) ...@@ -9,7 +9,7 @@ Scenario: Creating and deleting external links (Selenium 1426983)
Given I log in as "admin" with password "Kupuh1pa!" Given I log in as "admin" with password "Kupuh1pa!"
# Entering an external link # Entering an external link
And I choose "Menus" in "Configure site" from administration menu And I choose "Menus" in "Configure site" from administration menu
And I select "Logged-in links and resources" from "Edit:" And I select "Logged-in links and resources" from "Edit"
And I fill in "namenew" with "Test Menu Link" And I fill in "namenew" with "Test Menu Link"
And I fill in "linkedtonew" with "https://mahara.org/" And I fill in "linkedtonew" with "https://mahara.org/"
And I press "Add" And I press "Add"
...@@ -20,7 +20,7 @@ Scenario: Creating and deleting external links (Selenium 1426983) ...@@ -20,7 +20,7 @@ Scenario: Creating and deleting external links (Selenium 1426983)
And I choose "Dashboard" from main menu And I choose "Dashboard" from main menu
Then I should see "Test Menu Link" Then I should see "Test Menu Link"
And I choose "Menus" in "Configure site" from administration menu And I choose "Menus" in "Configure site" from administration menu
And I select "Logged-in links and resources" from "Edit:" And I select "Logged-in links and resources" from "Edit"
And I delete the link and resource menu item "Test Menu Link" And I delete the link and resource menu item "Test Menu Link"
And I should see "Item deleted" And I should see "Item deleted"
And I press "Save changes" And I press "Save changes"
...@@ -38,7 +38,7 @@ Scenario: Make sure blogs do not show in site file link options (Bug #1537426) ...@@ -38,7 +38,7 @@ Scenario: Make sure blogs do not show in site file link options (Bug #1537426)
And I attach the file "Image1.jpg" to "File" And I attach the file "Image1.jpg" to "File"
# Entering an external link # Entering an external link
And I choose "Menus" in "Configure site" from administration menu And I choose "Menus" in "Configure site" from administration menu
And I select "Logged-in links and resources" from "Edit:" And I select "Logged-in links and resources" from "Edit"
And I set the following fields to these values: And I set the following fields to these values:
| Site file | 1 | | Site file | 1 |
And the "linkedtonew" select box should not contain "Site blog" And the "linkedtonew" select box should not contain "Site blog"
......
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