EnesDev

Experience

1,170

0 Best Reply Awards

  • Member Since 4 Weeks Ago
  • 3 Lessons Completed
  • 0 Favorites

17th January, 2018

EnesDev left a reply on Dusk: How To Assert That A Radio Input Is "selected" • 1 day ago

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

Assert the given radio field is selected.

EnesDev left a reply on How To Repeat A Dusk Test ? • 1 day ago

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?

12th January, 2018

EnesDev left a reply on Dropdown Select() Dusk Not Working • 6 days ago

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');

11th January, 2018

EnesDev left a reply on Homestead , Graphical Ubuntu • 1 week ago

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.

EnesDev left a reply on Homestead , Graphical Ubuntu • 1 week ago

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

EnesDev started a new conversation Dropdown Select() Dusk Not Working • 1 week ago

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?

10th January, 2018

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 1 week ago

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

9th January, 2018

EnesDev left a reply on How To Repeat A Dusk Test ? • 1 week ago

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.

EnesDev left a reply on How To Repeat A Dusk Test ? • 1 week ago

@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

EnesDev left a reply on How To Repeat A Dusk Test ? • 1 week ago

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.

EnesDev left a reply on Difference Between Dusk And Docker? • 1 week ago

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.

EnesDev left a reply on How To Repeat A Dusk Test ? • 1 week ago

I want to do this but in one function :

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

EnesDev started a new conversation How To Repeat A Dusk Test ? • 1 week ago

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?

EnesDev started a new conversation Difference Between Dusk And Docker? • 1 week ago

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.

8th January, 2018

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 1 week ago

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.

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 1 week ago

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 ?

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 1 week ago

<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 !

5th January, 2018

EnesDev left a reply on Dusk - Browser Not Popping Up • 1 week ago

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.

4th January, 2018

EnesDev left a reply on Dusk - Browser Not Popping Up • 2 weeks ago

You guys have no idea?

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 2 weeks ago

@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

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 2 weeks ago

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)

3rd January, 2018

EnesDev left a reply on Dusk - Browser Not Popping Up • 2 weeks ago

Anyone?

2nd January, 2018

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 2 weeks ago

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

EnesDev left a reply on This Basic Dusk Test Won't Work ? • 2 weeks ago

When I run the test I have this error :

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

EnesDev started a new conversation This Basic Dusk Test Won't Work ? • 2 weeks ago

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?

EnesDev left a reply on Dusk - Browser Not Popping Up • 2 weeks ago

Yes @shez1983 it was working. Everything was okay.

1st January, 2018

EnesDev left a reply on Dusk - Browser Not Popping Up • 2 weeks ago

anyone?

27th December, 2017

EnesDev left a reply on AssertSee() Doesn't Work Properly • 3 weeks ago

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.

EnesDev started a new conversation Dusk - Browser Not Popping Up • 3 weeks ago

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.

EnesDev left a reply on Dusk - Browser Not Popping Up • 3 weeks ago

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

EnesDev left a reply on Good Bye 2017 And Welcome 2018 To Speedy • 3 weeks ago

We're not there yet mate !

EnesDev left a reply on AssertSee() Doesn't Work Properly • 3 weeks ago

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?

EnesDev started a new conversation AssertSee() Doesn't Work Properly • 3 weeks ago

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.

EnesDev left a reply on How To Test All Forms In My Project • 3 weeks ago

@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

26th December, 2017

EnesDev left a reply on Dusk - Browser Not Popping Up • 3 weeks ago

Where do you remove the --headless option please

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 3 weeks ago

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

EnesDev started a new conversation How To Test All Forms In My Project • 3 weeks ago

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

EnesDev left a reply on Where Are You All From? • 3 weeks ago

Paris, France

23rd December, 2017

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 3 weeks ago

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.

22nd December, 2017

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 3 weeks ago

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

Btw thx @ChristophHarms

EnesDev left a reply on Is Laravel 5.5 Different Of 5.2 • 3 weeks ago

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 !

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 3 weeks ago

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

EnesDev started a new conversation Is Laravel 5.5 Different Of 5.2 • 3 weeks ago

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'); '''

21st December, 2017

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 4 weeks ago

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.

EnesDev left a reply on Testing With PHPUnit, SQLite Errors • 4 weeks ago

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 ?

EnesDev started a new conversation Testing With PHPUnit, SQLite Errors • 4 weeks ago

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

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.