diff options
Diffstat (limited to 'spec/frontend/__helpers__/dl_locator_helper.js')
-rw-r--r-- | spec/frontend/__helpers__/dl_locator_helper.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/frontend/__helpers__/dl_locator_helper.js b/spec/frontend/__helpers__/dl_locator_helper.js index b507dcd599d..591c034be9b 100644 --- a/spec/frontend/__helpers__/dl_locator_helper.js +++ b/spec/frontend/__helpers__/dl_locator_helper.js @@ -19,10 +19,13 @@ import { createWrapper, ErrorWrapper } from '@vue/test-utils'; * @returns Wrapper */ export const findDd = (dtLabel, wrapper) => { - const dt = wrapper.findByText(dtLabel).element; - const dd = dt.nextElementSibling; - if (dt.tagName === 'DT' && dd.tagName === 'DD') { - return createWrapper(dd, {}); + const dtw = wrapper.findByText(dtLabel); + if (dtw.exists()) { + const dt = dtw.element; + const dd = dt.nextElementSibling; + if (dt.tagName === 'DT' && dd.tagName === 'DD') { + return createWrapper(dd, {}); + } } - return ErrorWrapper(dtLabel); + return new ErrorWrapper(dtLabel); }; |