feat: change order of Dusk tests
for login, image upload, and entry creation in admin panel
This commit is contained in:
parent
56ce59fc22
commit
22393b5954
3 changed files with 0 additions and 0 deletions
46
tests/Browser/002_UploadImageAdminTest.php
Normal file
46
tests/Browser/002_UploadImageAdminTest.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTruncation;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\Browser\Concerns\AuthenticatesUsers;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class UploadImageAdminTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseTruncation;
|
||||
use AuthenticatesUsers;
|
||||
|
||||
|
||||
|
||||
public function test_image_upload_admin_panel(): void
|
||||
{
|
||||
$user = $this->createTestUser("login-test@example.com");
|
||||
|
||||
$filePath = base_path('tests/Browser/fixtures/robot.webp');
|
||||
|
||||
$this->browse(function (Browser $browser ) use ($user, $filePath) {
|
||||
$this->loginUser($browser, $user);
|
||||
$this->assertWithDebugPause(
|
||||
$browser,
|
||||
fn($b) =>
|
||||
$b->visit('/admin/media')
|
||||
->waitForLocation('/admin/media')
|
||||
->assertPathIs('/admin/media')
|
||||
->assertTitleContains('Media')
|
||||
->clickLink('New media')
|
||||
->waitForText('Create Media')
|
||||
->type('#form\\.name', 'test image')
|
||||
->assertVisible('.filepond--drop-label')
|
||||
->attach('.filepond--browser', $filePath)
|
||||
->pause(7000)
|
||||
->waitForText('Create')
|
||||
->waitFor('#key-bindings-1:not([disabled])')
|
||||
->click('#key-bindings-1')
|
||||
->assertSee('Collection name'),
|
||||
1000 // Custom pause time for this test
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue