Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F174685
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/.ci/config-test.inc.php b/.ci/config-test.inc.php
index 7d0002891..d7bb8039b 100644
--- a/.ci/config-test.inc.php
+++ b/.ci/config-test.inc.php
@@ -1,25 +1,25 @@
<?php
$config = array();
// Database configuration
$config['db_dsnw'] = 'sqlite:////tmp/sqlite.db?mode=0646';
// Test user credentials
$config['tests_username'] = 'test';
$config['tests_password'] = 'test';
// GreenMail
$config['smtp_port'] = 25;
// Settings required by the tests
$config['create_default_folders'] = true;
$config['skin'] = 'elastic';
$config['support_url'] = 'http://support.url';
// Plugins with tests
-$config['plugins'] = ['archive', 'zipdownload'];
+$config['plugins'] = ['archive', 'markasjunk', 'zipdownload'];
$config['archive_mbox'] = 'Archive';
diff --git a/plugins/markasjunk/tests/Browser/MailTest.php b/plugins/markasjunk/tests/Browser/MailTest.php
new file mode 100644
index 000000000..b06af7c40
--- /dev/null
+++ b/plugins/markasjunk/tests/Browser/MailTest.php
@@ -0,0 +1,134 @@
+<?php
+
+namespace Tests\Browser\Plugins\Markasjunk;
+
+use Tests\Browser\Components\Popupmenu;
+
+class MailTest extends \Tests\Browser\TestCase
+{
+ public static function setUpBeforeClass()
+ {
+ \bootstrap::init_db();
+ \bootstrap::init_imap();
+ \bootstrap::purge_mailbox('INBOX');
+ \bootstrap::purge_mailbox('Junk');
+
+ // import single email message
+ \bootstrap::import_message(TESTS_DIR . 'data/mail/list_00.eml', 'INBOX');
+ }
+
+ /**
+ * Test plugin functionality in Mail UI
+ */
+ public function testMailUI()
+ {
+ $this->browse(function ($browser) {
+ $browser->go('mail');
+
+ // Toolbar menu (Spam button inactive)
+ $browser->assertToolbarMenu([], ['junk']);
+
+ $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->ctrlClick('tr:last-child');
+ });
+
+ $browser->clickToolbarMenuItem('junk')
+ ->waitForMessage('confirmation', 'Successfully reported as junk')
+ ->closeMessage('confirmation')
+ ->assertElementsCount('#messagelist tbody tr', 0) // empty list
+ ->waitForMessage('confirmation', 'Message(s) moved successfully.')
+ ->closeMessage('confirmation');
+
+ if (!$browser->isDesktop()) {
+ $browser->click('.back-sidebar-button');
+ }
+
+ // Folders list
+ $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->assertSeeIn('li.mailbox.junk .unreadcount', '1')
+ ->assertMissing('li.mailbox.inbox .unreadcount')
+ ->click('li.mailbox.junk')
+ ->waitUntilNotBusy();
+ });
+
+ // Toolbar menu (Non-Junk button inactive)
+ $browser->assertToolbarMenu([], ['notjunk']);
+
+ // Messages list contains the moved message
+ $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->assertElementsCount('tr', 1)
+ ->ctrlClick('tr:last-child');
+ });
+
+ $browser->clickToolbarMenuItem('notjunk')
+ ->waitForMessage('confirmation', 'Successfully reported as not junk')
+ ->closeMessage('confirmation')
+ ->assertElementsCount('#messagelist tbody tr', 0) // empty list
+ ->waitForMessage('confirmation', 'Message(s) moved successfully.')
+ ->closeMessage('confirmation');
+
+ if (!$browser->isDesktop()) {
+ $browser->click('.back-sidebar-button');
+ }
+
+ // Folders list, the message is back in INBOX
+ $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->assertMissing('li.mailbox.junk .unreadcount')
+ ->assertSeeIn('li.mailbox.inbox .unreadcount', '1')
+ ->click('li.mailbox.inbox')
+ ->waitUntilNotBusy();
+ });
+
+ // Messages list contains the moved message
+ $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->assertElementsCount('tr', 1);
+ });
+ });
+ }
+
+ /**
+ * Test plugin functionality on email preview page
+ *
+ * @depends testMailUI
+ */
+ public function testMailView()
+ {
+ $this->browse(function ($browser) {
+ $browser->go('mail');
+
+ $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->mouseover('tr:last-child')->doubleClick();
+ });
+
+ $browser->waitFor('#message-content');
+
+ // Toolbar menu (Junk button active), click it
+ $browser->clickToolbarMenuItem('junk')
+ ->waitFor('#messagelist')
+ ->waitUntilNotBusy()
+ ->assertElementsCount('#messagelist tbody tr', 0); // empty list
+
+ if (!$browser->isDesktop()) {
+ $browser->click('.back-sidebar-button');
+ }
+
+ // Folders list
+ $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->click('li.mailbox.junk')
+ ->waitUntilNotBusy();
+ });
+
+ $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->mouseover('tr:last-child')->doubleClick();
+ });
+
+ $browser->waitFor('#message-content');
+
+ // Toolbar menu (Junk button active), click it
+ $browser->clickToolbarMenuItem('notjunk')
+ ->waitFor('#messagelist')
+ ->waitUntilNotBusy()
+ ->assertElementsCount('#messagelist tbody tr', 0); // empty list
+ });
+ }
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jan 18, 11:50 PM (13 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120039
Default Alt Text
(5 KB)
Attached To
Mode
R3 roundcubemail
Attached
Detach File
Event Timeline
Log In to Comment