Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: praekeltfoundation/flow_tester
#ref: v0.5.0
ref: add-standalone-template-support
ref: v0.5.1
path: flow_tester
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}

Expand Down
15 changes: 15 additions & 0 deletions Onboarding/QA/tests/basic-questions_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ defmodule BasicQuestionsTest do
end
]

# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})

# The content for these tests.
assert :ok =
Helpers.import_content_csv(
Expand Down
15 changes: 15 additions & 0 deletions Onboarding/QA/tests/dma-form_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ defmodule DMAFormTest do
end
]

# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})

# The content for these tests.
assert :ok = Helpers.import_content_csv(wh_pid, "onboarding", import_opts)

Expand Down
101 changes: 59 additions & 42 deletions Onboarding/QA/tests/edd-reminders_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ defmodule EDDRemindersTest do
# These transforms are specific to these tests
end
]
# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})


# The content for these tests.
assert :ok = Helpers.import_content_csv(wh_pid, "onboarding", import_opts)
Expand Down Expand Up @@ -164,20 +179,20 @@ defmodule EDDRemindersTest do
end

describe "EDD Reminder" do
@describetag skip: "TODO: Implement support for Template CSV import etc"
test "Got it", %{flow: flow} do
flow

|> FlowTester.start()
|> receive_message(%{
# text: "[DEBUG]\r\nTemplate edd_reminder_2041 sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <> _,
text:
"[DEBUG]\r\nTemplate @body.whatsapp_template_name sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
"[DEBUG]\r\nTemplate @submission_name sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
_,
buttons: [
{"edd_got_it", "edd_got_it"},
{"edd_month", "edd_month"},
{"eddr_unknown", "eddr_unknown"}
]
# buttons: [
# {"edd_got_it", "edd_got_it"},
# {"edd_month", "edd_month"},
# {"eddr_unknown", "eddr_unknown"}
# ]
# buttons: button_labels(["Got it!", "Update due date", "How to calculate it"]),
})
|> FlowTester.send("edd_got_it")
|> receive_message(%{
Expand All @@ -191,15 +206,15 @@ defmodule EDDRemindersTest do
|> FlowTester.set_contact_properties(%{"language" => "por"})
|> FlowTester.start()
|> receive_message(%{
# text: "[DEBUG]\r\nTemplate edd_reminder_2041_pt sent with language pt_PT.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <> _,
text:
"[DEBUG]\r\nTemplate @body.whatsapp_template_name sent with language pt_PT.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <>
"[DEBUG]\r\nTemplate @submission_name sent with language pt_PT.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <>
_,
buttons: [
{"edd_got_it", "edd_got_it"},
{"edd_month", "edd_month"},
{"eddr_unknown", "eddr_unknown"}
]
# buttons: button_labels(["Got it!", "Update due date", "How to calculate it"])
# buttons: [
# {"edd_got_it", "edd_got_it"},
# {"edd_month", "edd_month"},
# {"eddr_unknown", "eddr_unknown"}
# ]
})
|> FlowTester.send("edd_got_it")
|> receive_message(%{
Expand All @@ -213,15 +228,16 @@ defmodule EDDRemindersTest do
|> FlowTester.set_contact_properties(%{"data_preference" => "text only"})
|> FlowTester.start()
|> receive_message(%{
# text: "[DEBUG]\r\nTemplate edd_reminder_2041 sent with language en_US.\r\nBody parameters: [@name]\r\n\r\nThe buttons represented" <> _,
text:
"[DEBUG]\r\nTemplate @body.whatsapp_template_name sent with language en_US.\r\nBody parameters: [@name]\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
"[DEBUG]\r\nTemplate @submission_name sent with language en_US.\r\nBody parameters: [@name]\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
_,
buttons: [
{"edd_got_it", "edd_got_it"},
{"edd_month", "edd_month"},
{"eddr_unknown", "eddr_unknown"}
]
# buttons: button_labels(["Got it!", "Month", "Unknown"]),
# buttons: button_labels(["Got it!", "Update due date", "How to calculate it"])
# buttons: [
# {"edd_got_it", "edd_got_it"},
# {"edd_month", "edd_month"},
# {"eddr_unknown", "eddr_unknown"}
# ]
})
|> FlowTester.send("edd_got_it")
|> receive_message(%{
Expand All @@ -231,33 +247,34 @@ defmodule EDDRemindersTest do
end

# TODO: Figure out why this doesn't work - it probably has something to do with the fact that we're sending a template
# test "Got it error", %{flow: flow} do
# flow
# |> FlowTester.start()
# |> receive_message(%{
# text: "[DEBUG]\r\nTemplate edd_reminder_2041 sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <> _,
# buttons: [{"edd_got_it", "edd_got_it"}, {"edd_month", "edd_month"}, {"eddr_unknown", "eddr_unknown"}],
# })
# |> FlowTester.send(button_label: "nope")
# |> receive_message(%{
# text: "I don't understand your reply.\r\n\r\n👇🏽 Please try that again and respond by tapping a button.",
# buttons: [{"edd_got_it", "edd_got_it"}, {"edd_month", "edd_month"}, {"eddr_unknown", "eddr_unknown"}],
# })
# end
test "Got it error", %{flow: flow} do
flow
|> FlowTester.start()
|> receive_message(%{
text: "[DEBUG]\r\nTemplate @submission_name sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <> _,
# buttons: button_labels(["Got it!", "Update due date", "How to calculate it"]),
# buttons: [{"edd_got_it", "edd_got_it"}, {"edd_month", "edd_month"}, {"eddr_unknown", "eddr_unknown"}],
})
|> FlowTester.send("nope")
|> receive_message(%{
text: "I don't understand your reply.\r\n\r\n👇🏽 Please try that again and respond by tapping a button.",
# buttons: button_labels(["Got it!", "Month", "Unknown"]),
})
end

test "Got it -> Main menu", %{flow: flow} do
flow
|> FlowTester.start()
|> receive_message(%{
# text: "[DEBUG]\r\nTemplate edd_reminder_2041 sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url" <> _,
text:
"[DEBUG]\r\nTemplate @body.whatsapp_template_name sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
"[DEBUG]\r\nTemplate @submission_name sent with language en_US.\r\nBody parameters: [@name]\r\nMedia link: @image_data.body.meta.download_url\r\n\r\nThe buttons represented here are not necessarily the same as the ones in the real template. Please double check the template buttons when running the flow in a real-world scenario." <>
_,
buttons: [
{"edd_got_it", "edd_got_it"},
{"edd_month", "edd_month"},
{"eddr_unknown", "eddr_unknown"}
]
# buttons: button_labels(["Got it!", "Update due date", "How to calculate it"])
# buttons: [
# {"edd_got_it", "edd_got_it"},
# {"edd_month", "edd_month"},
# {"eddr_unknown", "eddr_unknown"}
# ]
})
|> FlowTester.send("edd_got_it")
|> receive_message(%{
Expand Down
15 changes: 15 additions & 0 deletions Onboarding/QA/tests/exploring-tour_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ defmodule ExploringTourTest do
end
]

# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})

# The content for these tests.
assert :ok = Helpers.import_content_csv(wh_pid, "onboarding", import_opts)

Expand Down
126 changes: 0 additions & 126 deletions Onboarding/QA/tests/forms_test.exs

This file was deleted.

15 changes: 15 additions & 0 deletions Onboarding/QA/tests/intro-and-welcome_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ defmodule IntroAndWelcomeTest do
end
]

# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})

# The content for these tests.
assert :ok = Helpers.import_content_csv(wh_pid, "onboarding", import_opts)

Expand Down
15 changes: 15 additions & 0 deletions Onboarding/QA/tests/menu-non-personalised_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ defmodule MenuNonPersonalisedTest do
end
]

# The onboarding.csv content file contains a page that references a Whatsapp Template.
# We don't support importing of templates yet, so for now we add it manually
FakeCMS.add_template(wh_pid, %WATemplate{
id: "1",
slug: "mnch_onboarding_edd_reminder",
category: "MARKETING",
image: nil,
message: "This is a test message",
buttons: [],
example_values: [],
submission_status: "",
submission_name: "",
submission_result: ""
})

# The content for these tests.
assert :ok = Helpers.import_content_csv(wh_pid, "onboarding", import_opts)

Expand Down
Loading
Loading