From d6be9e72330af321ec48fa4e72e14cbbdb53071a Mon Sep 17 00:00:00 2001 From: "Kiet.Chan" Date: Tue, 26 Mar 2019 10:53:31 +0700 Subject: [PATCH] MDL-65137 behat: Step "I press...the app" should be able to select image --- app_behat_runtime.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app_behat_runtime.js b/app_behat_runtime.js index d88fa92b7..08ccc8c79 100644 --- a/app_behat_runtime.js +++ b/app_behat_runtime.js @@ -239,10 +239,11 @@ // Find all the Aria labels that contain this text. var exactLabelMatches = []; var anyLabelMatches = []; - findPossibleMatches('//*[@aria-label and contains(@aria-label, "' + escapedText + - '")]', function(match) { + findPossibleMatches('//*[@aria-label and contains(@aria-label, "' + escapedText + '")]' + + '| //img[@alt and contains(@alt, "' + escapedText + '")]', function(match) { // Add to array depending on if it's an exact or partial match. - if (match.getAttribute('aria-label').trim() === text) { + var attributeData = match.getAttribute('aria-label') || match.getAttribute('alt'); + if (attributeData.trim() === text) { exactLabelMatches.push(match); } else { anyLabelMatches.push(match);