Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 724 Lines • ▼ Show 20 Lines | public function testBetaEntitlements(): void | ||||
->assertSeeIn('tbody tr:nth-child(7) td.name', 'Private Beta (invitation only)') | ->assertSeeIn('tbody tr:nth-child(7) td.name', 'Private Beta (invitation only)') | ||||
->assertSeeIn('tbody tr:nth-child(7) td.price', '0,00 CHF/month') | ->assertSeeIn('tbody tr:nth-child(7) td.price', '0,00 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(7) td.selection input') | ->assertChecked('tbody tr:nth-child(7) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(7) td.selection input') | ->assertEnabled('tbody tr:nth-child(7) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(7) td.buttons button', | 'tbody tr:nth-child(7) td.buttons button', | ||||
'Access to the private beta program subscriptions' | 'Access to the private beta program subscriptions' | ||||
) | ) | ||||
// Resources SKU | // Distlists SKU | ||||
->assertSeeIn('tbody tr:nth-child(8) td.name', 'Calendaring resources') | ->assertSeeIn('tbody tr:nth-child(8) td.name', 'Distribution lists') | ||||
->assertSeeIn('tr:nth-child(8) td.price', '0,00 CHF/month') | ->assertSeeIn('tr:nth-child(8) td.price', '0,00 CHF/month') | ||||
->assertNotChecked('tbody tr:nth-child(8) td.selection input') | ->assertNotChecked('tbody tr:nth-child(8) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(8) td.selection input') | ->assertEnabled('tbody tr:nth-child(8) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(8) td.buttons button', | 'tbody tr:nth-child(8) td.buttons button', | ||||
'Access to calendaring resources' | 'Access to mail distribution lists' | ||||
) | ) | ||||
// Shared folders SKU | // Resources SKU | ||||
->assertSeeIn('tbody tr:nth-child(9) td.name', 'Shared folders') | ->assertSeeIn('tbody tr:nth-child(9) td.name', 'Calendaring resources') | ||||
->assertSeeIn('tr:nth-child(9) td.price', '0,00 CHF/month') | ->assertSeeIn('tr:nth-child(9) td.price', '0,00 CHF/month') | ||||
->assertNotChecked('tbody tr:nth-child(9) td.selection input') | ->assertNotChecked('tbody tr:nth-child(9) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(9) td.selection input') | ->assertEnabled('tbody tr:nth-child(9) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(9) td.buttons button', | 'tbody tr:nth-child(9) td.buttons button', | ||||
'Access to shared folders' | 'Access to calendaring resources' | ||||
) | ) | ||||
// Distlist SKU | // Shared folders SKU | ||||
->assertSeeIn('tbody tr:nth-child(10) td.name', 'Distribution lists') | ->assertSeeIn('tbody tr:nth-child(10) td.name', 'Shared folders') | ||||
->assertSeeIn('tr:nth-child(10) td.price', '0,00 CHF/month') | ->assertSeeIn('tr:nth-child(10) td.price', '0,00 CHF/month') | ||||
->assertNotChecked('tbody tr:nth-child(10) td.selection input') | ->assertNotChecked('tbody tr:nth-child(10) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(10) td.selection input') | ->assertEnabled('tbody tr:nth-child(10) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(10) td.buttons button', | 'tbody tr:nth-child(10) td.buttons button', | ||||
'Access to mail distribution lists' | 'Access to shared folders' | ||||
) | ) | ||||
// Check Distlist, Uncheck Beta, expect Distlist unchecked | // Check Distlist, Uncheck Beta, expect Distlist unchecked | ||||
->click('#sku-input-distlist') | ->click('#sku-input-beta-distlists') | ||||
->click('#sku-input-beta') | ->click('#sku-input-beta') | ||||
->assertNotChecked('#sku-input-beta') | ->assertNotChecked('#sku-input-beta') | ||||
->assertNotChecked('#sku-input-distlist') | ->assertNotChecked('#sku-input-beta-distlists') | ||||
// Click Distlist expect an alert | // Click Distlists expect an alert | ||||
->click('#sku-input-distlist') | ->click('#sku-input-beta-distlists') | ||||
->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-beta-distlists'); | ||||
}) | }) | ||||
->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 = [ | ||||
'beta', | 'beta', | ||||
'distlist', | 'beta-distlists', | ||||
'groupware', | 'groupware', | ||||
'mailbox', | 'mailbox', | ||||
'storage', 'storage', 'storage', 'storage', 'storage' | 'storage', 'storage', 'storage', 'storage', 'storage' | ||||
]; | ]; | ||||
$this->assertEntitlements($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->assertEntitlements($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 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 | // 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. | ||||
} | } | ||||
} | } |