Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/DomainTest.php
<?php | <?php | ||||
namespace Tests\Browser\Admin; | namespace Tests\Browser\Admin; | ||||
use App\Discount; | use App\Domain; | ||||
use Tests\Browser; | use Tests\Browser; | ||||
use Tests\Browser\Components\Toast; | use Tests\Browser\Components\Toast; | ||||
use Tests\Browser\Pages\Admin\Domain as DomainPage; | use Tests\Browser\Pages\Admin\Domain as DomainPage; | ||||
use Tests\Browser\Pages\Admin\User as UserPage; | use Tests\Browser\Pages\Admin\User as UserPage; | ||||
use Tests\Browser\Pages\Dashboard; | use Tests\Browser\Pages\Dashboard; | ||||
use Tests\Browser\Pages\Home; | use Tests\Browser\Pages\Home; | ||||
use Tests\TestCaseDusk; | use Tests\TestCaseDusk; | ||||
use Illuminate\Foundation\Testing\DatabaseMigrations; | use Illuminate\Foundation\Testing\DatabaseMigrations; | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | public function testDomainInfo(): void | ||||
// Assert Configuration tab | // Assert Configuration tab | ||||
$browser->assertSeeIn('@nav #tab-config', 'Configuration') | $browser->assertSeeIn('@nav #tab-config', 'Configuration') | ||||
->with('@domain-config', function (Browser $browser) { | ->with('@domain-config', function (Browser $browser) { | ||||
$browser->assertSeeIn('pre#dns-verify', 'kolab-verify.kolab.org.') | $browser->assertSeeIn('pre#dns-verify', 'kolab-verify.kolab.org.') | ||||
->assertSeeIn('pre#dns-config', 'kolab.org.'); | ->assertSeeIn('pre#dns-config', 'kolab.org.'); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | |||||
* Test suspending/unsuspending a domain | |||||
* | |||||
* @depends testDomainInfo | |||||
*/ | |||||
public function testSuspendAndUnsuspend(): void | |||||
{ | |||||
$this->browse(function (Browser $browser) { | |||||
$domain = $this->getTestDomain('domainscontroller.com', [ | |||||
'status' => Domain::STATUS_NEW | Domain::STATUS_ACTIVE | |||||
| Domain::STATUS_LDAP_READY | Domain::STATUS_CONFIRMED | |||||
| Domain::STATUS_VERIFIED, | |||||
'type' => Domain::TYPE_EXTERNAL, | |||||
]); | |||||
$browser->visit(new DomainPage($domain->id)) | |||||
->assertVisible('@domain-info #button-suspend') | |||||
->assertMissing('@domain-info #button-unsuspend') | |||||
->click('@domain-info #button-suspend') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'Domain suspended successfully.') | |||||
->assertSeeIn('@domain-info #status span.text-warning', 'Suspended') | |||||
->assertMissing('@domain-info #button-suspend') | |||||
->click('@domain-info #button-unsuspend') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'Domain unsuspended successfully.') | |||||
->assertSeeIn('@domain-info #status span.text-success', 'Active') | |||||
->assertVisible('@domain-info #button-suspend') | |||||
->assertMissing('@domain-info #button-unsuspend'); | |||||
}); | |||||
} | |||||
} | } |