diff --git a/app_behat_runtime.js b/app_behat_runtime.js index 354786e75..b07b53e63 100644 --- a/app_behat_runtime.js +++ b/app_behat_runtime.js @@ -306,8 +306,9 @@ var calculateNearDepth = function(node) { var depth = 0; while (node) { - if (nearAncestors.indexOf(node) !== -1) { - return depth; + var ancestorDepth = nearAncestors.indexOf(node); + if (ancestorDepth !== -1) { + return depth + ancestorDepth; } node = node.parentNode; depth++;