Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | public function testInfo(): void | ||||
// Test subscriptions | // Test subscriptions | ||||
$browser->with('@form', function (Browser $browser) { | $browser->with('@form', 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', '4,44 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') | ||||
->assertDisabled('tbody tr:nth-child(1) td.selection input') | ->assertDisabled('tbody tr:nth-child(1) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(1) td.buttons button', | 'tbody tr:nth-child(1) td.buttons button', | ||||
'Just a mailbox' | 'Just a mailbox' | ||||
) | ) | ||||
// Storage SKU | // Storage SKU | ||||
->assertSeeIn('tbody tr:nth-child(2) td.name', 'Storage Quota') | ->assertSeeIn('tbody tr:nth-child(2) td.name', 'Storage Quota') | ||||
->assertSeeIn('tr:nth-child(2) td.price', '0,00 CHF/month') | ->assertSeeIn('tr:nth-child(2) td.price', '0,00 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(2) td.selection input') | ->assertChecked('tbody tr:nth-child(2) td.selection input') | ||||
->assertDisabled('tbody tr:nth-child(2) td.selection input') | ->assertDisabled('tbody tr:nth-child(2) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(2) td.buttons button', | 'tbody tr:nth-child(2) td.buttons button', | ||||
'Some wiggle room' | 'Some wiggle room' | ||||
) | ) | ||||
->with(new QuotaInput('tbody tr:nth-child(2) .range-input'), function ($browser) { | ->with(new QuotaInput('tbody tr:nth-child(2) .range-input'), function ($browser) { | ||||
$browser->assertQuotaValue(2)->setQuotaValue(3); | $browser->assertQuotaValue(2)->setQuotaValue(3); | ||||
}) | }) | ||||
->assertSeeIn('tr:nth-child(2) td.price', '0,25 CHF/month') | ->assertSeeIn('tr:nth-child(2) td.price', '0,25 CHF/month') | ||||
// groupware SKU | // groupware SKU | ||||
->assertSeeIn('tbody tr:nth-child(3) td.name', 'Groupware Features') | ->assertSeeIn('tbody tr:nth-child(3) td.name', 'Groupware Features') | ||||
->assertSeeIn('tbody tr:nth-child(3) td.price', '5,55 CHF/month') | ->assertSeeIn('tbody tr:nth-child(3) td.price', '4,90 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(3) td.selection input') | ->assertChecked('tbody tr:nth-child(3) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(3) td.selection input') | ->assertEnabled('tbody tr:nth-child(3) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(3) td.buttons button', | 'tbody tr:nth-child(3) td.buttons button', | ||||
'Groupware functions like Calendar, Tasks, Notes, etc.' | 'Groupware functions like Calendar, Tasks, Notes, etc.' | ||||
) | ) | ||||
// ActiveSync SKU | // ActiveSync SKU | ||||
->assertSeeIn('tbody tr:nth-child(4) td.name', 'Activesync') | ->assertSeeIn('tbody tr:nth-child(4) td.name', 'Activesync') | ||||
->assertSeeIn('tbody tr:nth-child(4) td.price', '1,00 CHF/month') | ->assertSeeIn('tbody tr:nth-child(4) td.price', '0,00 CHF/month') | ||||
->assertNotChecked('tbody tr:nth-child(4) td.selection input') | ->assertNotChecked('tbody tr:nth-child(4) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(4) td.selection input') | ->assertEnabled('tbody tr:nth-child(4) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
'tbody tr:nth-child(4) td.buttons button', | 'tbody tr:nth-child(4) td.buttons button', | ||||
'Mobile synchronization' | 'Mobile synchronization' | ||||
) | ) | ||||
// 2FA SKU | // 2FA SKU | ||||
->assertSeeIn('tbody tr:nth-child(5) td.name', '2-Factor Authentication') | ->assertSeeIn('tbody tr:nth-child(5) td.name', '2-Factor Authentication') | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | public function testNewUser(): void | ||||
->assertSeeIn('div.row:nth-child(7) label', 'Confirm Password') | ->assertSeeIn('div.row:nth-child(7) label', 'Confirm Password') | ||||
->assertValue('div.row:nth-child(7) input[type=password]', '') | ->assertValue('div.row:nth-child(7) input[type=password]', '') | ||||
->assertSeeIn('div.row:nth-child(8) label', 'Package') | ->assertSeeIn('div.row:nth-child(8) label', 'Package') | ||||
// assert packages list widget, select "Lite Account" | // assert packages list widget, select "Lite Account" | ||||
->with('@packages', function ($browser) { | ->with('@packages', function ($browser) { | ||||
$browser->assertElementsCount('tbody tr', 2) | $browser->assertElementsCount('tbody tr', 2) | ||||
->assertSeeIn('tbody tr:nth-child(1)', 'Groupware Account') | ->assertSeeIn('tbody tr:nth-child(1)', 'Groupware Account') | ||||
->assertSeeIn('tbody tr:nth-child(2)', 'Lite Account') | ->assertSeeIn('tbody tr:nth-child(2)', 'Lite Account') | ||||
->assertSeeIn('tbody tr:nth-child(1) .price', '9,99 CHF/month') | ->assertSeeIn('tbody tr:nth-child(1) .price', '9,90 CHF/month') | ||||
->assertSeeIn('tbody tr:nth-child(2) .price', '4,44 CHF/month') | ->assertSeeIn('tbody tr:nth-child(2) .price', '5,00 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(1) input') | ->assertChecked('tbody tr:nth-child(1) input') | ||||
->click('tbody tr:nth-child(2) input') | ->click('tbody tr:nth-child(2) input') | ||||
->assertNotChecked('tbody tr:nth-child(1) input') | ->assertNotChecked('tbody tr:nth-child(1) input') | ||||
->assertChecked('tbody tr:nth-child(2) input'); | ->assertChecked('tbody tr:nth-child(2) input'); | ||||
}) | }) | ||||
->assertMissing('@packages table + .hint') | ->assertMissing('@packages table + .hint') | ||||
->assertSeeIn('button[type=submit]', 'Submit'); | ->assertSeeIn('button[type=submit]', 'Submit'); | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | public function testDiscountedPrices(): void | ||||
->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('@form', 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', '3,99 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¹') | ||||
->with($quota_input, function (Browser $browser) { | ->with($quota_input, function (Browser $browser) { | ||||
$browser->setQuotaValue(100); | $browser->setQuotaValue(100); | ||||
}) | }) | ||||
->assertSeeIn('tr:nth-child(2) td.price', '22,05 CHF/month¹') | ->assertSeeIn('tr:nth-child(2) td.price', '22,05 CHF/month¹') | ||||
// groupware SKU | // groupware SKU | ||||
->assertSeeIn('tbody tr:nth-child(3) td.price', '4,99 CHF/month¹') | ->assertSeeIn('tbody tr:nth-child(3) td.price', '4,50 CHF/month¹') | ||||
// ActiveSync SKU | // ActiveSync SKU | ||||
->assertSeeIn('tbody tr:nth-child(4) td.price', '0,90 CHF/month¹') | ->assertSeeIn('tbody tr:nth-child(4) td.price', '0,00 CHF/month¹') | ||||
// 2FA SKU | // 2FA SKU | ||||
->assertSeeIn('tbody tr:nth-child(5) td.price', '0,00 CHF/month¹'); | ->assertSeeIn('tbody tr:nth-child(5) td.price', '0,00 CHF/month¹'); | ||||
}) | }) | ||||
->assertSeeIn('@skus table + .hint', '¹ applied discount: 10% - Test voucher'); | ->assertSeeIn('@skus table + .hint', '¹ applied discount: 10% - Test voucher'); | ||||
}); | }); | ||||
}); | }); | ||||
// 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('@form', 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,99 CHF/month¹') // Groupware | ->assertSeeIn('tbody tr:nth-child(1) .price', '8,81 CHF/month¹') // Groupware | ||||
->assertSeeIn('tbody tr:nth-child(2) .price', '3,99 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'); | ||||
}); | }); | ||||
}); | }); | ||||
// Test using entitlement cost instead of the SKU cost | // Test using entitlement cost instead of the SKU cost | ||||
$this->browse(function (Browser $browser) use ($wallet) { | $this->browse(function (Browser $browser) use ($wallet) { | ||||
$joe = User::where('email', 'joe@kolab.org')->first(); | $joe = User::where('email', 'joe@kolab.org')->first(); | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |