From cb4c6698be68bec78ddcdb5332ab0e8e0536f740 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Wed, 16 Aug 2023 14:46:00 +0300 Subject: [PATCH] Improve tests. --- .../src/VuFindTest/Mink/BasicSearchTest.php | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicSearchTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicSearchTest.php index 7cf4787c8ee..94613b20536 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicSearchTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicSearchTest.php @@ -86,6 +86,10 @@ public function testSimpleTopPagination(): void ); $session->visit($this->getVuFindUrl() . '/Search/Results'); + $this->assertStringContainsString( + "Showing 1 - 20 results", + $this->findCss($page, '.search-stats')->getText() + ); // No prev page on first page: $this->unFindCss($page, '.search-header .pagination-simple .page-prev'); @@ -93,8 +97,17 @@ public function testSimpleTopPagination(): void $secondPage = $this->findCss($page, '.search-header .pagination-simple .page-next'); $secondPage->click(); $this->waitForPageLoad($page); - // Prev page now present: - $this->findCss($page, '.search-header .pagination-simple .page-prev'); + $this->assertStringContainsString( + "Showing 21 - 40 results", + $this->findCss($page, '.search-stats')->getText() + ); + // Prev page now present, click it: + $this->clickCss($page, '.search-header .pagination-simple .page-prev'); + $this->waitForPageLoad($page); + $this->assertStringContainsString( + "Showing 1 - 20 results", + $this->findCss($page, '.search-stats')->getText() + ); } /** @@ -124,13 +137,29 @@ public function testFullTopPagination(): void ); $session->visit($this->getVuFindUrl() . '/Search/Results'); + $this->assertStringContainsString( + "Showing 1 - 20 results", + $this->findCss($page, '.search-stats')->getText() + ); $this->assertEquals('1', $this->findCss($page, '.pagination-top li.active')->getText()); $secondPage = $this->findCss($page, '.pagination-top li', null, 1); $secondPage->find('css', 'a')->click(); $this->waitForPageLoad($page); + $this->assertStringContainsString( + "Showing 21 - 40 results", + $this->findCss($page, '.search-stats')->getText() + ); $this->assertEquals('2', $this->findCss($page, '.pagination-top li.active')->getText()); + // First page now present, click it: + $firstPage = $this->findCss($page, '.pagination-top li'); + $firstPage->find('css', 'a')->click(); + $this->assertStringContainsString( + "Showing 1 - 20 results", + $this->findCss($page, '.search-stats')->getText() + ); + $this->assertEquals('1', $this->findCss($page, '.pagination-top li.active')->getText()); } /**