PHP code example of amoifr / pickle-panther-bundle
1. Go to this page and download the library: Download amoifr/pickle-panther-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amoifr / pickle-panther-bundle example snippets
final class HomepageTest extends BasePantherTest
{
public function testHomepage(): void
{
$this->createScenarioRunner()->runTest(__DIR__.'/Scenario/homepage.yaml');
}
}
use Amoifr\PicklePantherBundle\Attribute\Sentence;
use Amoifr\PicklePantherBundle\Sentence\AbstractSentenceProvider;
final class CheckoutSentences extends AbstractSentenceProvider
{
#[Sentence('Ajoute le produit [sku] au panier', 'fr')]
#[Sentence('Add product [sku] to the cart', 'en')]
public function addToCart(string $sku): void
{
$this->client()->clickLink(/* ... */);
$this->testCase()->assertSelectorExists('.cart-item');
}
}
yaml
# tests/E2E/Scenario/homepage.yaml
scenarios:
- nom: "La page d'accueil se charge"
contexte:
navigateur: desktop # desktop | mobile
etapes:
- action: "Visite la page avec l'[/]" # value written inline in the brackets
- action: "Vérifie que le texte [text] est présent dans le sélecteur [selector]"
args: { text: "Bienvenue", selector: "h1" } # or listed explicitly under args