Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/StatusTest.php
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | public function testDashboard(): void | ||||
// Confirm the domain and wait until the whole status box disappears | // Confirm the domain and wait until the whole status box disappears | ||||
$domain->status |= Domain::STATUS_CONFIRMED; | $domain->status |= Domain::STATUS_CONFIRMED; | ||||
$domain->save(); | $domain->save(); | ||||
// This should take less than 10 seconds | // This should take less than 10 seconds | ||||
$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') | ||||
->assertVisible('@refresh-text'); | ->assertVisible('@refresh-text'); | ||||
if ($john->refresh()->isImapReady()) { | $browser->click('@refresh-button') | ||||
$john->status ^= User::STATUS_IMAP_READY; | ->assertToast(Toast::TYPE_SUCCESS, 'Setup process has been pushed. Please wait.'); | ||||
$john->status |= User::STATUS_IMAP_READY; | |||||
$john->save(); | $john->save(); | ||||
} | |||||
$domain->status |= Domain::STATUS_CONFIRMED; | $domain->status |= Domain::STATUS_CONFIRMED; | ||||
$domain->save(); | $domain->save(); | ||||
$browser->click('@refresh-button') | |||||
->assertToast(Toast::TYPE_SUCCESS, 'Setup process finished successfully.'); | |||||
}) | }) | ||||
->assertMissing('@status'); | ->waitUntilMissing('@status', 10); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain status on domains list and domain info page | * Test domain status on domains list and domain info page | ||||
* | * | ||||
* @depends testDashboard | * @depends testDashboard | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |