Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/UserTest.php
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | class UserTest extends TestCaseDusk | ||||
*/ | */ | ||||
public function testUserInfo(): void | public function testUserInfo(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$page = new UserPage($jack->id); | $page = new UserPage($jack->id); | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('reseller@kolabnow.com', 'reseller', true) | ->submitLogon('reseller@' . \config('app.domain'), \App\Utils::generatePassphrase(), true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->visit($page) | ->visit($page) | ||||
->on($page); | ->on($page); | ||||
// Assert main info box content | // Assert main info box content | ||||
$browser->assertSeeIn('@user-info .card-title', $jack->email) | $browser->assertSeeIn('@user-info .card-title', $jack->email) | ||||
->with('@user-info form', function (Browser $browser) use ($jack) { | ->with('@user-info form', function (Browser $browser) use ($jack) { | ||||
$browser->assertElementsCount('.row', 7) | $browser->assertElementsCount('.row', 7) | ||||
Show All 30 Lines | public function testUserInfo(): void | ||||
}); | }); | ||||
// Assert Subscriptions tab | // Assert Subscriptions tab | ||||
$browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (3)') | $browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (3)') | ||||
->click('@nav #tab-subscriptions') | ->click('@nav #tab-subscriptions') | ||||
->with('@user-subscriptions', function (Browser $browser) { | ->with('@user-subscriptions', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 3) | $browser->assertElementsCount('table tbody tr', 3) | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '4,44 CHF') | ->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '5,00 CHF/month') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 2 GB') | ->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 5 GB') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF') | ->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF/month') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '5,55 CHF') | ->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '4,90 CHF/month') | ||||
->assertMissing('table tfoot') | ->assertMissing('table tfoot') | ||||
->assertMissing('#reset2fa'); | ->assertMissing('#reset2fa'); | ||||
}); | }); | ||||
// Assert Domains tab | // Assert Domains tab | ||||
$browser->assertSeeIn('@nav #tab-domains', 'Domains (0)') | $browser->assertSeeIn('@nav #tab-domains', 'Domains (0)') | ||||
->click('@nav #tab-domains') | ->click('@nav #tab-domains') | ||||
->with('@user-domains', function (Browser $browser) { | ->with('@user-domains', function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
}); | }); | ||||
// Assert Subscriptions tab | // Assert Subscriptions tab | ||||
$browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (3)') | $browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (3)') | ||||
->click('@nav #tab-subscriptions') | ->click('@nav #tab-subscriptions') | ||||
->with('@user-subscriptions', function (Browser $browser) { | ->with('@user-subscriptions', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 3) | $browser->assertElementsCount('table tbody tr', 3) | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '3,99 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '4,50 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 2 GB') | ->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 5 GB') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '4,99 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '4,41 CHF/month¹') | ||||
->assertMissing('table tfoot') | ->assertMissing('table tfoot') | ||||
->assertSeeIn('table + .hint', '¹ applied discount: 10% - Test voucher'); | ->assertSeeIn('table + .hint', '¹ applied discount: 10% - Test voucher'); | ||||
}); | }); | ||||
// Assert Domains tab | // Assert Domains tab | ||||
$browser->assertSeeIn('@nav #tab-domains', 'Domains (1)') | $browser->assertSeeIn('@nav #tab-domains', 'Domains (1)') | ||||
->click('@nav #tab-domains') | ->click('@nav #tab-domains') | ||||
->with('@user-domains table', function (Browser $browser) { | ->with('@user-domains table', function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
}); | }); | ||||
// Assert Subscriptions tab, we expect John's discount here | // Assert Subscriptions tab, we expect John's discount here | ||||
$browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (5)') | $browser->assertSeeIn('@nav #tab-subscriptions', 'Subscriptions (5)') | ||||
->click('@nav #tab-subscriptions') | ->click('@nav #tab-subscriptions') | ||||
->with('@user-subscriptions', function (Browser $browser) { | ->with('@user-subscriptions', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 5) | $browser->assertElementsCount('table tbody tr', 5) | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ->assertSeeIn('table tbody tr:nth-child(1) td:first-child', 'User Mailbox') | ||||
->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '3,99 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(1) td:last-child', '4,50 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 2 GB') | ->assertSeeIn('table tbody tr:nth-child(2) td:first-child', 'Storage Quota 5 GB') | ||||
->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(2) td:last-child', '0,00 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ->assertSeeIn('table tbody tr:nth-child(3) td:first-child', 'Groupware Features') | ||||
->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '4,99 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(3) td:last-child', '4,41 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(4) td:first-child', 'Activesync') | ->assertSeeIn('table tbody tr:nth-child(4) td:first-child', 'Activesync') | ||||
->assertSeeIn('table tbody tr:nth-child(4) td:last-child', '0,90 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(4) td:last-child', '0,00 CHF/month¹') | ||||
->assertSeeIn('table tbody tr:nth-child(5) td:first-child', '2-Factor Authentication') | ->assertSeeIn('table tbody tr:nth-child(5) td:first-child', '2-Factor Authentication') | ||||
->assertSeeIn('table tbody tr:nth-child(5) td:last-child', '0,00 CHF/month¹') | ->assertSeeIn('table tbody tr:nth-child(5) td:last-child', '0,00 CHF/month¹') | ||||
->assertMissing('table tfoot') | ->assertMissing('table tfoot') | ||||
->assertSeeIn('table + .hint', '¹ applied discount: 10% - Test voucher') | ->assertSeeIn('table + .hint', '¹ applied discount: 10% - Test voucher') | ||||
->assertSeeIn('#reset2fa', 'Reset 2-Factor Auth'); | ->assertSeeIn('#reset2fa', 'Reset 2-Factor Auth'); | ||||
}); | }); | ||||
// We don't expect John's domains here | // We don't expect John's domains here | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |