Skip to content

Commit 1a6453c

Browse files
committed
Add testing for Fact Check Response - Happy Flow
Test ensures the happy flow works (fact check is correct, no changes needed) and also ensures that if the user decides to change their mind, that flow does not lose their previous selection. Flow will expand when the unhappy (fact check changes needed) path is implemented.
1 parent 4f57810 commit 1a6453c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
require "rails_helper"
2+
3+
RSpec.describe "FactCheckResponse", type: :system do
4+
before do
5+
create(:user)
6+
end
7+
8+
describe "GET /respond" do
9+
it "allows the user to confirm the changes are correct" do
10+
visit respond_path
11+
12+
expect(page).to have_text(I18n.t("fact_check_response.heading"))
13+
expect(page).to have_text(I18n.t("fact_check_response.form_heading"))
14+
expect(page).to have_text(I18n.t("fact_check_response.correct"))
15+
expect(page).to have_text(I18n.t("fact_check_response.incorrect"))
16+
expect(page).to have_button(I18n.t("fact_check_response.continue_button"))
17+
18+
choose(I18n.t("fact_check_response.correct"), allow_label_click: true)
19+
click_button(I18n.t("fact_check_response.continue_button"))
20+
21+
expect(page).to have_text(I18n.t("fact_check_verification.heading"))
22+
expect(page).to have_text(I18n.t("fact_check_verification.confirm_changes"))
23+
expect(page).to have_text(I18n.t("fact_check_response.correct"))
24+
expect(page).to have_text(I18n.t("fact_check_verification.change_link"))
25+
expect(page).to have_text(I18n.t("fact_check_verification.send_response"))
26+
expect(page).to have_text(I18n.t("fact_check_verification.send_response_warning"))
27+
expect(page).to have_button(I18n.t("fact_check_verification.confirm_button"))
28+
29+
click_button(I18n.t("fact_check_verification.confirm_button"))
30+
31+
expect(page).to have_text(I18n.t("fact_check_submitted.fact_check_submitted"))
32+
expect(page).to have_text(I18n.t("fact_check_submitted.fact_check_description"))
33+
expect(page).to have_text(I18n.t("fact_check_submitted.thank_you"))
34+
expect(page).to have_text(I18n.t("fact_check_submitted.what_happens_next"))
35+
expect(page).to have_text(I18n.t("fact_check_submitted.contact_you"))
36+
expect(page).to have_text(I18n.t("fact_check_submitted.when_changes"))
37+
expect(page).to have_text(I18n.t("fact_check_submitted.when_questions"))
38+
expect(page).to have_text(I18n.t("fact_check_submitted.what_do_you_think"))
39+
expect(page).to have_text(I18n.t("fact_check_submitted.thirty_sec"))
40+
end
41+
42+
it "allows the user to click the change link without wiping the previous selection" do
43+
visit respond_path
44+
45+
expect(page).to have_text(I18n.t("fact_check_response.heading"))
46+
expect(page).to have_text(I18n.t("fact_check_response.form_heading"))
47+
expect(page).to have_text(I18n.t("fact_check_response.correct"))
48+
expect(page).to have_text(I18n.t("fact_check_response.incorrect"))
49+
expect(page).to have_button(I18n.t("fact_check_response.continue_button"))
50+
51+
choose(I18n.t("fact_check_response.correct"), allow_label_click: true)
52+
click_button(I18n.t("fact_check_response.continue_button"))
53+
54+
expect(page).to have_text(I18n.t("fact_check_response.correct"))
55+
expect(page).to have_text(I18n.t("fact_check_verification.change_link"))
56+
57+
click_link(I18n.t("fact_check_verification.change_link"))
58+
59+
expect(page).to have_text(I18n.t("fact_check_response.heading"))
60+
expect(page).to have_text(I18n.t("fact_check_response.form_heading"))
61+
expect(page).to have_text(I18n.t("fact_check_response.correct"))
62+
expect(page).to have_text(I18n.t("fact_check_response.incorrect"))
63+
expect(page).to have_text(I18n.t("fact_check_response.continue_button"))
64+
expect(page).to have_checked_field(I18n.t("fact_check_response.correct"), visible: :all)
65+
end
66+
end
67+
end

0 commit comments

Comments
 (0)