mailer-test icon indicating copy to clipboard operation
mailer-test copied to clipboard

Test email html crawler and assertions

Open kbond opened this issue 4 years ago • 0 comments

Would be nice to access the crawler and make assertions on the html:

$email->html()->crawler(); // Symfony\Component\DomCrawler\Crawler

$email->html() // same assertion API as zenstruck/browser
    ->assertSee('some text')
    ->assertNotSee('some text')
    ->assertSeeIn('h1', 'some text')
    ->assertNotSeeIn('h1', 'some text')
    ->assertSeeElement('h1')
    ->assertNotSeeElement('h1')
    ->assertElementCount('ul li', 2)
    ->assertElementAttributeContains('head meta[name=description]', 'content', 'my description')
    ->assertElementAttributeNotContains('head meta[name=description]', 'content', 'my description')
;

kbond avatar Jan 18 '21 16:01 kbond