Merge branch 'next' into global-password-policy
This commit is contained in:
@@ -23,3 +23,4 @@ yarn-error.log
|
||||
.rnd
|
||||
/.ssh
|
||||
.ignition.json
|
||||
.env.dusk.local
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,3 +33,4 @@ _ide_helper_models.php
|
||||
/.ssh
|
||||
scripts/load-test/*
|
||||
.ignition.json
|
||||
.env.dusk.local
|
||||
|
||||
21
app/Providers/DuskServiceProvider.php
Normal file
21
app/Providers/DuskServiceProvider.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DuskServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register Dusk's browser macros.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
\Laravel\Dusk\Browser::macro('loginWithRootUser', function () {
|
||||
return $this->visit('/login')
|
||||
->type('email', 'test@example.com')
|
||||
->type('password', 'password')
|
||||
->press('Login');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -200,6 +200,7 @@ return [
|
||||
App\Providers\HorizonServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
App\Providers\DuskServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="relative pb-8 w-auto">
|
||||
<div class="relative w-auto">
|
||||
@if (!empty($checkboxes))
|
||||
<!-- Step 1: Select actions -->
|
||||
<div x-show="step === 1">
|
||||
@@ -193,7 +193,7 @@
|
||||
x-bind:checked="selectedActions.includes('{{ $checkbox['id'] }}')" />
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
||||
<div class="flex flex-wrap gap-2 justify-between mt-4">
|
||||
<x-forms.button @click="modalOpen = false; resetModal()"
|
||||
class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
|
||||
@@ -280,7 +280,8 @@
|
||||
|
||||
<div class="flex flex-wrap gap-2 justify-between mt-4">
|
||||
@if (!empty($checkboxes))
|
||||
<x-forms.button @click="step--" class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
|
||||
<x-forms.button @click="step--"
|
||||
class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
|
||||
Back
|
||||
</x-forms.button>
|
||||
@else
|
||||
@@ -290,7 +291,8 @@
|
||||
</x-forms.button>
|
||||
@endif
|
||||
<x-forms.button
|
||||
x-bind:disabled="!disableTwoStepConfirmation && confirmWithText && userConfirmationText !== confirmationText"
|
||||
x-bind:disabled="!disableTwoStepConfirmation && confirmWithText && userConfirmationText !==
|
||||
confirmationText"
|
||||
class="w-auto" isError
|
||||
@click="
|
||||
if (dispatchEvent) {
|
||||
@@ -333,7 +335,8 @@
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2 justify-between mt-4">
|
||||
<x-forms.button @click="step--" class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
|
||||
<x-forms.button @click="step--"
|
||||
class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">
|
||||
Back
|
||||
</x-forms.button>
|
||||
<x-forms.button x-bind:disabled="!password" class="w-auto" isError
|
||||
|
||||
@@ -18,15 +18,10 @@ class LoginTest extends DuskTestCase
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
$email = 'test@example.com';
|
||||
$password = 'password';
|
||||
$this->browse(function (Browser $browser) use ($password, $email) {
|
||||
$browser->visit('/login')
|
||||
->type('email', $email)
|
||||
->type('password', $password)
|
||||
->press('Login')
|
||||
$this->browse(callback: function (Browser $browser) {
|
||||
$browser->loginWithRootUser()
|
||||
->assertPathIs('/')
|
||||
->screenshot('login');
|
||||
->assertSee('Dashboard');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Pages;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
|
||||
class HomePage extends Page
|
||||
{
|
||||
/**
|
||||
* Get the URL for the page.
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the browser is on the page.
|
||||
*/
|
||||
public function assert(Browser $browser): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element shortcuts for the page.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function elements(): array
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?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<string, string>
|
||||
*/
|
||||
public static function siteElements(): array
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
}
|
||||
34
tests/Browser/Project/ProjectAddNewTest.php
Normal file
34
tests/Browser/Project/ProjectAddNewTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use Throwable;
|
||||
|
||||
class ProjectAddNewTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* A basic test for the projects page.
|
||||
* Login with the test user and assert that the user is redirected to the projects page.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->loginWithRootUser()
|
||||
->visit('/projects')
|
||||
->pressAndWaitFor('+ Add', 1)
|
||||
->assertSee('New Project')
|
||||
->screenshot('project-add-new-1')
|
||||
->type('name', 'Test Project')
|
||||
->screenshot('project-add-new-2')
|
||||
->press('Continue')
|
||||
->assertSee('Test Project.')
|
||||
->screenshot('project-add-new-3');
|
||||
});
|
||||
}
|
||||
}
|
||||
29
tests/Browser/Project/ProjectSearchTest.php
Normal file
29
tests/Browser/Project/ProjectSearchTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use Throwable;
|
||||
|
||||
class ProjectSearchTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* A basic test for the projects page.
|
||||
* Login with the test user and assert that the user is redirected to the projects page.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->loginWithRootUser()
|
||||
->visit('/projects')
|
||||
->type('[x-model="search"]', 'joi43j4oi32j4o2')
|
||||
->assertSee('No project found with the search term "joi43j4oi32j4o2".')
|
||||
->screenshot('project-search-not-found');
|
||||
});
|
||||
}
|
||||
}
|
||||
27
tests/Browser/Project/ProjectTest.php
Normal file
27
tests/Browser/Project/ProjectTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use Throwable;
|
||||
|
||||
class ProjectTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* A basic test for the projects page.
|
||||
* Login with the test user and assert that the user is redirected to the projects page.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->loginWithRootUser()
|
||||
->visit('/projects')
|
||||
->assertSee('Projects');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user