mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-24 16:57:07 +00:00
102 - QA Testing the Login Flow
This commit is contained in:
@@ -11,10 +11,6 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::get('/', function () {
|
|
||||||
return "Laravel";
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('/concerts/{id}', 'ConcertsController@show');
|
Route::get('/concerts/{id}', 'ConcertsController@show');
|
||||||
Route::post('/concerts/{id}/orders', 'ConcertOrdersController@store');
|
Route::post('/concerts/{id}/orders', 'ConcertOrdersController@store');
|
||||||
Route::get('/orders/{confirmationNumber}', 'OrdersController@show');
|
Route::get('/orders/{confirmationNumber}', 'OrdersController@show');
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
||||||
|
|
||||||
class ExampleTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testBasicExample()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit('/')
|
|
||||||
->assertSee('Laravel');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
48
tests/Browser/PromoterLoginTest.php
Normal file
48
tests/Browser/PromoterLoginTest.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
|
||||||
|
class PromoterLoginTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
use DatabaseMigrations;
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function logging_in_successfully()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create([
|
||||||
|
'email' => 'jane@example.com',
|
||||||
|
'password' => bcrypt('super-secret-password'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit('/login')
|
||||||
|
->type('email', 'jane@example.com')
|
||||||
|
->type('password', 'super-secret-password')
|
||||||
|
->press('Log in')
|
||||||
|
->assertPathIs('/backstage/concerts');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function logging_in_with_invalid_credentials()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create([
|
||||||
|
'email' => 'jane@example.com',
|
||||||
|
'password' => bcrypt('super-secret-password'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit('/login')
|
||||||
|
->type('email', 'jane@example.com')
|
||||||
|
->type('password', 'wrong-password')
|
||||||
|
->press('Log in')
|
||||||
|
->assertPathIs('/login')
|
||||||
|
->assertSee('credentials do not match');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user