Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/DomainTest.php
Show All 22 Lines | public function setUp(): void | ||||
self::useAdminUrl(); | self::useAdminUrl(); | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$domain = $this->getTestDomain('kolab.org'); | |||||
$domain->setSetting('spf_whitelist', null); | |||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test domain info page (unauthenticated) | * Test domain info page (unauthenticated) | ||||
*/ | */ | ||||
public function testDomainUnauth(): void | public function testDomainUnauth(): void | ||||
{ | { | ||||
Show All 10 Lines | class DomainTest extends TestCaseDusk | ||||
public function testDomainInfo(): void | public function testDomainInfo(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$domain = $this->getTestDomain('kolab.org'); | $domain = $this->getTestDomain('kolab.org'); | ||||
$domain_page = new DomainPage($domain->id); | $domain_page = new DomainPage($domain->id); | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$user_page = new UserPage($john->id); | $user_page = new UserPage($john->id); | ||||
$domain->setSetting('spf_whitelist', null); | |||||
// Goto the domain page | // Goto the domain page | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ->submitLogon('jeroen@jeroen.jeroen', \App\Utils::generatePassphrase(), true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->visit($user_page) | ->visit($user_page) | ||||
->on($user_page) | ->on($user_page) | ||||
->click('@nav #tab-domains') | ->click('@nav #tab-domains') | ||||
->pause(1000) | ->pause(1000) | ||||
->click('@user-domains table tbody tr:first-child td a'); | ->click('@user-domains table tbody tr:first-child td a'); | ||||
$browser->on($domain_page) | $browser->on($domain_page) | ||||
->assertSeeIn('@domain-info .card-title', 'kolab.org') | ->assertSeeIn('@domain-info .card-title', 'kolab.org') | ||||
->with('@domain-info form', function (Browser $browser) use ($domain) { | ->with('@domain-info form', function (Browser $browser) use ($domain) { | ||||
$browser->assertElementsCount('.row', 2) | $browser->assertElementsCount('.row', 2) | ||||
->assertSeeIn('.row:nth-child(1) label', 'ID (Created)') | ->assertSeeIn('.row:nth-child(1) label', 'ID (Created)') | ||||
->assertSeeIn('.row:nth-child(1) #domainid', "{$domain->id} ({$domain->created_at})") | ->assertSeeIn('.row:nth-child(1) #domainid', "{$domain->id} ({$domain->created_at})") | ||||
->assertSeeIn('.row:nth-child(2) label', 'Status') | ->assertSeeIn('.row:nth-child(2) label', 'Status') | ||||
->assertSeeIn('.row:nth-child(2) #status span.text-success', 'Active'); | ->assertSeeIn('.row:nth-child(2) #status span.text-success', 'Active'); | ||||
}); | }); | ||||
// Some tabs are loaded in background, wait a second | // Some tabs are loaded in background, wait a second | ||||
$browser->pause(500) | $browser->pause(500) | ||||
->assertElementsCount('@nav a', 1); | ->assertElementsCount('@nav a', 2); | ||||
// 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.'); | ||||
}); | }); | ||||
// Assert Settings tab | |||||
$browser->assertSeeIn('@nav #tab-settings', 'Settings') | |||||
->click('@nav #tab-settings') | |||||
->with('@domain-settings form', function (Browser $browser) { | |||||
$browser->assertElementsCount('.row', 1) | |||||
->assertSeeIn('.row:first-child label', 'SPF Whitelist') | |||||
->assertSeeIn('.row:first-child .form-control-plaintext', 'none'); | |||||
}); | |||||
// Assert non-empty SPF whitelist | |||||
$domain->setSetting('spf_whitelist', json_encode(['.test1.com', '.test2.com'])); | |||||
$browser->refresh() | |||||
->waitFor('@nav #tab-settings') | |||||
->click('@nav #tab-settings') | |||||
->with('@domain-settings form', function (Browser $browser) { | |||||
$browser->assertSeeIn('.row:first-child .form-control-plaintext', '.test1.com, .test2.com'); | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test suspending/unsuspending a domain | * Test suspending/unsuspending a domain | ||||
* | * | ||||
* @depends testDomainInfo | * @depends testDomainInfo | ||||
*/ | */ | ||||
Show All 25 Lines |