thx for helping me on this :)
Im developping a serie of test on a symfony app with Symfony/Panther. Im looking for a way to test if my logo redirect to the correct page. The way I see it, is I have to test the link and then click on it to test the redirection. The panther documentation is quiet specific about link testing see here:
I also saw how to find an image via DomCrawler np with that...
SO what I have tried, is to adapt the link testing method to an image, of course it didnt work cause the image is not a string as expected by the method
So if someone have an idea how to test the redirection on a image link It ll be awesome. Thx in advance
<?php
namespace App\Tests;
use Symfony\Component\Panther\PantherTestCase;
class assertLogoRedirectTo extends PantherTestCase
{
public function test()
{
$client = static::createPantherClient();
$crawler = $client->request('GET','https://my.sibluconnect.com');
$client->waitFor('.login');
$image = $crawler->selectImage('siblu')->image();
$link = $crawler->selectLink($image)->link();
$crawler = $client->click($link);
}
}
Running the test shows this error:
DevTools listening on ws://127.0.0.1:12947/devtools/browser/d3a0e57f-2b00-4eb3-97e3-64986cf0495e E 1 / 1 (100%)/test1//test2//test3//test4/
Time: 11.17 seconds, Memory: 38.00MB
There was 1 error:
- App\Tests\assertLogoIsvisible::test Object of class Symfony\Component\Panther\DomCrawler\Image could not be converted to string