Created
March 11, 2018 13:31
-
-
Save ferdousulhaque/09aea4b54d96db3db308429707d4373d to your computer and use it in GitHub Desktop.
Testing Login Create Logout in Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Browser; | |
use Tests\DuskTestCase; | |
use Laravel\Dusk\Browser; | |
use Illuminate\Foundation\Testing\DatabaseMigrations; | |
class CSPanelTest extends DuskTestCase | |
{ | |
// Test 01 | |
// Login Check | |
public function testLogin() | |
{ | |
$this->browse(function ($browser) { | |
$browser->visit('/login') | |
->type('email', '[email protected]') | |
->type('password', 'password') | |
->press('Login') | |
->assertPathIs('/dashboard'); | |
}); | |
} | |
// Test 02 | |
// Ticket Creation | |
public function testTicketCreation() | |
{ | |
$this->browse(function ($browser) { | |
$browser->visit('/dashboard') | |
->clickLink('My Tickets') | |
->clickLink('Create New Support') | |
->select('category_id', 'Software Bug') | |
->type('title', 'Test Ticket') | |
->type('message', 'Test Ticket') | |
->select('priority', 'P1') | |
->press('Create Support') | |
->assertPathIs('/support'); | |
}); | |
} | |
// Test 03 | |
// Logout Check | |
public function testLogout() | |
{ | |
$this->browse(function ($browser) { | |
$browser->visit('/dashboard') | |
->clickLink('Log Out') | |
->assertPathIs('/'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment