Add flaky tags & retry in specs (#12750)

This commit is contained in:
Mac Siri 2021-02-22 11:20:16 -05:00 committed by GitHub
parent 18129f2cb2
commit 60be1d6def
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View file

@ -115,6 +115,10 @@ RSpec.configure do |config|
allow(Search::Client).to receive(:index).and_return({ "_source" => {} })
end
config.around(:each, :flaky) do |ex|
ex.run_with_retry retry: 3
end
config.around(:each, elasticsearch_reset: true) do |example|
Search::Cluster.recreate_indexes
example.run

View file

@ -7,7 +7,7 @@ RSpec.describe Articles::Suggest, type: :service do
expect(described_class.call(article).size).to eq(4)
end
it "returns proper number of articles with post with different tags" do
it "returns proper number of articles with post with different tags", :flaky do
create_list(:article, 2, featured: true, tags: ["discuss"], score: 10)
create_list(:article, 2, featured: true, tags: ["javascript"])
article = create(:article, featured: true, tags: ["discuss"])

View file

@ -16,7 +16,7 @@ RSpec.describe "Creating an article with the editor", type: :system do
sign_in user
end
it "creates a new article", js: true, retry: 3 do
it "creates a new article", :flaky, js: true do
visit new_path
fill_in "article_body_markdown", with: template
click_button "Save changes"

View file

@ -14,7 +14,7 @@ RSpec.describe "User visits podcast show page", type: :system, js: true do
expect(result).to be false
end
it "they see the content of the hero", js: true, retry: 3 do
it "they see the content of the hero", :flaky, js: true do
visit podcast_episode.path.to_s
expect(page).to have_text(podcast_episode.title)