Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/DomainTest.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | class DomainTest extends TestCaseDusk | ||||
{ | { | ||||
// Test that the page requires authentication | // Test that the page requires authentication | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
$browser->visit('/domain/123')->on(new Home()); | $browser->visit('/domain/123')->on(new Home()); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domains list page (unauthenticated) | |||||
*/ | |||||
public function testDomainListUnauth(): void | |||||
{ | |||||
// Test that the page requires authentication | |||||
$this->browse(function ($browser) { | |||||
$browser->visit('/domains')->on(new Home()); | |||||
}); | |||||
} | |||||
/** | |||||
* Test domain info page (non-existing domain id) | * Test domain info page (non-existing domain id) | ||||
*/ | */ | ||||
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 | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | public function testDomainSettings(): void | ||||
}) | }) | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->assertToast(Toast::TYPE_SUCCESS, 'Domain settings updated successfully.'); | ->assertToast(Toast::TYPE_SUCCESS, 'Domain settings updated successfully.'); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test domains list page (unauthenticated) | |||||
*/ | |||||
public function testDomainListUnauth(): void | |||||
{ | |||||
// Test that the page requires authentication | |||||
$this->browse(function ($browser) { | |||||
$browser->visit('/logout') | |||||
->visit('/domains') | |||||
->on(new Home()); | |||||
}); | |||||
} | |||||
/** | |||||
* Test domains list page | * Test domains list page | ||||
* | * | ||||
* @depends testDomainListUnauth | * @depends testDomainListUnauth | ||||
*/ | */ | ||||
public function testDomainList(): void | public function testDomainList(): void | ||||
{ | { | ||||
$this->browse(function ($browser) { | $this->browse(function ($browser) { | ||||
// Login the user | // Login the user | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | */ | ||||
/** | /** | ||||
* Test domain creation page | * Test domain creation page | ||||
*/ | */ | ||||
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') | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
->visit('/domains') | ->visit('/domains') | ||||
->on(new DomainList()) | ->on(new DomainList()) | ||||
->assertSeeIn('.card-title button.btn-success', 'Create domain') | ->assertSeeIn('.card-title button.btn-success', 'Create domain') | ||||
->click('.card-title button.btn-success') | ->click('.card-title button.btn-success') | ||||
->on(new DomainInfo()) | ->on(new DomainInfo()) | ||||
->assertSeeIn('.card-title', 'New domain') | ->assertSeeIn('.card-title', 'New domain') | ||||
->assertElementsCount('@nav li', 1) | ->assertElementsCount('@nav li', 1) | ||||
->assertSeeIn('@nav li:first-child', 'General') | ->assertSeeIn('@nav li:first-child', 'General') | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |