Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/DomainTest.php
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | public function testDomainListUnauth(): void | ||||
// Test that the page requires authentication | // Test that the page requires authentication | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
$browser->visit('/domains')->on(new Home()); | $browser->visit('/domains')->on(new Home()); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain info page (non-existing domain id) | * Test domain info page (non-existing domain id) | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainInfo404(): void | 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') | ||||
->assertErrorPage(404); | ->assertErrorPage(404); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain info page (existing domain) | * Test domain info page (existing domain) | ||||
* | * | ||||
* @depends testDomainInfo404 | * @depends testDomainInfo404 | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainInfo(): void | public function testDomainInfo(): void | ||||
{ | { | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
// Unconfirmed domain | // Unconfirmed domain | ||||
$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; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public function testDomainInfo(): void | ||||
->on(new DomainInfo()) | ->on(new DomainInfo()) | ||||
->assertMissing('@verify') | ->assertMissing('@verify') | ||||
->assertPresent('@config'); | ->assertPresent('@config'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain settings | * Test domain settings | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainSettings(): void | public function testDomainSettings(): void | ||||
{ | { | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
$domain = Domain::where('namespace', 'kolab.org')->first(); | $domain = Domain::where('namespace', 'kolab.org')->first(); | ||||
$domain->setSetting('spf_whitelist', \json_encode(['.test.com'])); | $domain->setSetting('spf_whitelist', \json_encode(['.test.com'])); | ||||
$browser->visit('/domain/' . $domain->id) | $browser->visit('/domain/' . $domain->id) | ||||
Show All 27 Lines | public function testDomainSettings(): void | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domains list page | * Test domains list page | ||||
* | * | ||||
* @depends testDomainListUnauth | * @depends testDomainListUnauth | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainList(): void | public function testDomainList(): void | ||||
{ | { | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
// Login the user | // Login the user | ||||
$browser->visit('/login') | $browser->visit('/login') | ||||
->on(new Home()) | ->on(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123', true) | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | /* | ||||
->assertMissing('@table tbody') | ->assertMissing('@table tbody') | ||||
->assertSeeIn('tfoot td', 'There are no domains in this account.'); | ->assertSeeIn('tfoot td', 'There are no domains in this account.'); | ||||
*/ | */ | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain creation page | * Test domain creation page | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainCreate(): void | public function testDomainCreate(): void | ||||
{ | { | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
$browser->visit('/login') | $browser->visit('/login') | ||||
->on(new Home()) | ->on(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123', true) | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
->visit('/domains') | ->visit('/domains') | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | public function testDomainCreate(): void | ||||
->assertToast(Toast::TYPE_SUCCESS, 'Domain created successfully.') | ->assertToast(Toast::TYPE_SUCCESS, 'Domain created successfully.') | ||||
->on(new DomainList()) | ->on(new DomainList()) | ||||
->assertSeeIn('@table tr:nth-child(2) a', 'testdomain.com'); | ->assertSeeIn('@table tr:nth-child(2) a', 'testdomain.com'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domain deletion | * Test domain deletion | ||||
* @group skipci | |||||
*/ | */ | ||||
public function testDomainDelete(): void | public function testDomainDelete(): void | ||||
{ | { | ||||
// Create the domain to delete | // Create the domain to delete | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$domain = $this->getTestDomain('testdomain.com', ['type' => Domain::TYPE_EXTERNAL]); | $domain = $this->getTestDomain('testdomain.com', ['type' => Domain::TYPE_EXTERNAL]); | ||||
$packageDomain = \App\Package::withEnvTenantContext()->where('title', 'domain-hosting')->first(); | $packageDomain = \App\Package::withEnvTenantContext()->where('title', 'domain-hosting')->first(); | ||||
$domain->assignPackage($packageDomain, $john); | $domain->assignPackage($packageDomain, $john); | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |