Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/UserTest.php
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | class UserTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test user info page | * Test user info page | ||||
*/ | */ | ||||
public function testUserInfo(): void | public function testUserInfo(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$jack->setSetting('limit_geo', null); | $jack->setSetting('limit_geo', null); | ||||
$jack->setSetting('guam_enabled', null); | |||||
$page = new UserPage($jack->id); | $page = new UserPage($jack->id); | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->visit($page) | ->visit($page) | ||||
->on($page); | ->on($page); | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | public function testUserInfo(): void | ||||
$browser->assertElementsCount('table tbody tr', 0) | $browser->assertElementsCount('table tbody tr', 0) | ||||
->assertSeeIn('table tfoot tr td', 'There are no shared folders in this account.'); | ->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', 2) | $browser->assertElementsCount('.row', 3) | ||||
->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') | ||||
->assertSeeIn('.row:nth-child(2) label', 'Geo-lockin') | ->assertSeeIn('.row:nth-child(2) label', 'IMAP proxy') | ||||
->assertSeeIn('.row:nth-child(2) #limit_geo', 'No restrictions') | ->assertSeeIn('.row:nth-child(2) .text-danger', 'disabled') | ||||
->assertSeeIn('.row:nth-child(3) label', 'Geo-lockin') | |||||
->assertSeeIn('.row:nth-child(3) #limit_geo', 'No restrictions') | |||||
->assertMissing('#limit_geo + button'); | ->assertMissing('#limit_geo + button'); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test user info page (continue) | * Test user info page (continue) | ||||
* | * | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
$browser->assertElementsCount('table tbody tr', 0) | $browser->assertElementsCount('table tbody tr', 0) | ||||
->assertSeeIn('table tfoot tr td', 'There are no shared folders in this account.'); | ->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', 2) | $browser->assertElementsCount('.row', 3) | ||||
->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'); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test editing an external email | * Test editing an external email | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | class UserTest extends TestCaseDusk | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$user = $this->getTestUser('userstest1@kolabnow.com'); | $user = $this->getTestUser('userstest1@kolabnow.com'); | ||||
$user->setSetting('limit_geo', '["PL","DE"]'); | $user->setSetting('limit_geo', '["PL","DE"]'); | ||||
$browser->visit(new UserPage($user->id)) | $browser->visit(new UserPage($user->id)) | ||||
->click('@nav #tab-settings') | ->click('@nav #tab-settings') | ||||
->whenAvailable('@user-settings form', function (Browser $browser) { | ->whenAvailable('@user-settings form', function (Browser $browser) { | ||||
$browser->assertSeeIn('.row:nth-child(2) label', 'Geo-lockin') | $browser->assertSeeIn('.row:nth-child(3) label', 'Geo-lockin') | ||||
->assertSeeIn('.row:nth-child(2) #limit_geo', 'Poland, Germany') | ->assertSeeIn('.row:nth-child(3) #limit_geo', 'Poland, Germany') | ||||
->assertSeeIn('#limit_geo + button', 'Reset') | ->assertSeeIn('#limit_geo + button', 'Reset') | ||||
->click('#limit_geo + button'); | ->click('#limit_geo + button'); | ||||
}) | }) | ||||
->assertToast(Toast::TYPE_SUCCESS, 'Geo-lockin setup reset successfully.') | ->assertToast(Toast::TYPE_SUCCESS, 'Geo-lockin setup reset successfully.') | ||||
->assertMissing('#limit_geo + button'); | ->assertMissing('#limit_geo + button'); | ||||
}); | }); | ||||
} | } | ||||
Show All 24 Lines |