Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | 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(2) a') | ->click('@table tr:nth-child(2) 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('@form', function (Browser $browser) { | ||||
// Assert form content | // Assert form content | ||||
$browser->assertFocused('div.row:nth-child(1) input') | $browser->assertSeeIn('div.row:nth-child(1) label', 'Status') | ||||
->assertSeeIn('div.row:nth-child(1) label', 'First name') | ->assertSeeIn('div.row:nth-child(1) #status', 'Active') | ||||
->assertValue('div.row:nth-child(1) input[type=text]', $this->profile['first_name']) | ->assertFocused('div.row:nth-child(2) input') | ||||
->assertSeeIn('div.row:nth-child(2) label', 'Last name') | ->assertSeeIn('div.row:nth-child(2) label', 'First name') | ||||
->assertValue('div.row:nth-child(2) input[type=text]', $this->profile['last_name']) | ->assertValue('div.row:nth-child(2) input[type=text]', $this->profile['first_name']) | ||||
->assertSeeIn('div.row:nth-child(3) label', 'Email') | ->assertSeeIn('div.row:nth-child(3) label', 'Last name') | ||||
->assertValue('div.row:nth-child(3) input[type=text]', 'john@kolab.org') | ->assertValue('div.row:nth-child(3) input[type=text]', $this->profile['last_name']) | ||||
->assertDisabled('div.row:nth-child(3) input[type=text]') | ->assertSeeIn('div.row:nth-child(4) label', 'Email') | ||||
->assertSeeIn('div.row:nth-child(4) label', 'Email aliases') | ->assertValue('div.row:nth-child(4) input[type=text]', 'john@kolab.org') | ||||
->assertVisible('div.row:nth-child(4) .listinput-widget') | ->assertDisabled('div.row:nth-child(4) input[type=text]') | ||||
->assertSeeIn('div.row:nth-child(5) label', 'Email aliases') | |||||
->assertVisible('div.row:nth-child(5) .listinput-widget') | |||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->assertListInputValue(['john.doe@kolab.org']) | $browser->assertListInputValue(['john.doe@kolab.org']) | ||||
->assertValue('@input', ''); | ->assertValue('@input', ''); | ||||
}) | }) | ||||
->assertSeeIn('div.row:nth-child(5) label', 'Password') | ->assertSeeIn('div.row:nth-child(6) label', 'Password') | ||||
->assertValue('div.row:nth-child(5) input[type=password]', '') | |||||
->assertSeeIn('div.row:nth-child(6) label', 'Confirm password') | |||||
->assertValue('div.row:nth-child(6) input[type=password]', '') | ->assertValue('div.row:nth-child(6) input[type=password]', '') | ||||
->assertSeeIn('div.row:nth-child(7) label', 'Confirm password') | |||||
->assertValue('div.row:nth-child(7) input[type=password]', '') | |||||
->assertSeeIn('button[type=submit]', 'Submit'); | ->assertSeeIn('button[type=submit]', 'Submit'); | ||||
// Clear some fields and submit | // Clear some fields and submit | ||||
$browser->type('#first_name', '') | $browser->type('#first_name', '') | ||||
->type('#last_name', '') | ->type('#last_name', '') | ||||
->click('button[type=submit]'); | ->click('button[type=submit]'); | ||||
}) | }) | ||||
->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) { | ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) { | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | public function testInfo(): void | ||||
}); | }); | ||||
$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('@form', function (Browser $browser) { | ||||
$browser->assertSeeIn('div.row:nth-child(7) label', 'Subscriptions') | $browser->assertSeeIn('div.row:nth-child(8) label', 'Subscriptions') | ||||
->assertVisible('@skus.row:nth-child(7)') | ->assertVisible('@skus.row:nth-child(8)') | ||||
->with('@skus', function ($browser) { | ->with('@skus', function ($browser) { | ||||
$browser->assertElementsCount('tbody tr', 4) | $browser->assertElementsCount('tbody tr', 4) | ||||
// groupware SKU | // groupware SKU | ||||
->assertSeeIn('tbody tr:nth-child(1) td.name', 'Groupware Features') | ->assertSeeIn('tbody tr:nth-child(1) td.name', 'Groupware Features') | ||||
->assertSeeIn('tbody tr:nth-child(1) td.price', '5,55 CHF/month') | ->assertSeeIn('tbody tr:nth-child(1) td.price', '5,55 CHF/month') | ||||
->assertChecked('tbody tr:nth-child(1) td.selection input') | ->assertChecked('tbody tr:nth-child(1) td.selection input') | ||||
->assertEnabled('tbody tr:nth-child(1) td.selection input') | ->assertEnabled('tbody tr:nth-child(1) td.selection input') | ||||
->assertTip( | ->assertTip( | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |