LittlePadawan

LittlePadawan

Member Since 1 Year Ago

Paris

Experience Points 2,040
Experience
Level
Lessons Completed 11
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

23 Jan
1 year ago

LittlePadawan left a reply on Keys() Doesn't Select An Adress In A Dropdown

I'm getting other issues but I will create new questions in the discussions for them. We can say that this one is solved.

LittlePadawan left a reply on Keys() Doesn't Select An Adress In A Dropdown

That's what I initially did : ->pause("5000)" and ->waitForText("xxxxxx") but it doesn't seem to work.

I decided to access it through a ->select() so that's okay.

22 Jan
1 year ago

LittlePadawan started a new conversation Keys() Doesn't Select An Adress In A Dropdown

Hello,

I use Laravel 5.5 Dusk and I try to select a suggested Google address but it doesn't work:

->type('User[geoloc_personnal_address]','11 Rue de Rivoli Paris')
->keys('User[geoloc_personnal_address]', '{arrow_down}')
->keys('User[geoloc_personnal_address]', '{enter}')

Do you know where is the problem coming from?

17 Jan
1 year ago

LittlePadawan left a reply on Dusk: How To Assert That A Radio Input Is "selected"

$browser->assertRadioSelected($field, $value)

Assert the given radio field is selected.

LittlePadawan left a reply on How To Repeat A Dusk Test ?

I don't know why this doesn't work :

<?php

namespace Tests\Browser;

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

class LoginTestOptimized extends DuskTestCase
{
    public function testConnectionOptimized()
    {
        $this->browse( /**
         * @param Browser $browser
         */
            function (Browser $browser)
        {
            //tableau dans un tableau : [[x],[y],[x,y,z]]
            //field => value
            $array = [
                ['#email' => '' ],
                ['#password' => '' ],
                [
                    '#email'    => '[email protected]', 
                    '#password' => 'jeanjean', 
                    '__clear__' => false
                ],
            ];

            $browser->visit('/se-connecter');

            foreach ($array as $line)
            {
                foreach ($line as $field => $value) {
                    $browser->type($field, $value);
                }

                $browser->press('Connexion')
                        ->clear($field, $value);
            }
        });
    }
}

Any idea guys?

12 Jan
1 year ago

LittlePadawan left a reply on Dropdown Select() Dusk Not Working

I found an alternative solution. I decided to remove a particular attribute which was search dropdown-after and ui search-dropdown. Now I can access the User[type] with :

$browse -> select('user[type]','Type_1');

11 Jan
1 year ago

LittlePadawan left a reply on Homestead , Graphical Ubuntu

So you want to run Ubuntu on VM and you want to access your project from Windows in Ubuntu?

I'm sorry but I don't really understand your request.

LittlePadawan left a reply on Homestead , Graphical Ubuntu

When you run Homestead with Vagrant you just need to access your project from the Web browser. Did you do this?

LittlePadawan started a new conversation Dropdown Select() Dusk Not Working

Hello everyone,

I want to select an option in a dropdown menu but it doesn't select it. I've also checked the doc.

                    ->select('User[type]','Remplaçant')

