mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Update to 6.6
This commit is contained in:
21
tests/Browser/LoginTest.php
Normal file
21
tests/Browser/LoginTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class LoginTest extends DuskTestCase
|
||||
{
|
||||
public function testLogin()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->visit('/login')
|
||||
->type('email','admin@exvps.ca')
|
||||
->type('password','SuperAdmin')
|
||||
->click('@login-button')
|
||||
->assertPathIs('/admin');
|
||||
});
|
||||
}
|
||||
}
|
||||
41
tests/Browser/Pages/HomePage.php
Normal file
41
tests/Browser/Pages/HomePage.php
Normal file
@@ -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',
|
||||
];
|
||||
}
|
||||
}
|
||||
20
tests/Browser/Pages/Page.php
Normal file
20
tests/Browser/Pages/Page.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Pages;
|
||||
|
||||
use Laravel\Dusk\Page as BasePage;
|
||||
|
||||
abstract class Page extends BasePage
|
||||
{
|
||||
/**
|
||||
* Get the global element shortcuts for the site.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function siteElements()
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
}
|
||||
43
tests/Browser/UserTest.php
Normal file
43
tests/Browser/UserTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class UserTest extends DuskTestCase
|
||||
{
|
||||
public function testUser()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->loginAs(\App\User::find(2))
|
||||
->visit('/admin/user')
|
||||
->assertSee('Autre visiteur')
|
||||
->assertSee('Administrateur Administrateur')
|
||||
->click('@add-user-btn')
|
||||
->assertPathIs('/admin/user/add')
|
||||
->type('firstname','Test')
|
||||
->type('lastname','User')
|
||||
->type('email','test@exvps.ca')
|
||||
->type('emailc','test@exvps.ca')
|
||||
->type('adresse','14 ave Des Rue, Rimouski')
|
||||
->type('telephone','4187544158')
|
||||
->select('sexe','Femme')
|
||||
->type('age','55')
|
||||
->select('rank','SuperAdmin')
|
||||
->select('job','Indéterminé')
|
||||
->type('psw','SuperAdmin')
|
||||
->type('pswc','SuperAdmin')
|
||||
->click('#submit')
|
||||
->assertSee('User Test')
|
||||
->click('@edit-btn-'.\App\User::all()->where('firstname','=','Test')->first()->id)
|
||||
->type('lastname','test')
|
||||
->click('#submit')
|
||||
->assertSee('test Test')
|
||||
->click('@delete-btn-'.\App\User::all()->where('firstname','=','Test')->first()->id)
|
||||
->press('Oui')
|
||||
->press('OK');
|
||||
});
|
||||
}
|
||||
}
|
||||
2
tests/Browser/console/.gitignore
vendored
Normal file
2
tests/Browser/console/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
tests/Browser/screenshots/.gitignore
vendored
Normal file
2
tests/Browser/screenshots/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user