3 use Illuminate\Foundation\Testing\WithoutMiddleware;
4 use Illuminate\Foundation\Testing\DatabaseMigrations;
5 use Illuminate\Foundation\Testing\DatabaseTransactions;
7 class ActivityTrackingTest extends TestCase
10 public function testRecentlyViewedBooks()
12 $books = \BookStack\Book::all()->take(10);
14 $this->asAdmin()->visit('/books')
15 ->dontSeeInElement('#recents', $books[0]->name)
16 ->dontSeeInElement('#recents', $books[1]->name)
17 ->visit($books[0]->getUrl())
18 ->visit($books[1]->getUrl())
20 ->seeInElement('#recents', $books[0]->name)
21 ->seeInElement('#recents', $books[1]->name);
24 public function testPopularBooks()
26 $books = \BookStack\Book::all()->take(10);
28 $this->asAdmin()->visit('/books')
29 ->dontSeeInElement('#popular', $books[0]->name)
30 ->dontSeeInElement('#popular', $books[1]->name)
31 ->visit($books[0]->getUrl())
32 ->visit($books[1]->getUrl())
33 ->visit($books[0]->getUrl())
35 ->seeInNthElement('#popular .book', 0, $books[0]->name)
36 ->seeInNthElement('#popular .book', 1, $books[1]->name);