How to repeat a dusk test ?

Posted 11 months ago by LittlePadawan

Hello everyone,

I would like to know how to repeat a task to get all the combinasions.

<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class LoginTest extends DuskTestCase
{
    /**
     * @throws \Exception
     * @throws \Throwable
     */
    public function testConnection()
    {
        $this->browse(function (Browser $browser) {

            $browser
                    ->visit('/the-slug')
                    ->type('#email', '[email protected]')
                    ->type('#password', 'aaaaaa')
                    ->press('Connexion')
                    ;
        } );
    }
}

I don't want to create 4 different cases to tests everything. Is it possible to do it in one function and how?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.