2017-02-04 06:58:42 -05:00
|
|
|
<?php namespace Tests;
|
2015-12-02 15:22:41 -05:00
|
|
|
|
|
|
|
|
2020-11-21 19:17:45 -05:00
|
|
|
use BookStack\Entities\Models\Book;
|
2018-09-25 07:30:50 -04:00
|
|
|
|
2017-01-25 14:35:40 -05:00
|
|
|
class ActivityTrackingTest extends BrowserKitTest
|
2015-12-02 15:22:41 -05:00
|
|
|
{
|
|
|
|
|
2016-01-15 18:21:47 -05:00
|
|
|
public function test_recently_viewed_books()
|
2015-12-02 15:22:41 -05:00
|
|
|
{
|
2018-09-25 07:30:50 -04:00
|
|
|
$books = Book::all()->take(10);
|
2015-12-02 15:22:41 -05:00
|
|
|
|
|
|
|
$this->asAdmin()->visit('/books')
|
|
|
|
->dontSeeInElement('#recents', $books[0]->name)
|
|
|
|
->dontSeeInElement('#recents', $books[1]->name)
|
|
|
|
->visit($books[0]->getUrl())
|
|
|
|
->visit($books[1]->getUrl())
|
|
|
|
->visit('/books')
|
|
|
|
->seeInElement('#recents', $books[0]->name)
|
|
|
|
->seeInElement('#recents', $books[1]->name);
|
|
|
|
}
|
|
|
|
|
2016-01-15 18:21:47 -05:00
|
|
|
public function test_popular_books()
|
2015-12-02 15:22:41 -05:00
|
|
|
{
|
2018-09-25 07:30:50 -04:00
|
|
|
$books = Book::all()->take(10);
|
2015-12-02 15:22:41 -05:00
|
|
|
|
|
|
|
$this->asAdmin()->visit('/books')
|
|
|
|
->dontSeeInElement('#popular', $books[0]->name)
|
|
|
|
->dontSeeInElement('#popular', $books[1]->name)
|
|
|
|
->visit($books[0]->getUrl())
|
|
|
|
->visit($books[1]->getUrl())
|
|
|
|
->visit($books[0]->getUrl())
|
|
|
|
->visit('/books')
|
|
|
|
->seeInNthElement('#popular .book', 0, $books[0]->name)
|
|
|
|
->seeInNthElement('#popular .book', 1, $books[1]->name);
|
|
|
|
}
|
|
|
|
}
|