diff --git a/qa/qa/page/project/web_ide/vscode.rb b/qa/qa/page/project/web_ide/vscode.rb index 955a545a0a8b0f76bf96fb87f2e711bb729e27af..cacb24b07606cbae5c3f04bc24f9128f1d9a7961 100644 --- a/qa/qa/page/project/web_ide/vscode.rb +++ b/qa/qa/page/project/web_ide/vscode.rb @@ -255,17 +255,14 @@ def add_prompt_into_a_file(file_name, prompt_data) end def wait_until_code_suggestions_enabled - wait_until(max_duration: 30, message: 'Wait for Code Suggestions extension to be enabled') do + wait_until(max_duration: 30, skip_finished_loading_check_on_refresh: true, + message: 'Wait for Code Suggestions extension to be enabled') do + raise code_suggestions_error if has_code_suggestions_error? + has_code_suggestions_status?('enabled') end end - def has_code_suggestions_status?(status) - page.document.has_css?( - "#GitLab\\.gitlab-workflow\\.gl\\.status\\.code_suggestions[aria-label*=#{status.downcase}]" - ) - end - def wait_for_code_suggestion within_vscode_editor do within_file_editor do @@ -316,6 +313,22 @@ def create_item(click_item, item_name) end end end + + def code_suggestions_icon_selector(status) + "#GitLab\\.gitlab-workflow\\.gl\\.status\\.code_suggestions[aria-label*=#{status.downcase}]" + end + + def has_code_suggestions_status?(status) + page.document.has_css?(code_suggestions_icon_selector(status)) + end + + def has_code_suggestions_error? + !page.document.has_no_css?(code_suggestions_icon_selector('error')) + end + + def code_suggestions_error + page.document.find(code_suggestions_icon_selector('error'))['aria-label'] + end end end end