You are here

public function TraversingTest::testDeepTraversing in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php \Behat\Mink\Tests\Driver\Basic\TraversingTest::testDeepTraversing()

File

vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php, line 109

Class

TraversingTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testDeepTraversing() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/index.html'));
  $traversDivs = $this
    ->getSession()
    ->getPage()
    ->findAll('css', 'div.travers');
  $this
    ->assertCount(1, $traversDivs);
  $subDivs = $traversDivs[0]
    ->findAll('css', 'div.sub');
  $this
    ->assertCount(3, $subDivs);
  $this
    ->assertTrue($subDivs[2]
    ->hasLink('some deep url'));
  $this
    ->assertFalse($subDivs[2]
    ->hasLink('come deep url'));
  $subUrl = $subDivs[2]
    ->findLink('some deep url');
  $this
    ->assertNotNull($subUrl);
  $this
    ->assertRegExp('/some_url$/', $subUrl
    ->getAttribute('href'));
  $this
    ->assertEquals('some deep url', $subUrl
    ->getText());
  $this
    ->assertEquals('some <strong>deep</strong> url', $subUrl
    ->getHtml());
  $this
    ->assertTrue($subUrl
    ->has('css', 'strong'));
  $this
    ->assertFalse($subUrl
    ->has('css', 'em'));
  $this
    ->assertEquals('deep', $subUrl
    ->find('css', 'strong')
    ->getText());
}