Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | public function testInfo(): void | ||||
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ||||
}) | }) | ||||
->on(new UserList()) | ->on(new UserList()) | ||||
->click('@table tr:nth-child(3) a') | ->click('@table tr:nth-child(3) a') | ||||
->on(new UserInfo()); | ->on(new UserInfo()); | ||||
$expected = ['activesync', 'groupware', 'mailbox', | $expected = ['activesync', 'groupware', 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage', 'storage']; | 'storage', 'storage', 'storage', 'storage', 'storage', 'storage']; | ||||
$this->assertUserEntitlements($john, $expected); | $this->assertEntitlements($john, $expected); | ||||
// Test subscriptions interaction | // Test subscriptions interaction | ||||
$browser->with('@general', function (Browser $browser) { | $browser->with('@general', function (Browser $browser) { | ||||
$browser->with('@skus', function ($browser) { | $browser->with('@skus', function ($browser) { | ||||
// Uncheck 'groupware', expect activesync unchecked | // Uncheck 'groupware', expect activesync unchecked | ||||
$browser->click('#sku-input-groupware') | $browser->click('#sku-input-groupware') | ||||
->assertNotChecked('#sku-input-groupware') | ->assertNotChecked('#sku-input-groupware') | ||||
->assertNotChecked('#sku-input-activesync') | ->assertNotChecked('#sku-input-activesync') | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | public function testNewUser(): void | ||||
$browser->assertElementsCount('tbody tr', 5) | $browser->assertElementsCount('tbody tr', 5) | ||||
->assertSeeIn('tbody tr:nth-child(4) a', 'julia.roberts@kolab.org'); | ->assertSeeIn('tbody tr:nth-child(4) a', 'julia.roberts@kolab.org'); | ||||
}); | }); | ||||
$julia = User::where('email', 'julia.roberts@kolab.org')->first(); | $julia = User::where('email', 'julia.roberts@kolab.org')->first(); | ||||
$alias = UserAlias::where('user_id', $julia->id)->where('alias', 'julia.roberts2@kolab.org')->first(); | $alias = UserAlias::where('user_id', $julia->id)->where('alias', 'julia.roberts2@kolab.org')->first(); | ||||
$this->assertTrue(!empty($alias)); | $this->assertTrue(!empty($alias)); | ||||
$this->assertUserEntitlements($julia, ['mailbox', 'storage', 'storage', 'storage', 'storage', 'storage']); | $this->assertEntitlements($julia, ['mailbox', 'storage', 'storage', 'storage', 'storage', 'storage']); | ||||
$this->assertSame('Julia', $julia->getSetting('first_name')); | $this->assertSame('Julia', $julia->getSetting('first_name')); | ||||
$this->assertSame('Roberts', $julia->getSetting('last_name')); | $this->assertSame('Roberts', $julia->getSetting('last_name')); | ||||
$this->assertSame('Test Org', $julia->getSetting('organization')); | $this->assertSame('Test Org', $julia->getSetting('organization')); | ||||
// Some additional tests for the list input widget | // Some additional tests for the list input widget | ||||
$browser->click('@table tbody tr:nth-child(4) a') | $browser->click('@table tbody tr:nth-child(4) a') | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 326 Lines • ▼ Show 20 Lines | public function testBetaEntitlements(): void | ||||
$expected = [ | $expected = [ | ||||
'beta', | 'beta', | ||||
'distlist', | 'distlist', | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage' | 'storage', 'storage', 'storage', 'storage', 'storage' | ||||
]; | ]; | ||||
$this->assertUserEntitlements($john, $expected); | $this->assertEntitlements($john, $expected); | ||||
$browser->visit('/user/' . $john->id) | $browser->visit('/user/' . $john->id) | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->waitFor('#sku-input-beta') | ->waitFor('#sku-input-beta') | ||||
->click('#sku-input-beta') | ->click('#sku-input-beta') | ||||
->click('@general button[type=submit]') | ->click('@general button[type=submit]') | ||||
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ||||
$expected = [ | $expected = [ | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage' | 'storage', 'storage', 'storage', 'storage', 'storage' | ||||
]; | ]; | ||||
$this->assertUserEntitlements($john, $expected); | $this->assertEntitlements($john, $expected); | ||||
}); | }); | ||||
// TODO: Test that the Distlist SKU is not available for users that aren't a group account owners | // TODO: Test that the Distlist SKU is not available for users that aren't a group account owners | ||||
// TODO: Test that entitlements change has immediate effect on the available items in dashboard | // TODO: Test that entitlements change has immediate effect on the available items in dashboard | ||||
// i.e. does not require a page reload nor re-login. | // i.e. does not require a page reload nor re-login. | ||||
} | } | ||||
} | } |