Hi,
I'm using FluentLenium to test my Play web app but I've ran into difficulty when testing a click on a Bootstrap 3 dropdown. The relevant snippet from my view code is:
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">App Name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">@Messages.get("project.projects") <b class="caret"></b></a>
<ul class="dropdown-menu">
@projects.map { project =>
}
<li class="divider"></li>
<li id="create-project-menu-item"><a href="#">@Messages.get("project.createproject")</a></li>
</ul>
</li>
</ul>
When I press the button with class .navbar-toggle, I can see in the Elements tab of Chrome that the <li> element with class "dropdown" changes to "dropdown open". In my test code, after I execute a FluentWebElement click() on the button, the class of the <li> element never changes to "dropdown open". My code for clicking the button is:
public void clickProjectsDropdown()
{
FluentWebElement dropdown = element.findFirst("button[class=navbar-toggle]");
dropdown.click();
}
In my test case I have put in await calls after calling the clickProjectsDropdown method and then tested using:
assertThat(browser.pageSource()).contains("dropdown open");
but the assert fails.
Has anyone experienced a similar issue?