Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
Laravel functional testing ajax control

In laravel 5.4, I can see that there are methods such as:

$browser->pause(1000);
$browser->waitFor('.selector');
$browser->waitForLink('Create');

But I don't see these in Laravel 5.3.

We have two chained select boxes where second select box values are loaded through ajax based on selection from first select box. The problem is that when we run test, laravel doesn't wait for second selectbox/ajax to load which makes the test fail because it could not select any value from second select box.

$this->visit('/department');
$this->select('1', 'country_id');
$this->select('1', 'region_id'); // problem here
// rest of code

I also tried using sleep() but it didn't work.

Any idea of how to functional test such scenario in 5.3 please ? Thanks

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

By default, laravel 5.3 doesn't support this function. As they have introduced Ajax Testing in laravel 5.4 using Dusk.

Check this post : https://laravel-news.com/laravel-dusk-is-coming

However, We are in luck.

Looking at the composer.json of dusk. You can use it in laravel 5.3 as its dependency is "illuminate/support" : "~5.3" which is satisfied by the Laravel 5.3.

All you need to do is : composer require laravel/dusk

Check the composer.json here : https://github.com/laravel/dusk/blob/master/composer.json

Edit:

There was an issue with the dependency. I created a new package which resolved the dependency issue. I have run all the test cases. It didn't give me any error.

You can use this package using following command : composer require pankitgami/dusk

Check here : https://packagist.org/packages/pankitgami/dusk

about 4 years ago · Santiago Trujillo Relatório

0

seeJsonEquals used for Verify Exact JSON Match

    $this->post('/user', ['name' => 'Sally'])
         ->seeJsonEquals([
             'created' => true,
         ]);
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda