Commit 3e37af24 authored by Viral Solani's avatar Viral Solani

add Feature/LoginTests

parent 4249416f
<?php
namespace Tests\Feature;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertSee('Laravel AdminPanel');
}
}
...@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Auth; ...@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Tests\BrowserKitTestCase; use Tests\BrowserKitTestCase;
class AuthTest extends BrowserKitTestCase class LoginTest extends BrowserKitTestCase
{ {
/** @test */ /** @test */
public function login_page_loads_properly() public function login_page_loads_properly()
...@@ -20,17 +20,30 @@ class AuthTest extends BrowserKitTestCase ...@@ -20,17 +20,30 @@ class AuthTest extends BrowserKitTestCase
} }
/** @test */ /** @test */
public function login_failure_without_inputs() public function login_fails_when_a_required_field_is_not_filled_in()
{ {
$this->visit('/login') $this->visit('/login')
->type('', 'email')
->type('', 'password')
->press('Login')
->seePageIs('/login')
->see('The email field is required.')
->see('The password field is required.');
}
/** @test */
public function login_fails_when_password_is_incorrect()
{
$this->visit('/login')
->type('admin@admin.com', 'email')
->type('invalidpass', 'password')
->press('Login') ->press('Login')
->seePageIs('/login') ->seePageIs('/login')
->see('The email field is required.') ->see('These credentials do not match our records.');
->see('The password field is required.');
} }
/** @test */ /** @test */
public function test_login_failure_with_wrong_inputs() public function login_failure_with_wrong_inputs()
{ {
$this->visit("/login") $this->visit("/login")
->type('wrongusername@wrongpassword.com', 'email') ->type('wrongusername@wrongpassword.com', 'email')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment