Skip to content

Instantly share code, notes, and snippets.

@BryanHeath
Created September 20, 2017 21:04
Show Gist options
  • Save BryanHeath/d8e287d10315b4b5bae559803d3da6f2 to your computer and use it in GitHub Desktop.
Save BryanHeath/d8e287d10315b4b5bae559803d3da6f2 to your computer and use it in GitHub Desktop.
Laravel Dusk scrollTo Macro Examples
    /** @test */
    public function can_register()
    {
        $this->browse(function (Browser $browser) {
            $browser->maximize();
            
            $fake = [
                'first_name' => $this->faker->firstNameMale,
                'last_name'  => $this->faker->lastName,
                'email'      => $this->faker->email,
                'password'   => $this->faker->password,
            ];

            $browser->visit('/signup')
                ->waitFor('#btn-register')
                ->type('first_name', $fake['first_name'])
                ->type('last_name', $fake['last_name'])
                ->type('email', $fake['email'])
                ->type('email_confirmation', $fake['email'])
                ->type('password', $fake['password'])
                ->type('password_confirmation', $fake['password'])
                ->scrollTo('#btn-register')
                ->press('#btn-register')
                ->assertPathIs('/login');
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment