Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/UserTest.php
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | public function testUserInfo(): void | ||||
->assertSeeIn('.row:nth-child(3) #status span.text-success', 'Active') | ->assertSeeIn('.row:nth-child(3) #status span.text-success', 'Active') | ||||
->assertSeeIn('.row:nth-child(4) label', 'First name') | ->assertSeeIn('.row:nth-child(4) label', 'First name') | ||||
->assertSeeIn('.row:nth-child(4) #first_name', 'Jack') | ->assertSeeIn('.row:nth-child(4) #first_name', 'Jack') | ||||
->assertSeeIn('.row:nth-child(5) label', 'Last name') | ->assertSeeIn('.row:nth-child(5) label', 'Last name') | ||||
->assertSeeIn('.row:nth-child(5) #last_name', 'Daniels') | ->assertSeeIn('.row:nth-child(5) #last_name', 'Daniels') | ||||
->assertSeeIn('.row:nth-child(6) label', 'External email') | ->assertSeeIn('.row:nth-child(6) label', 'External email') | ||||
->assertMissing('.row:nth-child(6) #external_email a') | ->assertMissing('.row:nth-child(6) #external_email a') | ||||
->assertSeeIn('.row:nth-child(7) label', 'Country') | ->assertSeeIn('.row:nth-child(7) label', 'Country') | ||||
->assertSeeIn('.row:nth-child(7) #country', 'United States of America'); | ->assertSeeIn('.row:nth-child(7) #country', 'United States'); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 5); | ->assertElementsCount('@nav a', 5); | ||||
// Note: Finances tab is tested in UserFinancesTest.php | // Note: Finances tab is tested in UserFinancesTest.php | ||||
$browser->assertSeeIn('@nav #tab-finances', 'Finances'); | $browser->assertSeeIn('@nav #tab-finances', 'Finances'); | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
->assertSeeIn('.row:nth-child(6) label', 'Phone') | ->assertSeeIn('.row:nth-child(6) label', 'Phone') | ||||
->assertSeeIn('.row:nth-child(6) #phone', $john->getSetting('phone')) | ->assertSeeIn('.row:nth-child(6) #phone', $john->getSetting('phone')) | ||||
->assertSeeIn('.row:nth-child(7) label', 'External email') | ->assertSeeIn('.row:nth-child(7) label', 'External email') | ||||
->assertSeeIn('.row:nth-child(7) #external_email a', $ext_email) | ->assertSeeIn('.row:nth-child(7) #external_email a', $ext_email) | ||||
->assertAttribute('.row:nth-child(7) #external_email a', 'href', "mailto:$ext_email") | ->assertAttribute('.row:nth-child(7) #external_email a', 'href', "mailto:$ext_email") | ||||
->assertSeeIn('.row:nth-child(8) label', 'Address') | ->assertSeeIn('.row:nth-child(8) label', 'Address') | ||||
->assertSeeIn('.row:nth-child(8) #billing_address', $john->getSetting('billing_address')) | ->assertSeeIn('.row:nth-child(8) #billing_address', $john->getSetting('billing_address')) | ||||
->assertSeeIn('.row:nth-child(9) label', 'Country') | ->assertSeeIn('.row:nth-child(9) label', 'Country') | ||||
->assertSeeIn('.row:nth-child(9) #country', 'United States of America'); | ->assertSeeIn('.row:nth-child(9) #country', 'United States'); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 5); | ->assertElementsCount('@nav a', 5); | ||||
// Note: Finances tab is tested in UserFinancesTest.php | // Note: Finances tab is tested in UserFinancesTest.php | ||||
$browser->assertSeeIn('@nav #tab-finances', 'Finances'); | $browser->assertSeeIn('@nav #tab-finances', 'Finances'); | ||||
Show All 28 Lines | public function testUserInfo2(): void | ||||
->with('@user-domains table', function (Browser $browser) { | ->with('@user-domains table', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 1) | $browser->assertElementsCount('tbody tr', 1) | ||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'kolab.org') | ->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'kolab.org') | ||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ||||
->assertMissing('tfoot'); | ->assertMissing('tfoot'); | ||||
}); | }); | ||||
// Assert Users tab | // Assert Users tab | ||||
$browser->assertSeeIn('@nav #tab-users', 'Users (3)') | $browser->assertSeeIn('@nav #tab-users', 'Users (4)') | ||||
->click('@nav #tab-users') | ->click('@nav #tab-users') | ||||
->with('@user-users table', function (Browser $browser) { | ->with('@user-users table', function (Browser $browser) { | ||||
$browser->assertElementsCount('tbody tr', 3) | $browser->assertElementsCount('tbody tr', 4) | ||||
->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'jack@kolab.org') | ->assertSeeIn('tbody tr:nth-child(1) td:first-child a', 'jack@kolab.org') | ||||
->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ->assertVisible('tbody tr:nth-child(1) td:first-child svg.text-success') | ||||
->assertSeeIn('tbody tr:nth-child(2) td:first-child a', 'joe@kolab.org') | ->assertSeeIn('tbody tr:nth-child(2) td:first-child a', 'joe@kolab.org') | ||||
->assertVisible('tbody tr:nth-child(2) td:first-child svg.text-success') | ->assertVisible('tbody tr:nth-child(2) td:first-child svg.text-success') | ||||
->assertSeeIn('tbody tr:nth-child(3) td:first-child a', 'ned@kolab.org') | ->assertSeeIn('tbody tr:nth-child(3) td:first-child span', 'john@kolab.org') | ||||
->assertVisible('tbody tr:nth-child(3) td:first-child svg.text-success') | ->assertVisible('tbody tr:nth-child(3) td:first-child svg.text-success') | ||||
->assertSeeIn('tbody tr:nth-child(4) td:first-child a', 'ned@kolab.org') | |||||
->assertVisible('tbody tr:nth-child(4) td:first-child svg.text-success') | |||||
->assertMissing('tfoot'); | ->assertMissing('tfoot'); | ||||
}); | }); | ||||
}); | }); | ||||
// Now we go to Ned's info page, he's a controller on John's wallet | // Now we go to Ned's info page, he's a controller on John's wallet | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$ned = $this->getTestUser('ned@kolab.org'); | $ned = $this->getTestUser('ned@kolab.org'); | ||||
$page = new UserPage($ned->id); | $page = new UserPage($ned->id); | ||||
$browser->click('@user-users tbody tr:nth-child(3) td:first-child a') | $browser->click('@user-users tbody tr:nth-child(4) td:first-child a') | ||||
->on($page); | ->on($page); | ||||
// Assert main info box content | // Assert main info box content | ||||
$browser->assertSeeIn('@user-info .card-title', $ned->email) | $browser->assertSeeIn('@user-info .card-title', $ned->email) | ||||
->with('@user-info form', function (Browser $browser) use ($ned) { | ->with('@user-info form', function (Browser $browser) use ($ned) { | ||||
$browser->assertSeeIn('.row:nth-child(2) label', 'ID (Created at)') | $browser->assertSeeIn('.row:nth-child(2) label', 'ID (Created at)') | ||||
->assertSeeIn('.row:nth-child(2) #userid', "{$ned->id} ({$ned->created_at})"); | ->assertSeeIn('.row:nth-child(2) #userid', "{$ned->id} ({$ned->created_at})"); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |