Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 760 Lines • ▼ Show 20 Lines | public function testCurrency(): void | ||||
$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', '9,90 €/month') // Groupware | ->assertSeeIn('tbody tr:nth-child(1) .price', '9,90 €/month') // Groupware | ||||
->assertSeeIn('tbody tr:nth-child(2) .price', '5,00 €/month'); // Lite | ->assertSeeIn('tbody tr:nth-child(2) .price', '5,00 €/month'); // Lite | ||||
}); | }); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | |||||
* Test beta entitlements | |||||
* | |||||
* @depends testInfo | |||||
*/ | |||||
public function testBetaEntitlements(): void | |||||
{ | |||||
$this->browse(function (Browser $browser) { | |||||
$john = User::where('email', 'john@kolab.org')->first(); | |||||
$sku = Sku::withEnvTenantContext()->where('title', 'beta')->first(); | |||||
$john->assignSku($sku); | |||||
$browser->visit('/user/' . $john->id) | |||||
->on(new UserInfo()) | |||||
->with('@skus', function ($browser) { | |||||
$browser->assertElementsCount('tbody tr', 10) | |||||
// Beta SKU | |||||
->assertSeeIn('tbody tr:nth-child(6) td.name', 'Private Beta (invitation only)') | |||||
->assertSeeIn('tbody tr:nth-child(6) td.price', '0,00 CHF/month') | |||||
->assertChecked('tbody tr:nth-child(6) td.selection input') | |||||
->assertEnabled('tbody tr:nth-child(6) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(6) td.buttons button', | |||||
'Access to the private beta program subscriptions' | |||||
) | |||||
// Distlists SKU | |||||
->assertSeeIn('tbody tr:nth-child(7) td.name', 'Distribution lists') | |||||
->assertSeeIn('tr:nth-child(7) td.price', '0,00 CHF/month') | |||||
->assertNotChecked('tbody tr:nth-child(7) td.selection input') | |||||
->assertEnabled('tbody tr:nth-child(7) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(7) td.buttons button', | |||||
'Access to mail distribution lists' | |||||
) | |||||
// Resources SKU | |||||
->assertSeeIn('tbody tr:nth-child(8) td.name', 'Calendaring resources') | |||||
->assertSeeIn('tr:nth-child(8) td.price', '0,00 CHF/month') | |||||
->assertNotChecked('tbody tr:nth-child(8) td.selection input') | |||||
->assertEnabled('tbody tr:nth-child(8) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(8) td.buttons button', | |||||
'Access to calendaring resources' | |||||
) | |||||
// Shared folders SKU | |||||
->scrollTo('tbody tr:nth-child(9)')->pause(250) | |||||
->assertSeeIn('tbody tr:nth-child(9) td.name', 'Shared folders') | |||||
->assertSeeIn('tr:nth-child(9) td.price', '0,00 CHF/month') | |||||
->assertNotChecked('tbody tr:nth-child(9) td.selection input') | |||||
->assertEnabled('tbody tr:nth-child(9) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(9) td.buttons button', | |||||
'Access to shared folders' | |||||
) | |||||
// Files SKU | |||||
->scrollTo('tbody tr:nth-child(10)')->pause(250) | |||||
->assertSeeIn('tbody tr:nth-child(10) td.name', 'File storage') | |||||
->assertSeeIn('tr:nth-child(10) td.price', '0,00 CHF/month') | |||||
->assertNotChecked('tbody tr:nth-child(10) td.selection input') | |||||
->assertEnabled('tbody tr:nth-child(10) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(10) td.buttons button', | |||||
'Access to file storage' | |||||
) | |||||
// Check Distlist, Uncheck Beta, expect Distlist unchecked | |||||
->click('#sku-input-beta-distlists') | |||||
->click('#sku-input-beta') | |||||
->assertNotChecked('#sku-input-beta') | |||||
->assertNotChecked('#sku-input-beta-distlists') | |||||
// Click Distlists expect an alert | |||||
->click('#sku-input-beta-distlists') | |||||
->assertDialogOpened('Distribution lists requires Private Beta (invitation only).') | |||||
->acceptDialog() | |||||
// Enable Beta and Distlist and submit | |||||
->click('#sku-input-beta') | |||||
->click('#sku-input-beta-distlists'); | |||||
}) | |||||
->scrollTo('@general button[type=submit]') | |||||
->click('@general button[type=submit]') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | |||||
$expected = [ | |||||
'beta', | |||||
'beta-distlists', | |||||
'groupware', | |||||
'mailbox', | |||||
'storage', 'storage', 'storage', 'storage', 'storage' | |||||
]; | |||||
$this->assertEntitlements($john, $expected); | |||||
$browser->visit('/user/' . $john->id) | |||||
->on(new UserInfo()) | |||||
->waitFor('#sku-input-beta') | |||||
->click('#sku-input-beta') | |||||
->scrollTo('@general button[type=submit]')->pause(500) | |||||
->click('@general button[type=submit]') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.'); | |||||
$expected = [ | |||||
'groupware', | |||||
'mailbox', | |||||
'storage', 'storage', 'storage', 'storage', 'storage' | |||||
]; | |||||
$this->assertEntitlements($john, $expected); | |||||
}); | |||||
// TODO: Test that the Distlists 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 | |||||
// i.e. does not require a page reload nor re-login. | |||||
} | |||||
} | } |