Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/DashboardTest.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | class DashboardTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test user search | * Test user search | ||||
*/ | */ | ||||
public function testSearch(): void | public function testSearch(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('jeroen@jeroen.jeroen', 'jeroen', true) | ->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ||||
machniak: I think we should use `\config('app.passphrase')` in tests. If it is not set, the test will… | |||||
Done Inline ActionsThis is what \App\Utils::generatePassphrase() does for us -- it takes \config('app.passphrase') if available. vanmeeuwen: This is what `\App\Utils::generatePassphrase()` does for us -- it takes `\config('app. | |||||
Not Done Inline ActionsI know, but if you read the code of the test it says "generate passphrase". It does not make sense here, just from the code readability point of view. machniak: I know, but if you read the code of the test it says "generate passphrase". It does not make… | |||||
Done Inline ActionsThis is why I wanted to get away from tests using seeded fixtures -- but that is also a different effort. vanmeeuwen: This is why I wanted to get away from tests using seeded fixtures -- but that is also a… | |||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->assertFocused('@search input') | ->assertFocused('@search input') | ||||
->assertMissing('@search table'); | ->assertMissing('@search table'); | ||||
// Test search with no results | // Test search with no results | ||||
$browser->type('@search input', 'unknown') | $browser->type('@search input', 'unknown') | ||||
->click('@search form button') | ->click('@search form button') | ||||
->assertToast(Toast::TYPE_INFO, '0 user accounts have been found.') | ->assertToast(Toast::TYPE_INFO, '0 user accounts have been found.') | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | class DashboardTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test user search deleted user/domain | * Test user search deleted user/domain | ||||
*/ | */ | ||||
public function testSearchDeleted(): void | public function testSearchDeleted(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('jeroen@jeroen.jeroen', 'jeroen', true) | ->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->assertFocused('@search input') | ->assertFocused('@search input') | ||||
->assertMissing('@search table'); | ->assertMissing('@search table'); | ||||
// Deleted users/domains | // Deleted users/domains | ||||
$domain = $this->getTestDomain('testsearch.com', ['type' => \App\Domain::TYPE_EXTERNAL]); | $domain = $this->getTestDomain('testsearch.com', ['type' => \App\Domain::TYPE_EXTERNAL]); | ||||
$user = $this->getTestUser('test@testsearch.com'); | $user = $this->getTestUser('test@testsearch.com'); | ||||
$plan = \App\Plan::where('title', 'group')->first(); | $plan = \App\Plan::where('title', 'group')->first(); | ||||
Show All 24 Lines |
I think we should use \config('app.passphrase') in tests. If it is not set, the test will fail anyway because the password will be different.