Skip to content
代码片段 群组 项目
提交 d24c70ce 编辑于 作者: Harsha Muralidhar's avatar Harsha Muralidhar 提交者: Chloe Liu
浏览文件

Try to fix flaky ambiguous element error

上级 1bdab407
No related branches found
No related tags found
无相关合并请求
...@@ -611,7 +611,7 @@ export default { ...@@ -611,7 +611,7 @@ export default {
:help-popover="$options.widgetHelpPopover" :help-popover="$options.widgetHelpPopover"
:action-buttons="actionButtons" :action-buttons="actionButtons"
multi-polling multi-polling
data-qa-selector="vulnerability_report_grouped" data-testid="vulnerability-report-grouped"
@is-loading="handleIsLoading" @is-loading="handleIsLoading"
> >
<template #summary> <template #summary>
......
...@@ -21,7 +21,7 @@ def self.prepended(base) ...@@ -21,7 +21,7 @@ def self.prepended(base)
end end
view 'ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue' do view 'ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue' do
element :vulnerability_report_grouped element 'vulnerability-report-grouped'
element :sast_scan_report element :sast_scan_report
element :dependency_scan_report element :dependency_scan_report
element :container_scan_report element :container_scan_report
...@@ -117,7 +117,7 @@ def expand_license_report ...@@ -117,7 +117,7 @@ def expand_license_report
end end
def expand_vulnerability_report def expand_vulnerability_report
within_element :vulnerability_report_grouped do within_element 'vulnerability-report-grouped' do
click_element :expand_report_button unless has_content? 'Collapse' click_element :expand_report_button unless has_content? 'Collapse'
end end
end end
...@@ -125,7 +125,7 @@ def expand_vulnerability_report ...@@ -125,7 +125,7 @@ def expand_vulnerability_report
def click_vulnerability(name) def click_vulnerability(name)
# To fix the flakiness, click on the MR title after widget is expanded # To fix the flakiness, click on the MR title after widget is expanded
click_element(:title_content) click_element(:title_content)
within_element :vulnerability_report_grouped do within_element 'vulnerability-report-grouped' do
click_on name click_on name
end end
...@@ -180,18 +180,20 @@ def cancel_vulnerability_modal ...@@ -180,18 +180,20 @@ def cancel_vulnerability_modal
def has_vulnerability_report?(timeout: 60) def has_vulnerability_report?(timeout: 60)
wait_until(reload: true, max_duration: timeout, sleep_interval: 1) do wait_until(reload: true, max_duration: timeout, sleep_interval: 1) do
has_element?(:vulnerability_report_grouped, wait: 10) has_element?('vulnerability-report-grouped', wait: 10)
end end
find_element(:vulnerability_report_grouped).has_no_content?("is loading") find_element('vulnerability-report-grouped').has_no_content?("is loading")
end end
def has_vulnerability_count?(expected_count = nil) def has_vulnerability_count?(expected_count = nil)
# Match text cut off in order to find both "1 vulnerability" and "X vulnerabilities" # Match text cut off in order to find both "1 vulnerability" and "X vulnerabilities"
click_element(:title_content)
unless expected_count unless expected_count
return find_element(:vulnerability_report_grouped).has_content?(/Security scanning detected/) return find_element('vulnerability-report-grouped').has_content?(/Security scanning detected/)
end end
find_element(:vulnerability_report_grouped).has_content?(/Security scanning detected #{expected_count}( new)?( potential)? vulnerabilit/) find_element('vulnerability-report-grouped').has_content?(/Security scanning detected #{expected_count}( new)?( potential)? vulnerabilit/)
end end
def has_sast_vulnerability_count_of?(expected) def has_sast_vulnerability_count_of?(expected)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册