-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathquery_parameters_based_flow_test.rb
65 lines (49 loc) · 1.83 KB
/
query_parameters_based_flow_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require_relative "engine_test_helper"
class QueryParametersBasedFlowTest < EngineIntegrationTest
should "allow a user to complete a flow" do
visit "/query-parameters-based/start"
find "h1", text: "Question 1 title"
choose "Response 1"
click_on "Continue"
find "h1", text: "Question 2 title"
fill_in "response", with: "Response"
click_on "Continue"
find "h1", text: "Information based on your answers"
assert_page_has_content "Results title"
assert_current_url "/query-parameters-based/results?question1=response1&question2=Response"
end
should "provide answer validation" do
visit "/query-parameters-based/start"
find "h1", text: "Question 1 title"
click_on "Continue"
find "h1", text: "Question 1 title"
assert_page_has_content "Question 1 title"
assert_page_has_content "Please answer this question"
assert_current_url "/query-parameters-based/question1?question1="
end
should "allow changing an answer" do
visit "/query-parameters-based/start"
find "h1", text: "Question 1 title"
choose "Response 1"
click_on "Continue"
find "h1", text: "Question 2 title"
click_on "Change"
find "h1", text: "Question 1 title"
assert_page_has_content "Question 1 title"
assert_current_url "/query-parameters-based/question1?question1=response1"
end
should "allow restarting a flow" do
visit "/query-parameters-based/start"
find "h1", text: "Question 1 title"
choose "Response 1"
click_on "Continue"
find "h1", text: "Question 2 title"
fill_in "response", with: "Response"
click_on "Continue"
find "h1", text: "Information based on your answers"
click_on "Start again"
find "h1", text: "This is a test flow"
assert_page_has_content "This is a test flow"
assert_current_url "/query-parameters-based"
end
end