2014-12-04 18:20:15 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'minifluxTestCase.php';
|
|
|
|
|
|
|
|
class pageUnreadTest extends minifluxTestCase
|
|
|
|
{
|
|
|
|
const DEFAULT_COUNTER_PAGE = 6;
|
|
|
|
const DEFAULT_COUNTER_UNREAD = 6;
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
public function setUpPage()
|
|
|
|
{
|
|
|
|
$url = $this->getURLPageUnread();
|
2015-01-04 22:25:28 +01:00
|
|
|
$this->doLoginIfRequired($url);
|
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedPageUrl = $url;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Miniflux Title could be localized
|
|
|
|
public function getExpectedPageTitle()
|
|
|
|
{
|
|
|
|
return "Miniflux ($this->expectedCounterPage)";
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testItemsFromAllFeeds()
|
|
|
|
{
|
|
|
|
$articles = $this->getArticlesNotFromFeedOne();
|
|
|
|
$this->assertNotEmpty($articles, 'no articles from other feeds found');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
|
|
|
}
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
public function testOnlyUnreadArticles()
|
|
|
|
{
|
|
|
|
$articles = $this->getArticlesRead();
|
|
|
|
$this->assertEmpty($articles, 'found read articles.');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMarkReadNotBookmarkedArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadNotBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkReadStatusToogle($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$visible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($visible, 'article is is not invisible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMarkReadNotBookmarkedArticleKeyboard()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadNotBookmarked();
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->setArticleAsCurrentArticle($article);
|
|
|
|
$this->keys($this->getShortcutToogleReadStatus());
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$visible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($visible, 'article is is not invisible');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
|
|
|
|
}
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
public function testMarkReadBookmarkedArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkReadStatusToogle($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$visible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($visible, 'article is is not invisible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMarkReadBookmarkedArticleKeyboard()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadBookmarked();
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->setArticleAsCurrentArticle($article);
|
|
|
|
$this->keys($this->getShortcutToogleReadStatus());
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$visible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($visible, 'article is is not invisible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testBookmarkUnreadArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadNotBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkBookmarkStatusToogle($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$visible = $this->waitForIconBookmarkVisible($article);
|
|
|
|
$this->assertTrue($visible, 'bookmark icon is not visible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testBookmarkUnreadArticleKeyboard()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadNotBookmarked();
|
|
|
|
|
|
|
|
$this->setArticleAsCurrentArticle($article);
|
|
|
|
$this->keys($this->getShortcutToogleBookmarkStatus());
|
|
|
|
|
|
|
|
$visible = $this->waitForIconBookmarkVisible($article);
|
|
|
|
$this->assertTrue($visible, 'bookmark icon is not visible');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testUnbookmarkUnreadArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkBookmarkStatusToogle($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$invisible = $this->waitForIconBookmarkInvisible($article);
|
|
|
|
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testUnbookmarkUnreadArticleKeyboard()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadBookmarked();
|
|
|
|
|
|
|
|
$this->setArticleAsCurrentArticle($article);
|
|
|
|
$this->keys($this->getShortcutToogleBookmarkStatus());
|
|
|
|
|
|
|
|
$invisible = $this->waitForIconBookmarkInvisible($article);
|
|
|
|
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRemoveUnreadNotBookmarkedArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadNotBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkRemove($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$invisible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($invisible, 'article is is not invisible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRemoveUnreadBookmarkedArticleLink()
|
|
|
|
{
|
|
|
|
$article = $this->getArticleUnreadBookmarked();
|
|
|
|
|
|
|
|
$link = $this->getLinkRemove($article);
|
|
|
|
$link->click();
|
|
|
|
|
|
|
|
$invisible = $this->waitForArticleInvisible($article);
|
|
|
|
$this->assertTrue($invisible, 'article is is not invisible');
|
|
|
|
|
|
|
|
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
|
|
|
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
|
|
|
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
|
|
|
|
}
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
public function testMarkAllReadHeaderLink()
|
|
|
|
{
|
|
|
|
$link = $this->getLinkMarkAllReadHeader();
|
|
|
|
$link->click();
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$read = $this->waitForArticlesMarkRead();
|
|
|
|
$this->assertTrue($read, 'there are still unread articles');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-11-15 14:32:31 +01:00
|
|
|
$this->expectedCounterPage = NULL;
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterUnread = '';
|
|
|
|
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
|
|
|
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->ignorePageTitle = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMarkAllReadBottomLink()
|
|
|
|
{
|
|
|
|
$link = $this->getLinkMarkAllReadBottom();
|
|
|
|
$link->click();
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$read = $this->waitForArticlesMarkRead();
|
|
|
|
$this->assertTrue($read, 'there are still unread articles');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-11-15 14:32:31 +01:00
|
|
|
$this->expectedCounterPage = NULL;
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterUnread = '';
|
|
|
|
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
|
|
|
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->ignorePageTitle = TRUE;
|
|
|
|
}
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
public function testRedirectWithZeroArticles()
|
|
|
|
{
|
|
|
|
$articles = $this->getArticles();
|
|
|
|
$this->assertGreaterThanOrEqual(1, count($articles), 'no articles found');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
foreach($articles as $article) {
|
|
|
|
$link = $this->getLinkReadStatusToogle($article);
|
|
|
|
$link->click();
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->waitForArticleInvisible($article);
|
|
|
|
}
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$visible = $this->waitForAlert();
|
|
|
|
$this->assertTrue($visible, 'alert box did not appear');
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-11-15 14:32:31 +01:00
|
|
|
$this->expectedCounterPage = NULL;
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->expectedCounterUnread = '';
|
|
|
|
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
|
|
|
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
2015-01-04 22:25:28 +01:00
|
|
|
|
2014-12-04 18:20:15 +01:00
|
|
|
$this->ignorePageTitle = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|