Add more in-browser tests

pull/7135/head
Aleksander Machniak 5 years ago
parent a88798ab18
commit 895b6f54f3

@ -14,7 +14,7 @@ class Login extends DuskTestCase
public function testLogin()
{
// first test, we're already on the login page
// First test, we're already on the logon page
$this->browse(function ($browser) {
$browser->visit('/');
@ -23,8 +23,19 @@ class Login extends DuskTestCase
// task should be set to 'login'
$this->assertEnvEquals('task', 'login');
// Logon form
$browser->assertVisible('#logo');
$browser->assertVisible('#login-form');
$browser->assertVisible('#rcmloginuser');
$browser->assertVisible('#rcmloginpwd');
$browser->assertVisible('#rcmloginsubmit');
$browser->assertSee($this->app->config->get('product_name'));
// Support link
if ($url = $this->app->config->get('support_url')) {
$browser->assertSeeLink('Get support');
$this->assertStringStartsWith($url, $browser->attribute('.support-link', 'href'));
}
// test valid login
$this->go('mail');

@ -7,13 +7,21 @@ class About extends \Tests\Browser\DuskTestCase
public function testAbout()
{
$this->browse(function ($browser) {
$this->go('settings', 'about');
$this->go('settings');
// check task and action
$this->assertEnvEquals('task', 'settings');
$this->assertEnvEquals('action', 'about');
$browser->click('#taskmenu a.about');
$browser->assertVisible('#pluginlist');
$browser->assertSeeIn('.ui-dialog-title', 'About');
$browser->assertVisible('.ui-dialog #aboutframe');
$browser->withinFrame('#aboutframe', function ($browser) {
// check task and action
$this->assertEnvEquals('task', 'settings');
$this->assertEnvEquals('action', 'about');
$browser->assertSee($this->app->config->get('product_name'));
$browser->assertVisible('#pluginlist');
});
});
}
}

@ -18,6 +18,16 @@ class Folders extends \Tests\Browser\DuskTestCase
// these objects should be there always
$this->assertContains('quotadisplay', $objects);
$this->assertContains('subscriptionlist', $objects);
$browser->assertVisible('#settings-menu li.folders.selected');
// Folders list
$browser->assertVisible('#subscription-table li.mailbox.inbox');
// Toolbar menu
$browser->assertVisible('#toolbar-menu a.create:not(.disabled)');
$browser->assertVisible('#toolbar-menu a.delete.disabled');
$browser->assertVisible('#toolbar-menu a.purge.disabled');
});
}
}

@ -17,6 +17,16 @@ class Identities extends \Tests\Browser\DuskTestCase
// these objects should be there always
$this->assertContains('identitieslist', $objects);
$browser->assertVisible('#settings-menu li.identities.selected');
// Identities list
$browser->assertVisible('#identities-table tr:first-child.focused');
$browser->assertSeeIn('#identities-table tr:first-child td.mail', TESTS_USER);
// Toolbar menu
$browser->assertVisible('#toolbar-menu a.create:not(.disabled)');
$browser->assertVisible('#toolbar-menu a.delete.disabled');
});
}
}

@ -0,0 +1,29 @@
<?php
namespace Tests\Browser\Settings;
class Preferences extends \Tests\Browser\DuskTestCase
{
public function testPreferences()
{
$this->browse(function ($browser) {
$this->go('settings');
$objects = $this->getObjects();
$this->assertContains('sectionslist', $objects);
$browser->assertVisible('#settings-menu li.preferences.selected');
// Preferences actions
$browser->assertVisible('#sections-table');
$browser->assertSeeIn('#sections-table tr.general', 'User Interface');
$browser->assertSeeIn('#sections-table tr.mailbox', 'Mailbox View');
$browser->assertSeeIn('#sections-table tr.mailview', 'Displaying Messages');
$browser->assertSeeIn('#sections-table tr.compose', 'Composing Messages');
$browser->assertSeeIn('#sections-table tr.addressbook', 'Contacts');
$browser->assertSeeIn('#sections-table tr.folders', 'Special Folders');
$browser->assertSeeIn('#sections-table tr.server', 'Server Settings');
});
}
}

@ -0,0 +1,32 @@
<?php
namespace Tests\Browser\Settings;
class Responses extends \Tests\Browser\DuskTestCase
{
public function testIdentities()
{
$this->browse(function ($browser) {
$this->go('settings', 'responses');
// check task and action
$this->assertEnvEquals('task', 'settings');
$this->assertEnvEquals('action', 'responses');
$objects = $this->getObjects();
// these objects should be there always
$this->assertContains('responseslist', $objects);
$browser->assertVisible('#settings-menu li.responses.selected');
// Responses list
$browser->assertPresent('#responses-table');
$browser->assertMissing('#responses-table tr');
// Toolbar menu
$browser->assertVisible('#toolbar-menu a.create:not(.disabled)');
$browser->assertVisible('#toolbar-menu a.delete.disabled');
});
}
}

@ -12,9 +12,14 @@ class Settings extends \Tests\Browser\DuskTestCase
// task should be set to 'settings'
$this->assertEnvEquals('task', 'settings');
$objects = $this->getObjects();
$browser->assertSeeIn('#layout-sidebar .header', 'Settings');
$this->assertContains('sectionslist', $objects);
// Sidebar menu
$browser->assertVisible('#settings-menu');
$browser->assertSeeIn('#settings-menu li.preferences', 'Preferences');
$browser->assertSeeIn('#settings-menu li.folders', 'Folders');
$browser->assertSeeIn('#settings-menu li.identities', 'Identities');
$browser->assertSeeIn('#settings-menu li.responses', 'Responses');
});
}
}

@ -11,10 +11,12 @@
<file>Addressbook/Import.php</file>
</testsuite>
<testsuite name="Settings">
<file>Settings/About.php</file>
<file>Settings/Settings.php</file>
<file>Settings/Preferences.php</file>
<file>Settings/Folders.php</file>
<file>Settings/Identities.php</file>
<file>Settings/Settings.php</file>
<file>Settings/Responses.php</file>
<file>Settings/About.php</file>
</testsuite>
<testsuite name="Mail">
<file>Mail/Mail.php</file>

Loading…
Cancel
Save