namespace ; use Symfony\Component\Panther\PantherTestCase; use Prometeo\CommandsBundle\TestTraits\PantherTrait; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Cookie; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; class extends { use PantherTrait; private $client = null; public function setUp() :void { // Boot the AppKernel in the test environment and with the debug. self::bootKernel(); $this->client = static::createPantherClient(); $this->client = static::createClient(); } public function testLogin() { $crawler = $this->client->request('GET', '/admin'); $this->client->takeScreenshot('screenshoots/app_login.png'); $this->assertFileExists('screenshoots/app_login.png'); $form = $crawler->selectButton('Iniciar sesión')->form(); $form['_username'] = ''; $form['_password'] = ''; $crawler = $this->client->submit($form); // $link = $crawler->filter('a:contains("Déconnexion")')->link(); // $crawler = $client->click($link); // $this->assertSame('http://127.0.0.1:9080/es/admin/login', $this->client->getCurrentURL()); $this->client->takeScreenshot('screenshoots/app_dashboard.png'); $this->assertFileExists('screenshoots/app_dashboard.png'); } $route){ $method=''; if(strpos($route, strtolower('list'))!==false){ $method='configureListFields'; }elseif(strpos($route, strtolower('create'))!==false ||strpos($route, strtolower('edit'))!==false){ $method='configureFormFields'; }elseif(strpos($route, strtolower('show'))!==false){ $method='configureShowFields'; }elseif(strpos($route, strtolower('batch'))!==false){ $method='configureBatchActions'; }elseif(strpos($route, strtolower('delete'))!==false){ $method='delete'; }elseif(strpos($route, strtolower('export'))!==false){ $method='configureExportFields'; } ?> /** * @covers App\Admin\:: * @depends testLogin */ public function test() { $crawler = $this->client->request('GET', ''); //$this->assertResponseIsSuccessful(); $this->assertEquals(200, $client->getInternalResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->client->takeScreenshot('screenshoots/.png'); $this->assertFileExists('screenshoots/.png'); } }