Skip to content

Instantly share code, notes, and snippets.

@alexandre-daubois
Created December 2, 2021 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandre-daubois/734abe40c73a1342293b7dee71a7f5ea to your computer and use it in GitHub Desktop.
Save alexandre-daubois/734abe40c73a1342293b7dee71a7f5ea to your computer and use it in GitHub Desktop.
<?php
namespace App\Tests;
use Symfony\Component\Panther\PantherTestCase;
/**
* @see https://github.com/symfony/panther#a-polymorphic-feline
*/
class E2eTest extends PantherTestCase
{
public function testMyApp(): void
{
$client = static::createPantherClient(); // Or static::createPantherClient(['browser' => static::FIREFOX]) for example
$client->request('GET', '/mypage');
$this->assertPageTitleContains('My Title');
$this->assertSelectorTextContains('#main', 'My body');
$this->assertSelectorIsEnabled('.search');
$this->assertSelectorIsDisabled('[type="submit"]');
// ...
$client->waitForStaleness('.popin');
$client->waitForVisibility('.loader');
$client->waitForElementToContain('.total', '25 €');
// ...
$this->assertSelectorWillExist('.popin');
$this->assertSelectorWillNotExist('.popin');
$this->assertSelectorWillBeVisible('.loader');
$this->assertSelectorWillNotBeVisible('.loader');
$this->assertSelectorWillContain('.total', '€25');
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment