Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/UserTest.php
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | class UserTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test user info page (continue) | * Test user info page (continue) | ||||
* | * | ||||
* @depends testUserInfo | * @depends testUserInfo | ||||
*/ | */ | ||||
public function testUserInfo2(): void | public function testUserInfo2(): void | ||||
{ | { | ||||
\App\Policy\Greylist\Setting::where('key', 'greylist_enabled')->delete(); | |||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$page = new UserPage($john->id); | $page = new UserPage($john->id); | ||||
$discount = Discount::where('code', 'TEST')->first(); | $discount = Discount::where('code', 'TEST')->first(); | ||||
$wallet = $john->wallet(); | $wallet = $john->wallet(); | ||||
$wallet->discount()->associate($discount); | $wallet->discount()->associate($discount); | ||||
$wallet->debit(2010); | $wallet->debit(2010); | ||||
$wallet->save(); | $wallet->save(); | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
->assertVisible('tbody tr:nth-child(4) td:first-child svg.text-success') | ->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'); | ||||
$ned->setConfig(['greylisting' => false]); | |||||
$page = new UserPage($ned->id); | $page = new UserPage($ned->id); | ||||
$browser->click('@user-users tbody tr:nth-child(4) 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) { | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | public function testUserInfo2(): void | ||||
// We don't expect John's distribution lists here | // We don't expect John's distribution lists here | ||||
$browser->assertSeeIn('@nav #tab-distlists', 'Distribution lists (0)') | $browser->assertSeeIn('@nav #tab-distlists', 'Distribution lists (0)') | ||||
->click('@nav #tab-distlists') | ->click('@nav #tab-distlists') | ||||
->with('@user-distlists', function (Browser $browser) { | ->with('@user-distlists', function (Browser $browser) { | ||||
$browser->assertElementsCount('table tbody tr', 0) | $browser->assertElementsCount('table tbody tr', 0) | ||||
->assertSeeIn('table tfoot tr td', 'There are no distribution lists in this account.'); | ->assertSeeIn('table tfoot tr td', 'There are no distribution lists in this account.'); | ||||
}); | }); | ||||
// Assert Settings tab | |||||
$browser->assertSeeIn('@nav #tab-settings', 'Settings') | |||||
->click('@nav #tab-settings') | |||||
->whenAvailable('@user-settings form', function (Browser $browser) { | |||||
$browser->assertElementsCount('.row', 1) | |||||
->assertSeeIn('.row:first-child label', 'Greylisting') | |||||
->assertSeeIn('.row:first-child .text-danger', 'disabled'); | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test editing an external email | * Test editing an external email | ||||
* | * | ||||
* @depends testUserInfo2 | * @depends testUserInfo2 | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |