Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/DistlistTest.php
Show First 20 Lines • Show All 67 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-distlists'); | ->assertMissing('@links .link-distlists'); | ||||
}); | }); | ||||
// Test that Distribution lists page is not accessible without the 'beta-distlists' entitlement | // Test that Distribution lists page is not accessible without the 'beta' entitlement | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit('/distlists') | $browser->visit('/distlists') | ||||
->assertErrorPage(403); | ->assertErrorPage(403); | ||||
}); | }); | ||||
// Create a single group, add beta+distlist entitlements | // Create a single group, add beta entitlement | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-distlists'); | $this->addBetaEntitlement($john); | ||||
$group = $this->getTestGroup('group-test@kolab.org', ['name' => 'Test Group']); | $group = $this->getTestGroup('group-test@kolab.org', ['name' => 'Test Group']); | ||||
$group->assignToWallet($john->wallets->first()); | $group->assignToWallet($john->wallets->first()); | ||||
// Test distribution lists page | // Test distribution lists page | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new Dashboard()) | $browser->visit(new Dashboard()) | ||||
->assertSeeIn('@links .link-distlists', 'Distribution lists') | ->assertSeeIn('@links .link-distlists', 'Distribution lists') | ||||
->click('@links .link-distlists') | ->click('@links .link-distlists') | ||||
Show All 13 Lines | class DistlistTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test distlist creation/editing/deleting | * Test distlist 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-distlists' 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('/distlist/new') | $browser->visit('/distlist/new') | ||||
->assertErrorPage(403); | ->assertErrorPage(403); | ||||
}); | }); | ||||
// Add beta+distlist entitlements | // Add beta+distlist entitlements | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$this->addBetaEntitlement($john, 'beta-distlists'); | $this->addBetaEntitlement($john); | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
// Create a group | // Create a group | ||||
$browser->visit(new DistlistList()) | $browser->visit(new DistlistList()) | ||||
->assertSeeIn('button.distlist-new', 'Create list') | ->assertSeeIn('button.distlist-new', 'Create list') | ||||
->click('button.distlist-new') | ->click('button.distlist-new') | ||||
->on(new DistlistInfo()) | ->on(new DistlistInfo()) | ||||
->assertSeeIn('#distlist-info .card-title', 'New distribution list') | ->assertSeeIn('#distlist-info .card-title', 'New distribution list') | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | class DistlistTest extends TestCaseDusk | ||||
/** | /** | ||||
* Test distribution list status | * Test distribution list 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-distlists'); | $this->addBetaEntitlement($john, 'beta'); | ||||
$group = $this->getTestGroup('group-test@kolab.org'); | $group = $this->getTestGroup('group-test@kolab.org'); | ||||
$group->assignToWallet($john->wallets->first()); | $group->assignToWallet($john->wallets->first()); | ||||
$group->status = Group::STATUS_NEW | Group::STATUS_ACTIVE; | $group->status = Group::STATUS_NEW | Group::STATUS_ACTIVE; | ||||
$group->save(); | $group->save(); | ||||
$this->assertFalse($group->isLdapReady()); | $this->assertFalse($group->isLdapReady()); | ||||
$this->browse(function ($browser) use ($group) { | $this->browse(function ($browser) use ($group) { | ||||
Show All 20 Lines | class DistlistTest extends TestCaseDusk | ||||
} | } | ||||
/** | /** | ||||
* Test distribution list settings | * Test distribution list 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-distlists'); | $this->addBetaEntitlement($john); | ||||
$group = $this->getTestGroup('group-test@kolab.org'); | $group = $this->getTestGroup('group-test@kolab.org'); | ||||
$group->assignToWallet($john->wallets->first()); | $group->assignToWallet($john->wallets->first()); | ||||
$group->status = Group::STATUS_NEW | Group::STATUS_ACTIVE; | $group->status = Group::STATUS_NEW | Group::STATUS_ACTIVE; | ||||
$group->save(); | $group->save(); | ||||
$this->browse(function ($browser) use ($group) { | $this->browse(function ($browser) use ($group) { | ||||
// Test auto-refresh | // Test auto-refresh | ||||
$browser->visit('/distlist/' . $group->id) | $browser->visit('/distlist/' . $group->id) | ||||
Show All 33 Lines |