Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joeri Timmermans:
Testing drag and drop with Behat and Guzzle
Feb 26, 2016 @ 18:28:58

Joeri Timmermans has posted a tutorial to his site showing how you can test drag-and-drop functionality with a combination of the Behat BDD testing tool and the Guzzle HTTP library.

As you could see in previous posts I'm working on a large application for Intracto where they want a lot of fancy visuals and this turned into a mess when it came to write behat tests. This post will help you test position moving with drag and drop.

In his case he was working with a chapter layout that allows for the rearranging of chapters to update their order. The process is then broken up into a few different steps:

  • Creating a new context feature for Behat (based on this example)
  • Making a custom action that makes it easier to move the chapter entries around by just providing positions
  • Calling the move in the Behat test itself

The tricky part here is that the actual test is made for the behavior but the behavior itself is making an API call to rearrange the pages. The test is making this same call and evaluating the result. It's not actually interacting with the page as you might be able to do with something like PhantomJs however.

tagged: testing draganddrop functionality guzzle behat api position chapter tutorial

Link: http://www.pix-art.be/post/testing-drag-and-drop-with-behat-and-guzzle


Trending Topics: