Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/ResourceTest.php
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function testList(): void | ||||
// Log on the user | // Log on the user | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Home()) | $browser->visit(new Home()) | ||||
->submitLogon('john@kolab.org', 'simple123', true) | ->submitLogon('john@kolab.org', 'simple123', true) | ||||
->on(new Dashboard()) | ->on(new Dashboard()) | ||||
->assertMissing('@links .link-resources'); | ->assertMissing('@links .link-resources'); | ||||
}); | }); | ||||
// Test that Resources lists page is not accessible without the 'beta-resources' entitlement | // Test that Resources lists page is not accessible without the 'beta' entitlement | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit('/resources') | $browser->visit('/resources') | ||||
->assertErrorPage(403); | ->assertErrorPage(403); | ||||
}); | }); | ||||
// Add beta+beta-resources entitlements | // Add beta entitlements | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-resources'); | $this->addBetaEntitlement($john); | ||||
// Make sure the first resource is active | // Make sure the first resource is active | ||||
$resource = $this->getTestResource('resource-test1@kolab.org'); | $resource = $this->getTestResource('resource-test1@kolab.org'); | ||||
$resource->status = Resource::STATUS_NEW | Resource::STATUS_ACTIVE | $resource->status = Resource::STATUS_NEW | Resource::STATUS_ACTIVE | ||||
| Resource::STATUS_LDAP_READY | Resource::STATUS_IMAP_READY; | | Resource::STATUS_LDAP_READY | Resource::STATUS_IMAP_READY; | ||||
$resource->save(); | $resource->save(); | ||||
// Test resources lists page | // Test resources lists page | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
Show All 16 Lines | class ResourceTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test resource creation/editing/deleting | * Test resource creation/editing/deleting | ||||
* | * | ||||
* @depends testList | * @depends testList | ||||
*/ | */ | ||||
public function testCreateUpdateDelete(): void | public function testCreateUpdateDelete(): void | ||||
{ | { | ||||
// Test that the page is not available accessible without the 'beta-resources' entitlement | // Test that the page is not available accessible without the 'beta' entitlement | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit('/resource/new') | $browser->visit('/resource/new') | ||||
->assertErrorPage(403); | ->assertErrorPage(403); | ||||
}); | }); | ||||
// Add beta+beta-resource entitlements | // Add beta entitlements | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-resources'); | $this->addBetaEntitlement($john); | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
// Create a resource | // Create a resource | ||||
$browser->visit(new ResourceList()) | $browser->visit(new ResourceList()) | ||||
->assertSeeIn('button.resource-new', 'Create resource') | ->assertSeeIn('button.resource-new', 'Create resource') | ||||
->click('button.resource-new') | ->click('button.resource-new') | ||||
->on(new ResourceInfo()) | ->on(new ResourceInfo()) | ||||
->assertSeeIn('#resource-info .card-title', 'New resource') | ->assertSeeIn('#resource-info .card-title', 'New resource') | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | class ResourceTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test resource status | * Test resource status | ||||
* | * | ||||
* @depends testList | * @depends testList | ||||
*/ | */ | ||||
public function testStatus(): void | public function testStatus(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-resources'); | $this->addBetaEntitlement($john); | ||||
$resource = $this->getTestResource('resource-test2@kolab.org'); | $resource = $this->getTestResource('resource-test2@kolab.org'); | ||||
$resource->status = Resource::STATUS_NEW | Resource::STATUS_ACTIVE | Resource::STATUS_LDAP_READY; | $resource->status = Resource::STATUS_NEW | Resource::STATUS_ACTIVE | Resource::STATUS_LDAP_READY; | ||||
$resource->created_at = \now(); | $resource->created_at = \now(); | ||||
$resource->save(); | $resource->save(); | ||||
$this->assertFalse($resource->isImapReady()); | $this->assertFalse($resource->isImapReady()); | ||||
$this->browse(function ($browser) use ($resource) { | $this->browse(function ($browser) use ($resource) { | ||||
Show All 20 Lines | class ResourceTest extends TestCaseDusk | ||||
} | } | ||||
/** | /** | ||||
* Test resource settings | * Test resource settings | ||||
*/ | */ | ||||
public function testSettings(): void | public function testSettings(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-resources'); | $this->addBetaEntitlement($john); | ||||
$resource = $this->getTestResource('resource-test2@kolab.org'); | $resource = $this->getTestResource('resource-test2@kolab.org'); | ||||
$resource->setSetting('invitation_policy', null); | $resource->setSetting('invitation_policy', null); | ||||
$this->browse(function ($browser) use ($resource) { | $this->browse(function ($browser) use ($resource) { | ||||
// Test auto-refresh | // Test auto-refresh | ||||
$browser->visit('/resource/' . $resource->id) | $browser->visit('/resource/' . $resource->id) | ||||
->on(new ResourceInfo()) | ->on(new ResourceInfo()) | ||||
->assertSeeIn('@nav #tab-general', 'General') | ->assertSeeIn('@nav #tab-general', 'General') | ||||
Show All 39 Lines |