Skip to content

Commit

Permalink
Include dimension data in image test failure message.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Dec 3, 2024
1 parent 5292feb commit 49cdaa6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ public function testCoverLoading(
$session->visit($url);
$page = $session->getPage();
$this->waitForPageLoad($page);
$coverSelector = 'img.recordcover';
$session->wait(
$this->getDefaultTimeout(),
'document.querySelector("img.recordcover").dataset.loaded !== undefined'
"document.querySelector('$coverSelector').dataset.loaded !== undefined"
);
// Verify the expected backlink (or lack thereof):
$backlinkSelector = 'p.cover-source';
Expand All @@ -185,10 +186,13 @@ public function testCoverLoading(
$expectedClasses = 'recordcover'
. ($ajaxcovers ? ' ajax' : '')
. (empty($noCoverAvailableImage) ? ' hidden' : '');
$coverImage = $this->findCss($page, 'img.recordcover');
$coverImage = $this->findCss($page, $coverSelector);
$width = $session->evaluateScript("document.querySelector('$coverSelector').getBoundingClientRect().width");
$height = $session->evaluateScript("document.querySelector('$coverSelector').getBoundingClientRect().height");
$this->assertEquals(
$expectedClasses,
$coverImage?->getAttribute('class')
$coverImage?->getAttribute('class'),
"Unexpected classes on image of dimensions $width x $height"
);

// Verify the expected image URL:
Expand Down

0 comments on commit 49cdaa6

Please sign in to comment.