JavascriptTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Behat\Mink\Tests\Driver\Js;
  3. use Behat\Mink\Tests\Driver\TestCase;
  4. class JavascriptTest extends TestCase
  5. {
  6. public function testAriaRoles()
  7. {
  8. $this->getSession()->visit($this->pathTo('/aria_roles.html'));
  9. $this->getSession()->wait(5000, '$("#hidden-element").is(":visible") === false');
  10. $this->getSession()->getPage()->pressButton('Toggle');
  11. $this->getSession()->wait(5000, '$("#hidden-element").is(":visible") === true');
  12. $this->getSession()->getPage()->clickLink('Go to Index');
  13. $this->assertEquals($this->pathTo('/index.html'), $this->getSession()->getCurrentUrl());
  14. }
  15. public function testDragDrop()
  16. {
  17. $this->getSession()->visit($this->pathTo('/js_test.html'));
  18. $webAssert = $this->getAssertSession();
  19. $draggable = $webAssert->elementExists('css', '#draggable');
  20. $droppable = $webAssert->elementExists('css', '#droppable');
  21. $draggable->dragTo($droppable);
  22. $this->assertEquals('Dropped!', $this->getAssertSession()->elementExists('css', 'p', $droppable)->getText());
  23. }
  24. // test accentuated char in button
  25. public function testIssue225()
  26. {
  27. $this->getSession()->visit($this->pathTo('/issue225.html'));
  28. $this->getSession()->getPage()->pressButton('Créer un compte');
  29. $this->getSession()->wait(5000, '$("#panel").text() != ""');
  30. $this->assertContains('OH AIH!', $this->getSession()->getPage()->getText());
  31. }
  32. }