Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/DashboardTest.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function testSearch(): void | ||||
->submitLogon('jeroen@jeroen.jeroen', 'jeroen', true) | ->submitLogon('jeroen@jeroen.jeroen', 'jeroen', true) | ||||
->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.') | ||||
->assertMissing('@search table'); | ->assertMissing('@search table'); | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$jack->setSetting('external_email', 'john.doe.external@gmail.com'); | $jack->setSetting('external_email', 'john.doe.external@gmail.com'); | ||||
// Test search with multiple results | // Test search with multiple results | ||||
$browser->type('@search input', 'john.doe.external@gmail.com') | $browser->type('@search input', 'john.doe.external@gmail.com') | ||||
->click('@search form button') | ->click('@search form button') | ||||
->assertToast(Toast::TYPE_INFO, '', '2 user accounts have been found.') | ->assertToast(Toast::TYPE_INFO, '2 user accounts have been found.') | ||||
->whenAvailable('@search table', function (Browser $browser) { | ->whenAvailable('@search table', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 2); | $browser->assertElementsCount('tbody tr', 2); | ||||
// TODO: Assert table content | // TODO: Assert table content | ||||
}); | }); | ||||
// Test search with single record result -> redirect to user page | // Test search with single record result -> redirect to user page | ||||
$browser->type('@search input', 'kolab.org') | $browser->type('@search input', 'kolab.org') | ||||
->click('@search form button') | ->click('@search form button') | ||||
->assertMissing('@search table') | ->assertMissing('@search table') | ||||
->waitForLocation('/user/' . $john->id) | ->waitForLocation('/user/' . $john->id) | ||||
->waitFor('#user-info') | ->waitFor('#user-info') | ||||
->assertVisible('#user-info .card-title', $john->email); | ->assertVisible('#user-info .card-title', $john->email); | ||||
}); | }); | ||||
} | } | ||||
} | } |