Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/UserTest.php
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | public function testUserInfo(): void | ||||
->assertSeeIn('.row:nth-child(6) label', 'External Email') | ->assertSeeIn('.row:nth-child(6) label', 'External Email') | ||||
->assertMissing('.row:nth-child(6) #external_email a') | ->assertMissing('.row:nth-child(6) #external_email a') | ||||
->assertSeeIn('.row:nth-child(7) label', 'Country') | ->assertSeeIn('.row:nth-child(7) label', 'Country') | ||||
->assertSeeIn('.row:nth-child(7) #country', 'United States'); | ->assertSeeIn('.row:nth-child(7) #country', 'United States'); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 8); | ->assertElementsCount('@nav a', 9); | ||||
// Note: Finances tab is tested in UserFinancesTest.php | // Note: Finances tab is tested in UserFinancesTest.php | ||||
$browser->assertSeeIn('@nav #tab-finances', 'Finances'); | $browser->assertSeeIn('@nav #tab-finances', 'Finances'); | ||||
// Assert Aliases tab | // Assert Aliases tab | ||||
$browser->assertSeeIn('@nav #tab-aliases', 'Aliases (1)') | $browser->assertSeeIn('@nav #tab-aliases', 'Aliases (1)') | ||||
->click('@nav #tab-aliases') | ->click('@nav #tab-aliases') | ||||
->whenAvailable('@user-aliases', function (Browser $browser) { | ->whenAvailable('@user-aliases', function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | public function testUserInfo(): void | ||||
// Assert Resources tab | // Assert Resources tab | ||||
$browser->assertSeeIn('@nav #tab-resources', 'Resources (0)') | $browser->assertSeeIn('@nav #tab-resources', 'Resources (0)') | ||||
->click('@nav #tab-resources') | ->click('@nav #tab-resources') | ||||
->with('@user-resources', function (Browser $browser) { | ->with('@user-resources', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 0) | $browser->assertElementsCount('table tbody tr', 0) | ||||
->assertSeeIn('table tfoot tr td', 'There are no resources in this account.'); | ->assertSeeIn('table tfoot tr td', 'There are no resources in this account.'); | ||||
}); | }); | ||||
// Assert Shared folders tab | |||||
$browser->assertSeeIn('@nav #tab-shared-folders', 'Shared folders (0)') | |||||
->click('@nav #tab-shared-folders') | |||||
->with('@user-shared-folders', function (Browser $browser) { | |||||
$browser->assertElementsCount('table tbody tr', 0) | |||||
->assertSeeIn('table tfoot tr td', 'There are no shared folders in this account.'); | |||||
}); | |||||
// Assert Settings tab | // Assert Settings tab | ||||
$browser->assertSeeIn('@nav #tab-settings', 'Settings') | $browser->assertSeeIn('@nav #tab-settings', 'Settings') | ||||
->click('@nav #tab-settings') | ->click('@nav #tab-settings') | ||||
->whenAvailable('@user-settings form', function (Browser $browser) { | ->whenAvailable('@user-settings form', function (Browser $browser) { | ||||
$browser->assertElementsCount('.row', 1) | $browser->assertElementsCount('.row', 1) | ||||
->assertSeeIn('.row:first-child label', 'Greylisting') | ->assertSeeIn('.row:first-child label', 'Greylisting') | ||||
->assertSeeIn('.row:first-child .text-success', 'enabled'); | ->assertSeeIn('.row:first-child .text-success', 'enabled'); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
->assertSeeIn('.row:nth-child(8) label', 'Address') | ->assertSeeIn('.row:nth-child(8) label', 'Address') | ||||
->assertSeeIn('.row:nth-child(8) #billing_address', $john->getSetting('billing_address')) | ->assertSeeIn('.row:nth-child(8) #billing_address', $john->getSetting('billing_address')) | ||||
->assertSeeIn('.row:nth-child(9) label', 'Country') | ->assertSeeIn('.row:nth-child(9) label', 'Country') | ||||
->assertSeeIn('.row:nth-child(9) #country', 'United States'); | ->assertSeeIn('.row:nth-child(9) #country', 'United States'); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 8); | ->assertElementsCount('@nav a', 9); | ||||
// Note: Finances tab is tested in UserFinancesTest.php | // Note: Finances tab is tested in UserFinancesTest.php | ||||
$browser->assertSeeIn('@nav #tab-finances', 'Finances'); | $browser->assertSeeIn('@nav #tab-finances', 'Finances'); | ||||
// Assert Aliases tab | // Assert Aliases tab | ||||
$browser->assertSeeIn('@nav #tab-aliases', 'Aliases (1)') | $browser->assertSeeIn('@nav #tab-aliases', 'Aliases (1)') | ||||
->click('@nav #tab-aliases') | ->click('@nav #tab-aliases') | ||||
->whenAvailable('@user-aliases', function (Browser $browser) { | ->whenAvailable('@user-aliases', function (Browser $browser) { | ||||
Show All 22 Lines | public function testUserInfo2(): void | ||||
->click('@nav #tab-domains') | ->click('@nav #tab-domains') | ||||
->with('@user-domains table', function (Browser $browser) { | ->with('@user-domains table', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 1) | $browser->assertElementsCount('tbody tr', 1) | ||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'kolab.org') | ->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'kolab.org') | ||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ||||
->assertMissing('tfoot'); | ->assertMissing('tfoot'); | ||||
}); | }); | ||||
// Assert Users tab | |||||
$browser->assertSeeIn('@nav #tab-users', 'Users (4)') | |||||
->click('@nav #tab-users') | |||||
->with('@user-users table', function (Browser $browser) { | |||||
$browser->assertElementsCount('tbody tr', 4) | |||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'jack@kolab.org') | |||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | |||||
->assertSeeIn('tbody tr:nth-child(2) td:first-child a', 'joe@kolab.org') | |||||
->assertVisible('tbody tr:nth-child(2) td:first-child svg.text-success') | |||||
->assertSeeIn('tbody tr:nth-child(3) td:first-child span', 'john@kolab.org') | |||||
->assertVisible('tbody tr:nth-child(3) td:first-child svg.text-success') | |||||
->assertSeeIn('tbody tr:nth-child(4) td:first-child a', 'ned@kolab.org') | |||||
->assertVisible('tbody tr:nth-child(4) td:first-child svg.text-success') | |||||
->assertMissing('tfoot'); | |||||
}); | |||||
// Assert Distribution lists tab | // Assert Distribution lists tab | ||||
$browser->assertSeeIn('@nav #tab-distlists', 'Distribution lists (1)') | $browser->assertSeeIn('@nav #tab-distlists', 'Distribution lists (1)') | ||||
->click('@nav #tab-distlists') | ->click('@nav #tab-distlists') | ||||
->with('@user-distlists table', function (Browser $browser) { | ->with('@user-distlists table', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 1) | $browser->assertElementsCount('tbody tr', 1) | ||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'Test Group') | ->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'Test Group') | ||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-danger') | ->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-danger') | ||||
->assertSeeIn('tbody tr:nth-child(1) td:last-child a', 'group-test@kolab.org') | ->assertSeeIn('tbody tr:nth-child(1) td:last-child a', 'group-test@kolab.org') | ||||
->assertMissing('tfoot'); | ->assertMissing('tfoot'); | ||||
}); | }); | ||||
// Assert Resources tab | // Assert Resources tab | ||||
$browser->assertSeeIn('@nav #tab-resources', 'Resources (2)') | $browser->assertSeeIn('@nav #tab-resources', 'Resources (2)') | ||||
->click('@nav #tab-resources') | ->click('@nav #tab-resources') | ||||
->with('@user-resources', function (Browser $browser) { | ->with('@user-resources', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 2) | $browser->assertElementsCount('table tbody tr', 2) | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'Conference Room #1') | ->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'Conference Room #1') | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:last-child', 'resource-test1@kolab.org') | ->assertSeeIn('table tbody tr:nth-child(1) td:last-child', 'resource-test1@kolab.org') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Conference Room #2') | ->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Conference Room #2') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:last-child', 'resource-test2@kolab.org') | ->assertSeeIn('table tbody tr:nth-child(2) td:last-child', 'resource-test2@kolab.org') | ||||
->assertMissing('table tfoot'); | ->assertMissing('table tfoot'); | ||||
}); | }); | ||||
// Assert Users tab | // Assert Shared folders tab | ||||
$browser->assertSeeIn('@nav #tab-users', 'Users (4)') | $browser->assertSeeIn('@nav #tab-shared-folders', 'Shared folders (2)') | ||||
->click('@nav #tab-users') | ->click('@nav #tab-shared-folders') | ||||
->with('@user-users table', function (Browser $browser) { | ->with('@user-shared-folders', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 4) | $browser->assertElementsCount('table tbody tr', 2) | ||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'jack@kolab.org') | ->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'Calendar') | ||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ->assertSeeIn('table tbody tr:nth-child(1) td:nth-child(2)', 'Calendar') | ||||
->assertSeeIn('tbody tr:nth-child(2) td:first-child a', 'joe@kolab.org') | ->assertSeeIn('table tbody tr:nth-child(1) td:last-child', 'folder-event@kolab.org') | ||||
->assertVisible('tbody tr:nth-child(2) td:first-child svg.text-success') | ->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Contacts') | ||||
->assertSeeIn('tbody tr:nth-child(3) td:first-child span', 'john@kolab.org') | ->assertSeeIn('table tbody tr:nth-child(2) td:nth-child(2)', 'Address Book') | ||||
->assertVisible('tbody tr:nth-child(3) td:first-child svg.text-success') | ->assertSeeIn('table tbody tr:nth-child(2) td:last-child', 'folder-contact@kolab.org') | ||||
->assertSeeIn('tbody tr:nth-child(4) td:first-child a', 'ned@kolab.org') | ->assertMissing('table tfoot'); | ||||
->assertVisible('tbody tr:nth-child(4) td:first-child svg.text-success') | |||||
->assertMissing('tfoot'); | |||||
}); | }); | ||||
}); | }); | ||||
// Now we go to Ned's info page, he's a controller on John's wallet | // Now we go to Ned's info page, he's a controller on John's wallet | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$ned = $this->getTestUser('ned@kolab.org'); | $ned = $this->getTestUser('ned@kolab.org'); | ||||
$beta_sku = Sku::withEnvTenantContext()->where('title', 'beta')->first(); | $beta_sku = Sku::withEnvTenantContext()->where('title', 'beta')->first(); | ||||
$storage_sku = Sku::withEnvTenantContext()->where('title', 'storage')->first(); | $storage_sku = Sku::withEnvTenantContext()->where('title', 'storage')->first(); | ||||
Show All 13 Lines | public function testUserInfo2(): void | ||||
'cost' => 5000, | 'cost' => 5000, | ||||
'entitleable_id' => $ned->id, | 'entitleable_id' => $ned->id, | ||||
'entitleable_type' => User::class | 'entitleable_type' => User::class | ||||
]); | ]); | ||||
$page = new UserPage($ned->id); | $page = new UserPage($ned->id); | ||||
$ned->setSetting('greylist_enabled', 'false'); | $ned->setSetting('greylist_enabled', 'false'); | ||||
$browser->click('@user-users tbody tr:nth-child(4) td:first-child a') | $browser->click('@nav #tab-users') | ||||
->click('@user-users tbody tr:nth-child(4) td:first-child a') | |||||
->on($page); | ->on($page); | ||||
// Assert main info box content | // Assert main info box content | ||||
$browser->assertSeeIn('@user-info .card-title', $ned->email) | $browser->assertSeeIn('@user-info .card-title', $ned->email) | ||||
->with('@user-info form', function (Browser $browser) use ($ned) { | ->with('@user-info form', function (Browser $browser) use ($ned) { | ||||
$browser->assertSeeIn('.row:nth-child(2) label', 'ID (Created)') | $browser->assertSeeIn('.row:nth-child(2) label', 'ID (Created)') | ||||
->assertSeeIn('.row:nth-child(2) #userid', "{$ned->id} ({$ned->created_at})"); | ->assertSeeIn('.row:nth-child(2) #userid', "{$ned->id} ({$ned->created_at})"); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 8); | ->assertElementsCount('@nav a', 9); | ||||
// Note: Finances tab is tested in UserFinancesTest.php | // Note: Finances tab is tested in UserFinancesTest.php | ||||
$browser->assertSeeIn('@nav #tab-finances', 'Finances'); | $browser->assertSeeIn('@nav #tab-finances', 'Finances'); | ||||
// Assert Aliases tab | // Assert Aliases tab | ||||
$browser->assertSeeIn('@nav #tab-aliases', 'Aliases (0)') | $browser->assertSeeIn('@nav #tab-aliases', 'Aliases (0)') | ||||
->click('@nav #tab-aliases') | ->click('@nav #tab-aliases') | ||||
->whenAvailable('@user-aliases', function (Browser $browser) { | ->whenAvailable('@user-aliases', function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
// We don't expect John's resources here | // We don't expect John's resources here | ||||
$browser->assertSeeIn('@nav #tab-resources', 'Resources (0)') | $browser->assertSeeIn('@nav #tab-resources', 'Resources (0)') | ||||
->click('@nav #tab-resources') | ->click('@nav #tab-resources') | ||||
->with('@user-resources', function (Browser $browser) { | ->with('@user-resources', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 0) | $browser->assertElementsCount('table tbody tr', 0) | ||||
->assertSeeIn('table tfoot tr td', 'There are no resources in this account.'); | ->assertSeeIn('table tfoot tr td', 'There are no resources in this account.'); | ||||
}); | }); | ||||
// We don't expect John's folders here | |||||
$browser->assertSeeIn('@nav #tab-shared-folders', 'Shared folders (0)') | |||||
->click('@nav #tab-shared-folders') | |||||
->with('@user-shared-folders', function (Browser $browser) { | |||||
$browser->assertElementsCount('table tbody tr', 0) | |||||
->assertSeeIn('table tfoot tr td', 'There are no shared folders in this account.'); | |||||
}); | |||||
// Assert Settings tab | // Assert Settings tab | ||||
$browser->assertSeeIn('@nav #tab-settings', 'Settings') | $browser->assertSeeIn('@nav #tab-settings', 'Settings') | ||||
->click('@nav #tab-settings') | ->click('@nav #tab-settings') | ||||
->whenAvailable('@user-settings form', function (Browser $browser) { | ->whenAvailable('@user-settings form', function (Browser $browser) { | ||||
$browser->assertElementsCount('.row', 1) | $browser->assertElementsCount('.row', 1) | ||||
->assertSeeIn('.row:first-child label', 'Greylisting') | ->assertSeeIn('.row:first-child label', 'Greylisting') | ||||
->assertSeeIn('.row:first-child .text-danger', 'disabled'); | ->assertSeeIn('.row:first-child .text-danger', 'disabled'); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |