From 28b1cb04b619707f61e21cb2e6ab21d4bff0ae5f Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 11 May 2015 08:37:30 -0400
Subject: [PATCH] Add more utility functions to prepare the IMAP account used for testing
---
tests/Selenium/Mail/Getunread.php | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/tests/Selenium/Mail/Getunread.php b/tests/Selenium/Mail/Getunread.php
index d6362f2..16b6bd1 100644
--- a/tests/Selenium/Mail/Getunread.php
+++ b/tests/Selenium/Mail/Getunread.php
@@ -2,12 +2,36 @@
class Selenium_Mail_Getunread extends Selenium_Test
{
+ protected $msgcount = 0;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ bootstrap::init_imap();
+ bootstrap::purge_mailbox('INBOX');
+
+ // import email messages
+ foreach (glob(TESTS_DIR . 'Selenium/data/mail/list_*.eml') as $f) {
+ bootstrap::import_message($f, 'INBOX');
+ $this->msgcount++;
+ }
+ }
+
public function testGetunread()
{
$this->go('mail');
$res = $this->ajaxResponse('getunread', "rcmail.http_request('getunread')");
-
$this->assertEquals('getunread', $res['action']);
+
+ $env = $this->get_env();
+ $this->assertEquals($env['unread_counts']['INBOX'], $this->msgcount);
+
+ $li = $this->byCssSelector('.folderlist li.inbox');
+ $this->assertHasClass('unread', $li);
+
+ $badge = $this->byCssSelector('.folderlist li.inbox span.unreadcount');
+ $this->assertEquals(strval($this->msgcount), $badge->text());
}
}
--
Gitblit v1.9.1