public void DragAndDropOnJQueryItems()
{
driver.Url = droppableItems;
IWebElement toDrag = driver.FindElement(By.Id("draggable"));
IWebElement dropInto = driver.FindElement(By.Id("droppable"));
// Wait until all event handlers are installed.
System.Threading.Thread.Sleep(500);
Actions actionProvider = new Actions(driver);
actionProvider.DragAndDrop(toDrag, dropInto).Perform();
string text = dropInto.FindElement(By.TagName("p")).Text;
DateTime endTime = DateTime.Now.Add(TimeSpan.FromSeconds(15));
while (text != "Dropped!" && (DateTime.Now < endTime))
{
System.Threading.Thread.Sleep(200);
text = dropInto.FindElement(By.TagName("p")).Text;
}
Assert.AreEqual("Dropped!", text);
IWebElement reporter = driver.FindElement(By.Id("drop_reports"));
// Assert that only one mouse click took place and the mouse was moved
// during it.
string reporterText = reporter.Text;
Assert.IsTrue(Regex.IsMatch(reporterText, "start( move)* down( move)+ up"));
Assert.AreEqual(1, Regex.Matches(reporterText, "down").Count, "Reporter text:" + reporterText);
Assert.AreEqual(1, Regex.Matches(reporterText, "up").Count, "Reporter text:" + reporterText);
Assert.IsTrue(reporterText.Contains("move"), "Reporter text:" + reporterText);
}