vendredi 2 juin 2017

Laravel testing Failed asserting that two strings are equal

I am very new to testing, but have now found it essential to automate my testing.

I have a test that is working fine up until it gets to the link '/cart' it gets to the link '/cart' no problem, but any other link I try to click afterwards always ends up back at the cart.

here is my error after trying to navigate away from the cart.

Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://ift.tt/2rys9nb'
+'http://ift.tt/2sw6GIH'

And here is my test script

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase {




//use Illuminate\Foundation\Testing\WithoutMiddleware;
//use DatabaseTransactions; 
//use withoutMiddleware;
//use DatabaseMigrations;
/**
 * 
 * A basic functional test example.
 * Please choose a unique email address for your new participant
 * @return void
 */
public function testNewUserRegistration() {

    $this->visit('http://ngwenya-mtb.dev/')
        // View Event
        ->click('View event details')
        ->seePageIs('/event?id=30')

        ->click('#enter-race47')
        ->press('Enter yourself to this race')

        ->seePageIs('/events/courses/register/addtocart')
        //->withSession(['This email is already registered' => 'alert-danger'])

        /////////////////////////////////////////////
        //  Fill the register for for new user
        /////////////////////////////////////////////
        ->type('Bingo', 'first_name')
        ->type('11111111', 'password')
        ->type('11111111', 'password_confirmation')
        ->type(''.substr(md5(time()), 0, 12).'@tesing.com', 'email')
        //->check('terms')
        ->select('Male', 'gender')
        ->select('1985', 'year')
        ->select('07', 'month')
        ->select('21', 'day')
        ->select('Small', 'shirt_size')
        ->select('Swaziland ID', 'id_type')
        ->type('badassnumber', 'id_number')
        ->select('Swazi', 'nationality')
        //Contact details Physical
        ->type('Dawlish', 'town_physical')
        ->select('Swaziland', 'country_physical')
        ->type('864741', 'phone_cell')
        //Emergency contact details 1
        ->type('Simon', 'emergency_contact_1')
        ->type('Brother', 'emergency_relationship_1')
        ->type('864741', 'emergency_phone_1');


        $this->press('Register');
        $this->seePageIs('/cart');


        /////////////////////////////////////////////
        //  Add a new user
        /////////////////////////////////////////////

        $this->visit('http://ngwenya-mtb.dev/');
        $this->click('#events-link')

        ->seePageIs('/events');
        dd($this->response->getContent());exit;
        $this->click('#event-30');
        $this->seePageIs('/event?id=30');

        $this->click('#enter-race48');
        $this->press('Enter someone else to this race');
        $this->seePageIs('/events/courses/register/addtocart');             
    }

}

Everything is working fine up until this comment

/////////////////////////////////////////////
//  Add a new user
/////////////////////////////////////////////

Aucun commentaire:

Enregistrer un commentaire