-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
443 additions
and
4 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use App\Models\Company; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class CompanyFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = Company::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'name' => $this->faker->name(), | ||
'email' => $this->faker->unique()->safeEmail(), | ||
'logo' => $this->faker->image('/'), | ||
'website_link' => $this->faker->url(), | ||
]; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Browser Test Suite"> | ||
<directory suffix="Test.php">./tests/Browser</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Tests\Browser\Auth; | ||
|
||
use App\Models\User; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Laravel\Dusk\Browser; | ||
use Tests\DuskTestCase; | ||
|
||
class LoginTest extends DuskTestCase | ||
{ | ||
use DatabaseMigrations; | ||
|
||
public function testRegisteredUserCanSignInAndSignOut() | ||
{ | ||
$this->browse(function (Browser $browser) { | ||
// Create new user | ||
$user = User::factory()->create([ | ||
'email' => 'admin@admin.com' | ||
]); | ||
|
||
// Begin test | ||
$browser->visit('/login') | ||
->type('email', $user->email) | ||
->type('password', 'password') | ||
->press(trans('simplecrm.sign_in')) | ||
->click('a[href="' . route('logout') . '"]') | ||
->visit('/admin') | ||
->assertPathIs('/login'); | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Browser; | ||
|
||
use App\Models\User; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Laravel\Dusk\Browser; | ||
use Tests\DuskTestCase; | ||
|
||
class CompanyTest extends DuskTestCase | ||
{ | ||
use DatabaseMigrations; | ||
|
||
public function testIndex() | ||
{ | ||
$user = User::factory()->create([ | ||
'email' => 'admin@admin.com' | ||
]); | ||
|
||
$this->browse(function (Browser $browser) use ($user) { | ||
$browser->loginAs($user) | ||
->visit(route('admin.company.index')) | ||
->assertRouteIs('admin.company.index'); | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Browser; | ||
|
||
use App\Models\User; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Laravel\Dusk\Browser; | ||
use Tests\DuskTestCase; | ||
|
||
class EmployeeTest extends DuskTestCase | ||
{ | ||
use DatabaseMigrations; | ||
|
||
public function testIndex() | ||
{ | ||
$user = User::factory()->create([ | ||
'email' => 'admin@admin.com' | ||
]); | ||
|
||
$this->browse(function (Browser $browser) use ($user) { | ||
$browser->loginAs($user) | ||
->visit(route('admin.employee.index')) | ||
->assertRouteIs('admin.employee.index'); | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Tests\Browser; | ||
|
||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Laravel\Dusk\Browser; | ||
use Tests\DuskTestCase; | ||
|
||
class ExampleTest extends DuskTestCase | ||
{ | ||
/** | ||
* A basic browser test example. | ||
* | ||
* @return void | ||
*/ | ||
public function testBasicExample() | ||
{ | ||
$this->browse(function (Browser $browser) { | ||
$browser->visit('/') | ||
->assertSee('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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Tests\Browser\Pages; | ||
|
||
use Laravel\Dusk\Browser; | ||
|
||
class HomePage extends Page | ||
{ | ||
/** | ||
* Get the URL for the page. | ||
* | ||
* @return string | ||
*/ | ||
public function url() | ||
{ | ||
return '/'; | ||
} | ||
|
||
/** | ||
* Assert that the browser is on the page. | ||
* | ||
* @param \Laravel\Dusk\Browser $browser | ||
* @return void | ||
*/ | ||
public function assert(Browser $browser) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the element shortcuts for the page. | ||
* | ||
* @return array | ||
*/ | ||
public function elements() | ||
{ | ||
return [ | ||
'@element' => '#selector', | ||
]; | ||
} | ||
} |
Oops, something went wrong.