Skip to content

Commit 002ffea

Browse files
authored
Merge pull request #3710 from techmatters/CHI-3534-set_up_jm_stg_integration_test
CHI-3534: Set up integration tests for JM
2 parents 8fb41dc + 22a8d52 commit 002ffea

File tree

5 files changed

+94
-14
lines changed

5 files changed

+94
-14
lines changed

lambdas/integrationTestRunner/src/integrationTests/e2e/customChannelChatbot.test.ts renamed to lambdas/integrationTestRunner/src/integrationTests/jm/customChannelChatbot.test.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,31 @@ import { startWebhookReceiverSession } from '../../webhookReceiver/client';
1717
import { verifyInstagramMessageExchange } from '../../instagram';
1818
import { verifyMessageExchange } from '../../verify';
1919

20-
// This is a hack to work around the fact that AS_DEV isn't in terraform but E2E_DEV doesn't have any custom channels configured
21-
const HELPLINE_CODE = 'AS';
20+
const HELPLINE_CODE = 'JM';
2221
const TEST_TIMEOUT_MILLISECONDS = 5 * 60 * 1000;
23-
jest.setTimeout(TEST_TIMEOUT_MILLISECONDS);
2422

2523
let webhookReceiverSession: ReturnType<typeof startWebhookReceiverSession>;
2624
let verifyExchange: ReturnType<typeof verifyMessageExchange>;
2725

2826
beforeEach(async () => {
29-
console.debug(`Starting test`);
3027
webhookReceiverSession = startWebhookReceiverSession(HELPLINE_CODE);
3128
verifyExchange = verifyInstagramMessageExchange(webhookReceiverSession, HELPLINE_CODE);
29+
jest.setTimeout(TEST_TIMEOUT_MILLISECONDS);
3230
});
3331

3432
afterEach(async () => {
3533
await webhookReceiverSession.end();
3634
});
3735

38-
test('AS_DEV instagram custom channel chatbot integration test', async () => {
36+
test('JM/staging instagram custom channel chatbot integration test', async () => {
3937
await verifyExchange([
4038
{
4139
sender: 'service-user',
4240
text: `Hello from integration test ${webhookReceiverSession.sessionId}`,
4341
},
4442
{
4543
sender: 'flex',
46-
text: `Welcome to the helpline. Please answer the following questions.`,
44+
text: `Welcome to the helpline. To help us better serve you, please answer the following questions. You can say -prefer not to answer- (or type X) to any question.`,
4745
},
4846
{ sender: 'flex', text: `Are you calling about yourself? Please answer Yes or No.` },
4947
{
@@ -66,6 +64,22 @@ test('AS_DEV instagram custom channel chatbot integration test', async () => {
6664
sender: 'service-user',
6765
text: `F`,
6866
},
67+
{
68+
sender: 'flex',
69+
text: `What parish are you located in?`,
70+
},
71+
{
72+
sender: 'service-user',
73+
text: `Kingston`,
74+
},
75+
{
76+
sender: 'flex',
77+
text: `How did you hear about us? Please select one: 1: Advertisement 2: Social Media 3: SMS/Text Message 4: Traditional Media 5: Word of Mouth`,
78+
},
79+
{
80+
sender: 'service-user',
81+
text: `1`,
82+
},
6983
{
7084
sender: 'flex',
7185
text: `We will transfer you now. Please hold for a counsellor.`,

twilio-iac/helplines/e2e/development.hcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ locals {
2929
}
3030
}
3131
get_profile_flags_for_identifier_base_url = "https://hrm-development.tl.techmatters.org/lambda/twilio/account-scoped"
32-
enable_integration_tests = true
3332
}
3433
}

twilio-iac/helplines/jm/staging.hcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ locals {
4848
ui_editable = false
4949
#Chatbots
5050
get_profile_flags_for_identifier_base_url = "https://hrm-staging.tl.techmatters.org/lambda/twilio/account-scoped"
51+
enable_integration_tests = true
5152
#System Down Configuration
5253
system_down_templatefile = "/app/twilio-iac/helplines/templates/studio-flows/system-down.tftpl"
5354
enable_system_down = true

twilio-iac/helplines/templates/studio-flows/messaging-custom-channel-lex-v3-blocking-lambda-sd.tftpl

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,77 @@ ${
176176
}
177177
}
178178
},
179+
{
180+
"name": "check_for_integration_test",
181+
"type": "split-based-on",
182+
"transitions": [
183+
{
184+
"next": "attributes",
185+
"event": "noMatch"
186+
},
187+
{
188+
"next": "end_integration_test",
189+
"event": "match",
190+
"conditions": [
191+
{
192+
"friendly_name": "{{trigger.conversation.ChannelAttributes.testSessionId}}",
193+
"arguments": [
194+
"{{trigger.conversation.ChannelAttributes.testSessionId}}"
195+
],
196+
"type": "is_not_blank",
197+
"value": "Is Not Blank"
198+
}
199+
]
200+
}
201+
]
202+
"properties": {
203+
"input": "{{trigger.conversation.ChannelAttributes.testSessionId}}",
204+
"offset": {
205+
"x": -450,
206+
"y": 150
207+
}
208+
}
209+
},
210+
{
211+
"name": "end_integration_test",
212+
"type": "run-function",
213+
"transitions": [
214+
{
215+
"event": "success"
216+
},
217+
{
218+
"event": "fail"
219+
}
220+
],
221+
"properties": {
222+
"service_sid": "${serverless_service_sid}",
223+
"environment_sid": "${serverless_environment_sid}",
224+
"offset": {
225+
"x": -670,
226+
"y": 360
227+
},
228+
"function_sid": "${flow_vars.send_message_janitor_function_sid}",
229+
"parameters": [
230+
{
231+
"value": "{{flow.channel.address}}",
232+
"key": "channelSid"
233+
},
234+
{
235+
"value": "{{flow.channel.address}}",
236+
"key": "conversationSid"
237+
},
238+
{
239+
"value": "Integration test run completed successfully. 🚀",
240+
"key": "message"
241+
},
242+
{
243+
"value": "${flow_vars.widget_from}",
244+
"key": "from"
245+
}
246+
],
247+
"url": "${serverless_url}/sendMessageAndRunJanitor"
248+
}
249+
},
179250
{
180251
"name": "attributes",
181252
"type": "send-to-flex",
@@ -210,7 +281,7 @@ ${
210281
"event": "noMatch"
211282
},
212283
{
213-
"next": "attributes",
284+
"next": "check_for_integration_test",
214285
"event": "match",
215286
"conditions": [
216287
{
@@ -261,7 +332,7 @@ ${
261332
"type": "make-http-request",
262333
"transitions": [
263334
{
264-
"next": "attributes",
335+
"next": "check_for_integration_test",
265336
"event": "success"
266337
},
267338
{

twilio-iac/stages/provision/terragrunt.hcl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ inputs = local.config
2727
*/
2828
terraform {
2929

30-
// TODO: make this only happen on provision stage.
31-
before_hook "manage_tf_secrets" {
32-
commands = ["init"]
33-
execute = ["/app/twilio-iac/scripts/python_tools/manageSecrets.py", "${include.root.locals.environment}/${include.root.locals.short_helpline}"]
34-
}
3530

3631
source = "../../terraform-modules//stages/${include.root.locals.stage}"
3732
}

0 commit comments

Comments
 (0)