Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | class UsersTest extends TestCaseDusk | ||||
*/ | */ | ||||
public function testInfo(): void | public function testInfo(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->on(new UserList()) | $browser->on(new UserList()) | ||||
->click('@table tr:nth-child(3) a') | ->click('@table tr:nth-child(3) a') | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->assertSeeIn('#user-info .card-title', 'User account') | ->assertSeeIn('#user-info .card-title', 'User account') | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
// Assert form content | // Assert form content | ||||
$browser->assertSeeIn('div.row:nth-child(1) label', 'Status') | $browser->assertSeeIn('div.row:nth-child(1) label', 'Status') | ||||
->assertSeeIn('div.row:nth-child(1) #status', 'Active') | ->assertSeeIn('div.row:nth-child(1) #status', 'Active') | ||||
->assertFocused('div.row:nth-child(2) input') | ->assertFocused('div.row:nth-child(2) input') | ||||
->assertSeeIn('div.row:nth-child(2) label', 'First Name') | ->assertSeeIn('div.row:nth-child(2) label', 'First Name') | ||||
->assertValue('div.row:nth-child(2) input[type=text]', $this->profile['first_name']) | ->assertValue('div.row:nth-child(2) input[type=text]', $this->profile['first_name']) | ||||
->assertSeeIn('div.row:nth-child(3) label', 'Last Name') | ->assertSeeIn('div.row:nth-child(3) label', 'Last Name') | ||||
->assertValue('div.row:nth-child(3) input[type=text]', $this->profile['last_name']) | ->assertValue('div.row:nth-child(3) input[type=text]', $this->profile['last_name']) | ||||
Show All 18 Lines | public function testInfo(): void | ||||
->vueClear('#last_name') | ->vueClear('#last_name') | ||||
->click('button[type=submit]'); | ->click('button[type=submit]'); | ||||
}) | }) | ||||
->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()) | ||||
->assertSeeIn('#user-info .card-title', 'User account') | ->assertSeeIn('#user-info .card-title', 'User account') | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
// Test error handling (password) | // Test error handling (password) | ||||
$browser->type('#password', 'aaaaaa') | $browser->type('#password', 'aaaaaa') | ||||
->vueClear('#password_confirmation') | ->vueClear('#password_confirmation') | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->waitFor('#password + .invalid-feedback') | ->waitFor('#password + .invalid-feedback') | ||||
->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.') | ->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.') | ||||
->assertFocused('#password') | ->assertFocused('#password') | ||||
->assertToast(Toast::TYPE_ERROR, 'Form validation error'); | ->assertToast(Toast::TYPE_ERROR, 'Form validation error'); | ||||
Show All 25 Lines | public function testInfo(): void | ||||
->click('@table tr:nth-child(3) a') | ->click('@table tr:nth-child(3) a') | ||||
->on(new UserInfo()); | ->on(new UserInfo()); | ||||
$john = User::where('email', 'john@kolab.org')->first(); | $john = User::where('email', 'john@kolab.org')->first(); | ||||
$alias = UserAlias::where('user_id', $john->id)->where('alias', 'john.test@kolab.org')->first(); | $alias = UserAlias::where('user_id', $john->id)->where('alias', 'john.test@kolab.org')->first(); | ||||
$this->assertTrue(!empty($alias)); | $this->assertTrue(!empty($alias)); | ||||
// Test subscriptions | // Test subscriptions | ||||
$browser->with('@form', function (Browser $browser) { | $browser->with('@general', function (Browser $browser) { | ||||
$browser->assertSeeIn('div.row:nth-child(9) label', 'Subscriptions') | $browser->assertSeeIn('div.row:nth-child(9) label', 'Subscriptions') | ||||
->assertVisible('@skus.row:nth-child(9)') | ->assertVisible('@skus.row:nth-child(9)') | ||||
->with('@skus', function ($browser) { | ->with('@skus', function ($browser) { | ||||
$browser->assertElementsCount('tbody tr', 6) | $browser->assertElementsCount('tbody tr', 6) | ||||
// Mailbox SKU | // Mailbox SKU | ||||
->assertSeeIn('tbody tr:nth-child(1) td.name', 'User Mailbox') | ->assertSeeIn('tbody tr:nth-child(1) td.name', 'User Mailbox') | ||||
->assertSeeIn('tbody tr:nth-child(1) td.price', '5,00 CHF/month') | ->assertSeeIn('tbody tr:nth-child(1) td.price', '5,00 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(1) td.selection input') | ->assertChecked('tbody tr:nth-child(1) td.selection input') | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public function testInfo(): void | ||||
->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->assertUserEntitlements($john, $expected); | ||||
// Test subscriptions interaction | // Test subscriptions interaction | ||||
$browser->with('@form', 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') | ||||
->assertEnabled('#sku-input-activesync') | ->assertEnabled('#sku-input-activesync') | ||||
->assertNotReadonly('#sku-input-activesync') | ->assertNotReadonly('#sku-input-activesync') | ||||
// Check 'activesync', expect an alert | // Check 'activesync', expect an alert | ||||
Show All 25 Lines | class UsersTest extends TestCaseDusk | ||||
* | * | ||||
* @depends testInfo | * @depends testInfo | ||||
*/ | */ | ||||
public function testUserSettings(): void | public function testUserSettings(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$john->setSetting('greylist_enabled', null); | $john->setSetting('greylist_enabled', null); | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) use ($john) { | ||||
$browser->on(new UserInfo()) | $browser->visit('/user/' . $john->id) | ||||
->on(new UserInfo()) | |||||
->assertElementsCount('@nav a', 2) | ->assertElementsCount('@nav a', 2) | ||||
->assertSeeIn('@nav #tab-general', 'General') | ->assertSeeIn('@nav #tab-general', 'General') | ||||
->assertSeeIn('@nav #tab-settings', 'Settings') | ->assertSeeIn('@nav #tab-settings', 'Settings') | ||||
->click('@nav #tab-settings') | ->click('@nav #tab-settings') | ||||
->with('#settings form', function (Browser $browser) { | ->with('#settings form', function (Browser $browser) { | ||||
$browser->assertSeeIn('div.row:nth-child(1) label', 'Greylisting') | $browser->assertSeeIn('div.row:nth-child(1) label', 'Greylisting') | ||||
->click('div.row:nth-child(1) input[type=checkbox]:checked') | ->click('div.row:nth-child(1) input[type=checkbox]:checked') | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
Show All 12 Lines | class UsersTest extends TestCaseDusk | ||||
public function testNewUser(): void | public function testNewUser(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new UserList()) | $browser->visit(new UserList()) | ||||
->assertSeeIn('button.create-user', 'Create user') | ->assertSeeIn('button.create-user', 'Create user') | ||||
->click('button.create-user') | ->click('button.create-user') | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->assertSeeIn('#user-info .card-title', 'New user account') | ->assertSeeIn('#user-info .card-title', 'New user account') | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
// Assert form content | // Assert form content | ||||
$browser->assertFocused('div.row:nth-child(1) input') | $browser->assertFocused('div.row:nth-child(1) input') | ||||
->assertSeeIn('div.row:nth-child(1) label', 'First Name') | ->assertSeeIn('div.row:nth-child(1) label', 'First Name') | ||||
->assertValue('div.row:nth-child(1) input[type=text]', '') | ->assertValue('div.row:nth-child(1) input[type=text]', '') | ||||
->assertSeeIn('div.row:nth-child(2) label', 'Last Name') | ->assertSeeIn('div.row:nth-child(2) label', 'Last Name') | ||||
->assertValue('div.row:nth-child(2) input[type=text]', '') | ->assertValue('div.row:nth-child(2) input[type=text]', '') | ||||
->assertSeeIn('div.row:nth-child(3) label', 'Organization') | ->assertSeeIn('div.row:nth-child(3) label', 'Organization') | ||||
->assertValue('div.row:nth-child(3) input[type=text]', '') | ->assertValue('div.row:nth-child(3) input[type=text]', '') | ||||
Show All 38 Lines | public function testNewUser(): void | ||||
->type('#password_confirmation', 'simple') | ->type('#password_confirmation', 'simple') | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ||||
->assertSeeIn('#email + .invalid-feedback', 'The specified email is invalid.') | ->assertSeeIn('#email + .invalid-feedback', 'The specified email is invalid.') | ||||
->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.'); | ->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.'); | ||||
}); | }); | ||||
// Test form error handling (aliases) | // Test form error handling (aliases) | ||||
$browser->with('@form', function (Browser $browser) { | $browser->with('@general', function (Browser $browser) { | ||||
$browser->type('#email', 'julia.roberts@kolab.org') | $browser->type('#email', 'julia.roberts@kolab.org') | ||||
->type('#password_confirmation', 'simple123') | ->type('#password_confirmation', 'simple123') | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->addListEntry('invalid address'); | $browser->addListEntry('invalid address'); | ||||
}) | }) | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->assertFormError(1, 'The specified alias is invalid.', false); | $browser->assertFormError(1, 'The specified alias is invalid.', false); | ||||
}); | }); | ||||
}); | }); | ||||
// Successful account creation | // Successful account creation | ||||
$browser->with('@form', function (Browser $browser) { | $browser->with('@general', function (Browser $browser) { | ||||
$browser->type('#first_name', 'Julia') | $browser->type('#first_name', 'Julia') | ||||
->type('#last_name', 'Roberts') | ->type('#last_name', 'Roberts') | ||||
->type('#organization', 'Test Org') | ->type('#organization', 'Test Org') | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->removeListEntry(1) | $browser->removeListEntry(1) | ||||
->addListEntry('julia.roberts2@kolab.org'); | ->addListEntry('julia.roberts2@kolab.org'); | ||||
}) | }) | ||||
->click('button[type=submit]'); | ->click('button[type=submit]'); | ||||
}) | }) | ||||
->assertToast(Toast::TYPE_SUCCESS, 'User created successfully.') | ->assertToast(Toast::TYPE_SUCCESS, 'User created successfully.') | ||||
// check redirection to users list | // check redirection to users list | ||||
->on(new UserList()) | ->on(new UserList()) | ||||
->whenAvailable('@table', function (Browser $browser) { | ->whenAvailable('@table', function (Browser $browser) { | ||||
$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->assertUserEntitlements($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('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) { | ||||
$browser->assertListInputValue(['julia.roberts2@kolab.org']) | $browser->assertListInputValue(['julia.roberts2@kolab.org']) | ||||
->addListEntry('invalid address') | ->addListEntry('invalid address') | ||||
->type('.input-group:nth-child(2) input', '@kolab.org'); | ->type('.input-group:nth-child(2) input', '@kolab.org') | ||||
->keys('.input-group:nth-child(2) input', '{enter}'); | |||||
}) | }) | ||||
->click('button[type=submit]') | // TODO: Investigate why this click does not work, for now we | ||||
// submit the form with Enter key above | |||||
//->click('@general button[type=submit]') | |||||
->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ->assertToast(Toast::TYPE_ERROR, 'Form validation error') | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->assertVisible('.input-group:nth-child(2) input.is-invalid') | $browser->assertVisible('.input-group:nth-child(2) input.is-invalid') | ||||
->assertVisible('.input-group:nth-child(3) input.is-invalid') | ->assertVisible('.input-group:nth-child(3) input.is-invalid') | ||||
->type('.input-group:nth-child(2) input', 'julia.roberts3@kolab.org') | ->type('.input-group:nth-child(2) input', 'julia.roberts3@kolab.org') | ||||
->type('.input-group:nth-child(3) input', 'julia.roberts4@kolab.org'); | ->type('.input-group:nth-child(3) input', 'julia.roberts4@kolab.org') | ||||
->keys('.input-group:nth-child(3) input', '{enter}'); | |||||
}) | }) | ||||
->click('button[type=submit]') | // TODO: Investigate why this click does not work, for now we | ||||
// submit the form with Enter key above | |||||
//->click('@general button[type=submit]') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | ||||
$julia = User::where('email', 'julia.roberts@kolab.org')->first(); | $julia = User::where('email', 'julia.roberts@kolab.org')->first(); | ||||
$aliases = $julia->aliases()->orderBy('alias')->get()->pluck('alias')->all(); | $aliases = $julia->aliases()->orderBy('alias')->get()->pluck('alias')->all(); | ||||
$this->assertSame(['julia.roberts3@kolab.org', 'julia.roberts4@kolab.org'], $aliases); | $this->assertSame(['julia.roberts3@kolab.org', 'julia.roberts4@kolab.org'], $aliases); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test user delete | * Test user delete | ||||
* | * | ||||
* @depends testNewUser | * @depends testNewUser | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | public function testDiscountedPrices(): void | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit('/logout') | $browser->visit('/logout') | ||||
->on(new Home()) | ->on(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123', true) | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
->visit(new UserList()) | ->visit(new UserList()) | ||||
->waitFor('@table tr:nth-child(2)') | ->waitFor('@table tr:nth-child(2)') | ||||
->click('@table tr:nth-child(2) a') // joe@kolab.org | ->click('@table tr:nth-child(2) a') // joe@kolab.org | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
$browser->whenAvailable('@skus', function (Browser $browser) { | $browser->whenAvailable('@skus', function (Browser $browser) { | ||||
$quota_input = new QuotaInput('tbody tr:nth-child(2) .range-input'); | $quota_input = new QuotaInput('tbody tr:nth-child(2) .range-input'); | ||||
$browser->waitFor('tbody tr') | $browser->waitFor('tbody tr') | ||||
->assertElementsCount('tbody tr', 6) | ->assertElementsCount('tbody tr', 6) | ||||
// Mailbox SKU | // Mailbox SKU | ||||
->assertSeeIn('tbody tr:nth-child(1) td.price', '4,50 CHF/month¹') | ->assertSeeIn('tbody tr:nth-child(1) td.price', '4,50 CHF/month¹') | ||||
// Storage SKU | // Storage SKU | ||||
->assertSeeIn('tr:nth-child(2) td.price', '0,00 CHF/month¹') | ->assertSeeIn('tr:nth-child(2) td.price', '0,00 CHF/month¹') | ||||
Show All 12 Lines | public function testDiscountedPrices(): void | ||||
}); | }); | ||||
}); | }); | ||||
// Packages on new user page | // Packages on new user page | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new UserList()) | $browser->visit(new UserList()) | ||||
->click('button.create-user') | ->click('button.create-user') | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
$browser->whenAvailable('@packages', function (Browser $browser) { | $browser->whenAvailable('@packages', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 2) | $browser->assertElementsCount('tbody tr', 2) | ||||
->assertSeeIn('tbody tr:nth-child(1) .price', '8,91 CHF/month¹') // Groupware | ->assertSeeIn('tbody tr:nth-child(1) .price', '8,91 CHF/month¹') // Groupware | ||||
->assertSeeIn('tbody tr:nth-child(2) .price', '4,50 CHF/month¹'); // Lite | ->assertSeeIn('tbody tr:nth-child(2) .price', '4,50 CHF/month¹'); // Lite | ||||
}) | }) | ||||
->assertSeeIn('@packages table + .hint', '¹ applied discount: 10% - Test voucher'); | ->assertSeeIn('@packages table + .hint', '¹ applied discount: 10% - Test voucher'); | ||||
}); | }); | ||||
}); | }); | ||||
Show All 17 Lines | public function testDiscountedPrices(): void | ||||
'sku_id' => $storage_sku->id, | 'sku_id' => $storage_sku->id, | ||||
'cost' => 5000, | 'cost' => 5000, | ||||
'entitleable_id' => $joe->id, | 'entitleable_id' => $joe->id, | ||||
'entitleable_type' => User::class | 'entitleable_type' => User::class | ||||
]); | ]); | ||||
$browser->visit('/user/' . $joe->id) | $browser->visit('/user/' . $joe->id) | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->with('@form', function (Browser $browser) { | ->with('@general', function (Browser $browser) { | ||||
$browser->whenAvailable('@skus', function (Browser $browser) { | $browser->whenAvailable('@skus', function (Browser $browser) { | ||||
$quota_input = new QuotaInput('tbody tr:nth-child(2) .range-input'); | $quota_input = new QuotaInput('tbody tr:nth-child(2) .range-input'); | ||||
$browser->waitFor('tbody tr') | $browser->waitFor('tbody tr') | ||||
// Beta SKU | // Beta SKU | ||||
->assertSeeIn('tbody tr:nth-child(7) td.price', '45,09 CHF/month¹') | ->assertSeeIn('tbody tr:nth-child(7) td.price', '45,09 CHF/month¹') | ||||
// Storage SKU | // Storage SKU | ||||
->assertSeeIn('tr:nth-child(2) td.price', '45,00 CHF/month¹') | ->assertSeeIn('tr:nth-child(2) td.price', '45,00 CHF/month¹') | ||||
->with($quota_input, function (Browser $browser) { | ->with($quota_input, function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public function testBetaEntitlements(): void | ||||
// Click Distlist expect an alert | // Click Distlist expect an alert | ||||
->click('#sku-input-distlist') | ->click('#sku-input-distlist') | ||||
->assertDialogOpened('Distribution lists requires Private Beta (invitation only).') | ->assertDialogOpened('Distribution lists requires Private Beta (invitation only).') | ||||
->acceptDialog() | ->acceptDialog() | ||||
// Enable Beta and Distlist and submit | // Enable Beta and Distlist and submit | ||||
->click('#sku-input-beta') | ->click('#sku-input-beta') | ||||
->click('#sku-input-distlist'); | ->click('#sku-input-distlist'); | ||||
}) | }) | ||||
->click('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 = [ | ||||
'beta', | 'beta', | ||||
'distlist', | 'distlist', | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage' | 'storage', 'storage', 'storage', 'storage', 'storage' | ||||
]; | ]; | ||||
$this->assertUserEntitlements($john, $expected); | $this->assertUserEntitlements($john, $expected); | ||||
$browser->visit('/user/' . $john->id) | $browser->visit('/user/' . $john->id) | ||||
->on(new UserInfo()) | ->on(new UserInfo()) | ||||
->waitFor('#sku-input-beta') | |||||
->click('#sku-input-beta') | ->click('#sku-input-beta') | ||||
->click('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->assertUserEntitlements($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. | ||||
} | } | ||||
} | } |