When I run `php artisan dusk ===> test OK' but as I can see on the screenshot the option is not selected.

Do you have any idea?

10 Jan
1 year ago

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

Well, I'm using Docker to do the tests. As it's not working on local, using Docker lets me do the tests.

09 Jan
1 year ago

LittlePadawan left a reply on How To Repeat A Dusk Test ?

Okay !!! I was only testing if the connection was established or not. That's what I wanted to know.

I was thinking about creating an array in which I can insert all the fields and with a for loop I can access to each one of them. I'm going to try this and keep you in touch.

LittlePadawan left a reply on How To Repeat A Dusk Test ?

@MikeHopley Okay I get it now why we need several browsers, thank you.

Here is what I did according what you said :

<?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 testConnexionUser()
    {
    
        $this->browse(function (Browser $browser) {

            $browser
                    /**********************
                     * TEST ON LOGIN PAGE *
                     * ********************
                     */
                    ->visit('/se-connecter')

                    //make sure to see everything
                    ->assertSee('Connectez-vous')
                    ->assertSee('Email')
                    ->assertSee('Mot de passe')
                    ->assertSee('Mot de passe oublié')
                    ->assertSee('Connexion')

                    //1ST CASE : no inputs
                    ->press('Connexion')

                    //2ND CASE : only email
                    ->type('#email','[email protected]')
                    ->press('Connexion')
                    ->clear('#email')

                    //3RD CASE : only password
                    ->type('#password','jeanjean')
                    ->press('Connexion')
                    ->clear('#password')

                    //4TH CASE : all inputs
                    ->type('#email','[email protected]')
                    ->type('#password','jeanjean')
                    ->press('Connexion')
                    ;
        } );
    }
}

It works. This is a simple form. I have a bigger form with many fields. Isn't there a way to automate it because I don't want to repeat every cases manually

LittlePadawan left a reply on How To Repeat A Dusk Test ?

I can create many browsers but I will have to make all cases myself:

<?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 testConnexionUser()
    {
        $this->browse(function ($first, $second) {
            $first
                    ->visit('/se-connecter')
                    ->press('Connexion');

            $second
                    ->visit('/se-connecter')
                    ->type('#email', '[email protected]')
                    ->press('Connexion');
                });
    }
}

With this method I still have to create all four cases. I don't know if it makes sense.

LittlePadawan left a reply on Difference Between Dusk And Docker?

Okay I see what it is now. I was confusing them because I wanted to do local test with laravel dusk and it wasn't working. Now that I'm using Docker, I can do test locally.

LittlePadawan left a reply on How To Repeat A Dusk Test ?

I want to do this but in one function :

  • nothing => error
  • only email => error
  • only password => error
  • email + password => accepted

LittlePadawan started a new conversation How To Repeat A Dusk Test ?

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?

LittlePadawan started a new conversation Difference Between Dusk And Docker?

Hello everyone,

I would like to know the difference between Dusk and Docker. It seems to be the same but I don't get the difference.

08 Jan
1 year ago

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

That's what I was thinking too. I have to see everything on the page and this is not happening. As you said, I'm going to try it on a the laravel default project.

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

Okay I'm going to do this then. I have no choice.

Just to mention one last thing. When I use assertSee() it doesn't recognize all the text on the given page. Is this normal?

For example, it doesn't see the navbar. Is this normal ?

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

<div class="submit-button-container">
    <button class="button" id="login-button">Connexion</button>
</div>
->click("#login-button")

And it's still throwing the same error : no such element: Unable to locate element: {"method":"id","selector":"login-button"}

I'm really really stuck… It's been 5 days now !

If you have any idea guys, tell me !

05 Jan
1 year ago

LittlePadawan left a reply on Dusk - Browser Not Popping Up

I'd like to see how the browser working but you're right that's not necessarily mandatory. It takes also a screenshot but I'd like to see the error in live but the chrome browser doesn't even open.

Well, that is not important. Thanks for the advice.

04 Jan
1 year ago

LittlePadawan left a reply on Dusk - Browser Not Popping Up

You guys have no idea?

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

@number6 But I still have the same error

`

  1. Tests\Browser\LoginTest::testExample Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body [dusk="login-button"]"}

