Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/DomainTest.php
<?php | <?php | ||||
namespace Tests\Browser; | namespace Tests\Browser; | ||||
use App\Domain; | use App\Domain; | ||||
use App\User; | use App\User; | ||||
use Tests\Browser; | use Tests\Browser; | ||||
use Tests\Browser\Components\Error; | |||||
use Tests\Browser\Components\Toast; | use Tests\Browser\Components\Toast; | ||||
use Tests\Browser\Pages\Dashboard; | use Tests\Browser\Pages\Dashboard; | ||||
use Tests\Browser\Pages\DomainInfo; | use Tests\Browser\Pages\DomainInfo; | ||||
use Tests\Browser\Pages\DomainList; | use Tests\Browser\Pages\DomainList; | ||||
use Tests\Browser\Pages\Home; | use Tests\Browser\Pages\Home; | ||||
use Tests\DuskTestCase; | use Tests\DuskTestCase; | ||||
use Illuminate\Foundation\Testing\DatabaseMigrations; | use Illuminate\Foundation\Testing\DatabaseMigrations; | ||||
Show All 19 Lines | public function testDomainInfo404(): void | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
// FIXME: I couldn't make loginAs() method working | // FIXME: I couldn't make loginAs() method working | ||||
// Note: Here we're also testing that unauthenticated request | // Note: Here we're also testing that unauthenticated request | ||||
// is passed to logon form and then "redirected" to the requested page | // is passed to logon form and then "redirected" to the requested page | ||||
$browser->visit('/domain/123') | $browser->visit('/domain/123') | ||||
->on(new Home()) | ->on(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123') | ->submitLogon('john@kolab.org', 'simple123') | ||||
// TODO: the check below could look simpler, but we can't | ->assertErrorPage(404); | ||||
// just remove the callback argument. We'll create | |||||
// Browser wrapper in future, then we could create expectError() method | |||||
->with(new Error('404'), function ($browser) { | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain info page (existing domain) | * Test domain info page (existing domain) | ||||
* | * | ||||
* @depends testDomainInfo404 | * @depends testDomainInfo404 | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | public function testDomainList(): void | ||||
->assertSeeIn('@table tbody tr:first-child td:first-child', 'kolab.org') | ->assertSeeIn('@table tbody tr:first-child td:first-child', 'kolab.org') | ||||
->click('@table tbody tr:first-child td:first-child a') | ->click('@table tbody tr:first-child td:first-child a') | ||||
// On Domain Info page verify that's the clicked domain | // On Domain Info page verify that's the clicked domain | ||||
->on(new DomainInfo()) | ->on(new DomainInfo()) | ||||
->whenAvailable('@config', function ($browser) { | ->whenAvailable('@config', function ($browser) { | ||||
$browser->assertSeeIn('pre', 'kolab.org'); | $browser->assertSeeIn('pre', 'kolab.org'); | ||||
}); | }); | ||||
}); | }); | ||||
// TODO: Test domains list acting as Ned (John's "delegatee") | |||||
} | } | ||||
} | } |