Skip to content

Instantly share code, notes, and snippets.

@alexandre-daubois
Created Dec 2, 2021
Embed
What would you like to do?
<?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