docbrown/spec/system/search/display_comments_search_spec.rb
Alex 393ba00221
Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606)
* Attempt number 1

* Fix rack_attack specs

* Fix users_searches_users spec

* Fix display_users_search_spec

* Fix comment typo

* Remove search:destroy task from cypress

* Remove port 9300 from gitpod

* Stub response in attack_spec
2021-05-03 11:09:45 -04:00

14 lines
540 B
Ruby

require "rails_helper"
RSpec.describe "Display articles search spec", type: :system, js: true do
it "returns correct results for a search" do
query = "<marquee='alert(document.cookie)'>XSS"
create(:comment, body_markdown: query)
url_encoded_query = CGI.escape(query)
visit "/search?q=#{url_encoded_query}&filters=class_name:Comment"
expect(page.find(".crayons-story__snippet")["innerHTML"])
.to eq("…<mark>marquee</mark>='<mark>alert</mark>(<mark>document.cookie</mark>)'&gt;<mark>XSS</mark>…")
end
end