Skip to content

A platform for community discussion. Free, open, simple.

DEV: fixing few flakey specs in discourse-ai (#33824)

Joffrey JAFFEUX6cdba82f39b0
diff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
index 7b0b6b0c4ef..75bb2929fa0 100644
--- a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
@@ -296,8 +296,8 @@ RSpec.describe "AI Composer helper", type: :system do
wait_for { ai_suggestion_dropdown.has_dropdown? }
suggestion = category_2.name
ai_suggestion_dropdown.select_suggestion_by_name(suggestion)
- category_selector = page.find(".category-chooser summary")
- expect(category_selector["data-name"]).to eq(suggestion)
+
+ expect(page).to have_css(".category-chooser summary[data-name='#{suggestion}']")
end
end
diff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_proofreading_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_proofreading_spec.rb
index 469ab2a70a0..9b4e6166b14 100644
--- a/plugins/discourse-ai/spec/system/ai_helper/ai_proofreading_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_proofreading_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe "AI Composer Proofreading Features", type: :system do
composer.composer_input.send_keys(keyboard_shortcut)
expect(diff_modal).to have_diff("worldd", "world")
diff_modal.confirm_changes
- expect(composer.composer_input.value).to eq("hello world !")
+ expect(composer).to have_value("hello world !")
end
end
@@ -46,7 +46,7 @@ RSpec.describe "AI Composer Proofreading Features", type: :system do
composer.composer_input.send_keys(keyboard_shortcut)
expect(diff_modal).to have_diff("worrld", "world")
diff_modal.confirm_changes
- expect(composer.composer_input.value).to eq("hello world")
+ expect(composer).to have_value("hello world")
end
end