`

I really don't know where it comes from

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

I changed according the docs and what you said.

LoginTest.php

<?php

namespace Tests\Browser;

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

class LoginTest extends DuskTestCase
{
    public function testExample()
    {
        $this->browse(
            function (Browser $browser) {
                $browser->visit('/se-connecter')
                        ->click('@login-button');
                    }
                );
    }
}

My login page :

<div class="submit-button-container">
    <button class="button" dusk="@login-button">Connexion</button>
</div>

I still have the same error, I don't know why but it doesn't find the @login-button.

1) Tests\Browser\LoginTest::testExample
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body [dusk="login-button"]"}
  (Session info: headless chrome=62.0.3202.94)
  (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.4.0-101-generic x86_64)

03 Jan
1 year ago
02 Jan
1 year ago

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

Thank you @MikeHopley but now I'd like to press the Connexion button.

1) Tests\Browser\LoginTest::testExample
InvalidArgumentException: Unable to locate button [Connexion].

I noticed this Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body Connexion"}

  • Do I have to insert the CSS code?
  • What is Facebook doing in here? I'm confused

LittlePadawan left a reply on This Basic Dusk Test Won't Work ?

When I run the test I have this error :

1) Tests\Browser\LoginTest::testExample
Error: Call to a member function update() on null

LittlePadawan started a new conversation This Basic Dusk Test Won't Work ?

Hello everybody,

I don't know why this basic dusk test doesn't work.

<?php

namespace Tests\Browser;

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

class LoginTest extends DuskTestCase
{
    use DatabaseMigrations;

    public function testExample()
    {
        $this->browse(function(Browser $browser) {
            $browser->visit('/se-connecter')
                    ->asserSee('Connexion');
        });
    }
}

Any idea?

LittlePadawan left a reply on Dusk - Browser Not Popping Up

Yes @shez1983 it was working. Everything was okay.

01 Jan
1 year ago
27 Dec
1 year ago

LittlePadawan left a reply on AssertSee() Doesn't Work Properly

Thank you so much I get it now ! If you can help me out with the other issues that I have would you please check it out. You can see it on the Discussions.

LittlePadawan started a new conversation Dusk - Browser Not Popping Up

Hello everyone,

I tried to have an answer on the other topic but the topic is already solved for another problem. So I decided to open another one.

When I run php artisan dusk there is no window popping up. I commented the --headelessoption in DuskTestCase.php.

I don't know what else to do more to make it pop up.

LittlePadawan left a reply on Dusk - Browser Not Popping Up

@Jeroen Thank you I found it but no window is popping up. Do you know what can be the issue?

LittlePadawan left a reply on Good Bye 2017 And Welcome 2018 To Speedy

We're not there yet mate !

LittlePadawan left a reply on AssertSee() Doesn't Work Properly

I'm so dumb!!! I wrote assertSee(Laracasts) instead of assertSee(LARACASTS). It works well now.

@bobbybouwmann I don't think that I need to change it in resources\views\welcome.blade.php because I want to see what's on the page and that's what the assert been made for, right?

LittlePadawan started a new conversation AssertSee() Doesn't Work Properly

Hello to everyone,

First of all, I followed the Laracast video but the first test fails dramatically.

As shown in the video, I updated the .env file.

  • PHPStorm asks me to Update the PHPDoc Comment But when I do it, the yellow part disappear (cf. **BEFORE : ** https://imgur.com/a/0F9Ho , **AFTER : ** https://imgur.com/a/BocPi)

  • There is a USE that is not used which is weird because I didn't touch anything. The guy on the video didn't have this error. (cf. Third USE on the screenshot just above).

  • When I run the ->assertSee('Laravel'); it WORKS

<?php

namespace Tests\Browser;

use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;  //THIS IS NOT USED !!!

class ExampleTest extends DuskTestCase
{
    /**
     * A Dusk test example.
     *
     * @return void
     * @throws \Exception
     * @throws \Throwable
     */
    public function testExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->assertSee('Laravel');
        });
    }
}

This returns TRUE

————————————————————————————————————————

  • When I change the assertSee() to Laracasts as shown on the video, it doesn't work !
<?php

namespace Tests\Browser;

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

class ExampleTest extends DuskTestCase
{
    /**
     * A Dusk test example.
     *
     * @return void
     * @throws \Exception
     * @throws \Throwable
     */
    public function testExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->assertSee('Laracasts');
        });
    }
}

This returns :

There was 1 failure:

  1. Tests\Browser\ExampleTest::testExample Did not see expected text [Laracasts] within element [body]. Failed asserting that false is true.

/home/vagrant/code/homestead.test/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:321 /home/vagrant/code/homestead.test/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:292 /home/vagrant/code/homestead.test/tests/Browser/ExampleTest.php:22 /home/vagrant/code/homestead.test/vendor/laravel/dusk/src/TestCase.php:92 /home/vagrant/code/homestead.test/tests/Browser/ExampleTest.php:23

FAILURES! Tests: 1, Assertions: 1, Failures: 1.

Would you please help me because I'm pretty sure this is something stupid that is happening.

LittlePadawan left a reply on How To Test All Forms In My Project

@xmarks But with this method I have to do all manually, right?

@36864 You're totally right, that's why I want to know if it's possible to create a global function that test all the possibilities

26 Dec
1 year ago

LittlePadawan left a reply on Dusk - Browser Not Popping Up

Where do you remove the --headless option please

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

Hello @ejdelmonico , I'm going to keep your comment in mind. I decided to go on Dusk to make my tests.

LittlePadawan started a new conversation How To Test All Forms In My Project

Hello everyone and merry Christmas,

I'd like to know if it's possible to test all forms. I'd like to test the registration page. I want to know if the registration form doesn't create any error. For example, if I only enter the name (nom) it has to give an error as the others are empty.

#####Can I test all the possibilities in one function ?

Name => ERROR Name + mail => ERROR Name + mail + Password => ERROR Name + mail + Password + Password Confirmation => ACCEPTED

I know I have to use Laravel Dusk but is it possible to do it the way I want ?

Preview of my registration page : https://imgur.com/a/JsuMb

LittlePadawan left a reply on Where Are You All From?

Paris, France

23 Dec
1 year ago

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

Thx @Nash it did work but I'm lost now in the code. I'm going to start it all over to do it properly.

22 Dec
1 year ago

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

I'm going to test in Dusk. This method doesn't seem good enough for what I need.

Btw thx @ChristophHarms

LittlePadawan left a reply on Is Laravel 5.5 Different Of 5.2

I've already read the first link but I wasn't really sure about as I'm totally new to Laravel.

I'm going to start reading all that. Thank you so much !

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

Here it is:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('slug')->unique();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('models_categories');
    }

    public function images()
    {
        return $this->hasMany(Image::class);
    }
}


Link to see on PHPStorm : https://imgur.com/a/QQulB

LittlePadawan started a new conversation Is Laravel 5.5 Different Of 5.2

Hey guys,

I'm using Laravel 5.5 and I need to run some tests. Are the tests from Laravel 5.2 available on 5.5?

For example are those available:

''' $this->visit('/') ->click('About Us') ->seePageIs('/about-us'); '''

21 Dec
1 year ago

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

The databases : https://imgur.com/a/7TSnF

.env file : https://imgur.com/a/OVg7L

phpunit.xml : https://imgur.com/a/6KmPn

config.database.php : https://imgur.com/a/t23ke

CategoryTest.php : https://imgur.com/a/KWoMU

Everything seems okay.

I still get the same error : https://imgur.com/a/PiXDY https://imgur.com/a/Flgf8

I try to do my best to understand the issues but I don't get it.

LittlePadawan left a reply on Testing With PHPUnit, SQLite Errors

Apparently I have to test with SQLite.

I have this error when I run the test: '''

  1. Tests\Feature\CategoryTest::testAddCategory Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: categories (SQL: select * from "categories")

'''

How come the table does exist for MySQL but disappear for SQLite ?

LittlePadawan started a new conversation Testing With PHPUnit, SQLite Errors

Hello guys,

I'm trying to test a little project based on a tutorial.

I'm having issues about the connection to the database.

I added the needed lines but I don't know how to connect the "app" to the "new" SQLite database. So, I stay on the MySQL. I'm going to run tests on my real database. The "app" is connected to a MySQL database where all data are stored.

(I'm new to Laravel and to this website and there is no button to upload screenshots)

HERE IS THE ERROR :

  1. Tests\Feature\CategoryTest::testAddCategory TypeError: Argument 1 passed to Illuminate\Foundation\Testing\TestCase::actingAs() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given, called in /home/vagrant/code/homestead.test/tests/TestCase.php on line 25

/home/vagrant/code/homestead.test/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php:16 /home/vagrant/code/homestead.test/tests/TestCase.php:25 /home/vagrant/code/homestead.test/tests/Feature/CategoryTest.php:18

IF I USE SQLITE, I've this error: .....no such table