Skip to content

Commit

Permalink
Update ::clickOnDetail
Browse files Browse the repository at this point in the history
Update ::clickOnDetail to resolve compatibility issues with the Claro theme.
  • Loading branch information
vincent-gao committed Sep 11, 2024
1 parent 673b7fe commit 47a990c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/behat/bootstrap/TideCommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@ public function clickOnHorzTab(string $text) {
*/
public function clickOnDetail(string $text) {
$page = $this->getSession()->getPage();
$link = $page->find('xpath', '//div[contains(@class, "details-wrapper")]/details/summary[text()="' . $text . '"]');
if ($link === NULL) {
$link = $page->find('xpath', '//div[contains(@class, "details-wrapper")]/details/summary/span[text()="' . $text . '"]');
if ($link === NULL) {
throw new \Exception('The detail with text "' . $text . '" not found.');
}
$xpath = sprintf('//details/summary[contains(normalize-space(.), "%s")]', $text);
$element = $page->find('xpath', $xpath);
if (!$element) {
throw new \Exception(sprintf('The detail with text "%s" was not found on the page.', $text));
}
$link->click();
if (!$element->isVisible()) {
throw new \Exception(sprintf('The detail with text "%s" was found but is not visible.', $text));
}
$element->click();
}

/**
Expand Down

0 comments on commit 47a990c

Please sign in to comment.