Support the ongoing development of Laravel.io →
posted 4 years ago
Testing Dusk
Last updated 1 year ago.
0

you will have to share some code for us to understand what is going on

0

Hi, thanks for your answer. Here's the test:

$this->browse(function (Browser $browser) {
            $browser->visit('/')
                ->assertSee('Login')
                ->assertSee('Remember Me');

            $browser->loginAs(8)
                ->visit('/')
                ->assertSee('Dashboard')
                ->assertDontSee('Crea')
                ->click('#depositsmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#productionmenu')
                ->assertSee('10 giorni')
                ->assertSee('Batterie')
                ->assertSee('Visualizza')
                ->assertSee('Crea')
                ->click('#assistancesmenu')
                ->assertSee('Accetta')
                ->click('#ordersmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->assertSee('Visualizza preordini')
                ->click('#shipmentsmenu')
                ->assertSee('Visualizza')
                ->assertSee('Cerca scheda')
                ->assertSee('Cerca smartcard')
                ->assertSee('DDT')
                ->assertSee('Temporanea')
                ->click('#ddt')
                ->assertSee('Crea vuoto')
                ->click('#temporary')
                ->assertSee('Crea')
                ->click('#smartcardsmenu')
                ->assertSee('Trova')
                ->assertSee('Report sostituite')
                ->assertSee('Registrazione senza chiavi')
                ->assertSee('Registrazione con chiavi')
                ->assertSee('Associazione da file')
                ->assertSee('Annulla associazione')
                ->assertSee('Rimanda e-mail')
                ->click('#customersmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->assertSee('Importa')
                ->click('#productsmenu')
                ->assertSee('Inserisci')
                ->assertSee('Visualizza')
                ->click('#invoicesmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#meritocracymenu')
                ->assertSee('Assistenze')
                ->assertSee('Visualizza')
                ->click('#interventionsmenu')
                ->assertSee('Inserisci')
                ->assertSee('Visualizza')
                ->click('#paymenttypesmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#paymentwaysmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#usersmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#permissionsmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#softwaremenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#manufacturersmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#lottypesmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#producttypesmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
                ->click('#settingsmenu')
                ->assertSee('Crea')
                ->assertSee('Visualizza')
            ;
        });

test says:

Did not see expected text [Accetta] within element [body]. Failed asserting that false is true.

but the screenshot:

https://ibb.co/mSCMDM6

as you can see the string "Accetta" is there. Thanks a lot

0
  1. is account 8 your user account ? if not could you login as user 8 and see if they see the same thing
  2. is the id of the menu item correct ( your test expects to click on #assistancesmenu does it exist)

I would maybe add a test to see that each of the top level menu items exists before drilling down into the sub menus

0

actually that is my id, and #assistancesmenu does exists. Point is if I remove the assertions after that one, it work. Then I add one by one, and looks like when they become too many, it fails - that's why I speak of performances problem.

Thanks a lot

0

Hey,

I am not sure if your front-end is using javascript, but what I can recommend to try is use waitForText instead of assertSee.

assertSee does an immediate check after the previous one. waitForText gives the page a few seconds for the text to become visible.

0

Hi Rob,

thanks a lot for the suggestion! actually with waitForText it works!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

andrea giorg Joined 13 Sep 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.