From fe4992854fffccc128f3200f3bb1062b290e9546 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 14 Jan 2015 14:21:33 +0800 Subject: [PATCH] MDL-48831 behat: Fixed activity show hide for label Labels are not links and have dimmed_text class So updated find query for show/hide activity check --- course/tests/behat/behat_course.php | 8 ++++++-- mod/label/tests/behat/label_visibility.feature | 0 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 mod/label/tests/behat/label_visibility.feature diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index a2d102cf458..ddc1cf60e83 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -473,7 +473,9 @@ class behat_course extends behat_base { // The activity should not be dimmed. try { - $this->find('css', 'a.dimmed', false, $activitynode); + $xpath = "/descendant-or-self::a[contains(concat(' ', normalize-space(@class), ' '), ' dimmed ')] | ". + "/descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' dimmed_text ')]"; + $this->find('xpath', $xpath, false, $activitynode); throw new ExpectationException('"' . $activityname . '" is hidden', $this->getSession()); } catch (ElementNotFoundException $e) { // All ok. @@ -501,7 +503,9 @@ class behat_course extends behat_base { // Should be hidden. $exception = new ExpectationException('"' . $activityname . '" is not dimmed', $this->getSession()); - $this->find('css', 'a.dimmed', $exception, $activitynode); + $xpath = "/descendant-or-self::a[contains(concat(' ', normalize-space(@class), ' '), ' dimmed ')] | ". + "/descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' dimmed_text ')]"; + $this->find('xpath', $xpath, $exception, $activitynode); // Also 'Show' icon. $noshowexception = new ExpectationException('"' . $activityname . '" don\'t have a "' . get_string('show') . '" icon', $this->getSession()); diff --git a/mod/label/tests/behat/label_visibility.feature b/mod/label/tests/behat/label_visibility.feature new file mode 100644 index 00000000000..e69de29bb2d