Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UsersTest.php
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | public function testNewUser(): void | ||||
->with(new ListInput('#aliases'), function (Browser $browser) { | ->with(new ListInput('#aliases'), function (Browser $browser) { | ||||
$browser->assertListInputValue([]) | $browser->assertListInputValue([]) | ||||
->assertValue('@input', ''); | ->assertValue('@input', ''); | ||||
}) | }) | ||||
->assertSeeIn('div.row:nth-child(5) label', 'Password') | ->assertSeeIn('div.row:nth-child(5) label', 'Password') | ||||
->assertValue('div.row:nth-child(5) input[type=password]', '') | ->assertValue('div.row:nth-child(5) input[type=password]', '') | ||||
->assertSeeIn('div.row:nth-child(6) label', 'Confirm 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', 'Package') | |||||
// assert packages list widget, select "Lite Account" | |||||
->with('@packages', function ($browser) { | |||||
$browser->assertElementsCount('tbody tr', 2) | |||||
->assertSeeIn('tbody tr:nth-child(1)', 'Groupware Account') | |||||
->assertSeeIn('tbody tr:nth-child(2)', 'Lite Account') | |||||
->assertChecked('tbody tr:nth-child(1) input') | |||||
->click('tbody tr:nth-child(2) input') | |||||
->assertNotChecked('tbody tr:nth-child(1) input') | |||||
->assertChecked('tbody tr:nth-child(2) input'); | |||||
}) | |||||
->assertSeeIn('button[type=submit]', 'Submit'); | ->assertSeeIn('button[type=submit]', 'Submit'); | ||||
// Test browser-side required fields and error handling | // Test browser-side required fields and error handling | ||||
$browser->click('button[type=submit]') | $browser->click('button[type=submit]') | ||||
->assertFocused('#email') | ->assertFocused('#email') | ||||
->type('#email', 'invalid email') | ->type('#email', 'invalid email') | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->assertFocused('#password') | ->assertFocused('#password') | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | public function testNewUser(): void | ||||
$browser->assertToastTitle('') | $browser->assertToastTitle('') | ||||
->assertToastMessage('User created successfully') | ->assertToastMessage('User created successfully') | ||||
->closeToast(); | ->closeToast(); | ||||
}) | }) | ||||
// check redirection to users list | // check redirection to users list | ||||
->waitForLocation('/users') | ->waitForLocation('/users') | ||||
->on(new UserList()) | ->on(new UserList()) | ||||
->whenAvailable('@table', function (Browser $browser) { | ->whenAvailable('@table', function (Browser $browser) { | ||||
// TODO: This will not work until we handle entitlements on user creation | $browser->assertElementsCount('tbody tr', 4) | ||||
// $browser->assertElementsCount('tbody tr', 3) | ->assertSeeIn('tbody tr:nth-child(3) a', 'julia.roberts@kolab.org'); | ||||
// ->assertSeeIn('tbody tr:nth-child(3) a', 'julia.roberts@kolab.org'); | |||||
}); | }); | ||||
$julia = User::where('email', 'julia.roberts@kolab.org')->first(); | $julia = User::where('email', 'julia.roberts@kolab.org')->first(); | ||||
$alias = UserAlias::where('user_id', $julia->id)->where('alias', 'julia.roberts2@kolab.org')->first(); | $alias = UserAlias::where('user_id', $julia->id)->where('alias', 'julia.roberts2@kolab.org')->first(); | ||||
$this->assertTrue(!empty($alias)); | $this->assertTrue(!empty($alias)); | ||||
$this->assertUserEntitlements($julia, ['mailbox', 'storage', 'storage']); | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test user delete | * Test user delete | ||||
* | * | ||||
* @depends testNewUser | * @depends testNewUser | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |