Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/StatusTest.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | class StatusTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test account status in the Dashboard | * Test account status in the Dashboard | ||||
*/ | */ | ||||
public function testDashboard(): void | public function testDashboard(): void | ||||
{ | { | ||||
// Unconfirmed domain and user | // Unconfirmed domain and user | ||||
$domain = Domain::where('namespace', 'kolab.org')->first(); | $domain = Domain::where('namespace', 'kolab.org')->first(); | ||||
if ($domain->isConfirmed()) { | if ($domain->isConfirmed()) { | ||||
$domain->status ^= Domain::STATUS_CONFIRMED; | $domain->status ^= Domain::STATUS_CONFIRMED; | ||||
$domain->save(); | $domain->save(); | ||||
} | } | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$john->created_at = Carbon::now(); | $john->created_at = Carbon::now(); | ||||
if ($john->isImapReady()) { | if ($john->isImapReady()) { | ||||
$john->status ^= User::STATUS_IMAP_READY; | $john->status ^= User::STATUS_IMAP_READY; | ||||
} | } | ||||
$john->save(); | $john->save(); | ||||
$this->browse(function ($browser) use ($john, $domain) { | $this->browse(function ($browser) use ($john, $domain) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123', true) | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->with(new Status(), function ($browser) use ($john) { | ->with(new Status(), function ($browser) use ($john) { | ||||
$browser->assertSeeIn('@body', 'We are preparing your account') | $browser->assertSeeIn('@body', 'We are preparing your account') | ||||
Show All 33 Lines | public function testDashboard(): void | ||||
$browser->waitUntilMissing('@status', 10); | $browser->waitUntilMissing('@status', 10); | ||||
}); | }); | ||||
// Test the Refresh button | // Test the Refresh button | ||||
if ($domain->isConfirmed()) { | if ($domain->isConfirmed()) { | ||||
$domain->status ^= Domain::STATUS_CONFIRMED; | $domain->status ^= Domain::STATUS_CONFIRMED; | ||||
$domain->save(); | $domain->save(); | ||||
} | } | ||||
$john->created_at = Carbon::now()->subSeconds(3600); | $john->created_at = Carbon::now()->subSeconds(3600); | ||||
if ($john->isImapReady()) { | if ($john->isImapReady()) { | ||||
$john->status ^= User::STATUS_IMAP_READY; | $john->status ^= User::STATUS_IMAP_READY; | ||||
} | } | ||||
$john->save(); | $john->save(); | ||||
$this->browse(function ($browser) use ($john, $domain) { | $this->browse(function ($browser) use ($john, $domain) { | ||||
$browser->visit(new Dashboard()) | $browser->visit(new Dashboard()) | ||||
->with(new Status(), function ($browser) use ($john, $domain) { | ->with(new Status(), function ($browser) use ($john, $domain) { | ||||
$browser->assertSeeIn('@body', 'We are preparing your account') | $browser->assertSeeIn('@body', 'We are preparing your account') | ||||
->assertProgress(71, 'Creating a mailbox...', 'failed') | ->assertProgress(71, 'Creating a mailbox...', 'failed') | ||||
->assertVisible('@refresh-button') | ->assertVisible('@refresh-button') | ||||
Show All 20 Lines | class StatusTest extends TestCaseDusk | ||||
*/ | */ | ||||
public function testDomainStatus(): void | public function testDomainStatus(): void | ||||
{ | { | ||||
$domain = Domain::where('namespace', 'kolab.org')->first(); | $domain = Domain::where('namespace', 'kolab.org')->first(); | ||||
$domain->created_at = Carbon::now(); | $domain->created_at = Carbon::now(); | ||||
$domain->status = Domain::STATUS_NEW | Domain::STATUS_ACTIVE | Domain::STATUS_LDAP_READY; | $domain->status = Domain::STATUS_NEW | Domain::STATUS_ACTIVE | Domain::STATUS_LDAP_READY; | ||||
$domain->save(); | $domain->save(); | ||||
// side-step | |||||
$this->assertFalse($domain->isNew()); | |||||
$this->assertTrue($domain->isActive()); | |||||
$this->assertTrue($domain->isLdapReady()); | |||||
$this->assertTrue($domain->isExternal()); | |||||
$this->assertFalse($domain->isHosted()); | |||||
$this->assertFalse($domain->isConfirmed()); | |||||
$this->assertFalse($domain->isVerified()); | |||||
$this->assertFalse($domain->isSuspended()); | |||||
$this->assertFalse($domain->isDeleted()); | |||||
$this->browse(function ($browser) use ($domain) { | $this->browse(function ($browser) use ($domain) { | ||||
// Test auto-refresh | // Test auto-refresh | ||||
$browser->on(new Dashboard()) | $browser->on(new Dashboard()) | ||||
->click('@links a.link-domains') | ->click('@links a.link-domains') | ||||
->on(new DomainList()) | ->on(new DomainList()) | ||||
->waitFor('@table tbody tr') | ->waitFor('@table tbody tr') | ||||
// Assert domain status icon | // Assert domain status icon | ||||
->assertVisible('@table tbody tr:first-child td:first-child svg.fa-globe.text-danger') | ->assertVisible('@table tbody tr:first-child td:first-child svg.fa-globe.text-danger') | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |