4 use BookStack\Entities\Book;
6 class ActivityTrackingTest extends BrowserKitTest
9 public function test_recently_viewed_books()
11 $books = Book::all()->take(10);
13 $this->asAdmin()->visit('/books')
14 ->dontSeeInElement('#recents', $books[0]->name)
15 ->dontSeeInElement('#recents', $books[1]->name)
16 ->visit($books[0]->getUrl())
17 ->visit($books[1]->getUrl())
19 ->seeInElement('#recents', $books[0]->name)
20 ->seeInElement('#recents', $books[1]->name);
23 public function test_popular_books()
25 $books = Book::all()->take(10);
27 $this->asAdmin()->visit('/books')
28 ->dontSeeInElement('#popular', $books[0]->name)
29 ->dontSeeInElement('#popular', $books[1]->name)
30 ->visit($books[0]->getUrl())
31 ->visit($books[1]->getUrl())
32 ->visit($books[0]->getUrl())
34 ->seeInNthElement('#popular .book', 0, $books[0]->name)
35 ->seeInNthElement('#popular .book', 1, $books[1]->name);