Skip to content

Commit

Permalink
Improve tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
EreMaijala committed Aug 16, 2023
1 parent 9f8b32e commit cb4c669
Showing 1 changed file with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,28 @@ 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');

$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()
);
}

/**
Expand Down Expand Up @@ -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());
}

/**
Expand Down

0 comments on commit cb4c669

Please sign in to comment.