public async Task MailMergeFromSalesforceEndToEnd() { await RevokeTokens("terminalDocuSign"); var salesforceAuthToken = await HealthMonitor_FixtureData.CreateSalesforceAuthToken(); //Create Case object in Salesforce var caseIdAndName = await CreateCase(salesforceAuthToken); PlanDTO plan = null; try { plan = await CreatePlan(); var solution = plan.SubPlans.First().Activities.Single(); await ApplyAuthTokenToSolution(solution, salesforceAuthToken); //Initial configuration solution = await Configure(solution); //Folowup configuration solution = solution.UpdateControls <Mail_Merge_From_Salesforce_v1.ActivityUi>(x => { x.SalesforceObjectSelector.selectedKey = "Case"; x.SalesforceObjectSelector.Value = "Case"; }); //This call will make solution to load specified Salesforce object properties and clear filter solution = await Configure(solution); //This call will run generation of child activities solution = solution.UpdateControls <Mail_Merge_From_Salesforce_v1.ActivityUi>(x => { x.SalesforceObjectFilter.Value = $"[{{\"field\":\"SuppliedName\",\"operator\":\"eq\",\"value\":\"{caseIdAndName.Item2}\"}}]"; var sendDocuSignItem = x.MailSenderActivitySelector.ListItems.FirstOrDefault(y => y.Key == "Send DocuSign Envelope"); Assert.IsNotNull(sendDocuSignItem, $"Send DocuSign Envelope activity is not marked with '{Tags.EmailDeliverer}' tag"); x.MailSenderActivitySelector.selectedKey = sendDocuSignItem.Key; x.MailSenderActivitySelector.Value = sendDocuSignItem.Value; x.RunMailMergeButton.Clicked = true; }); solution = await Configure(solution); Assert.AreEqual(2, solution.ChildrenActivities.Length, "Child activities were not generated after mail merge was requested"); //Configure Send DocuSign Envelope activity to use proper upstream values var docuSignActivity = solution.ChildrenActivities[1].ChildrenActivities[0]; var docusSignAuthAndConfig = await AuthorizeAndConfigureDocuSignActivity(docuSignActivity); docuSignActivity = docusSignAuthAndConfig.Item1; //Run plan var container = await Run(plan); Assert.AreEqual(State.Completed, container.State, "Container state is not equal to Completed"); // Deactivate plan await Deactivate(plan); //Verify contents of envelope AssertEnvelopeContents(docusSignAuthAndConfig.Item2, caseIdAndName.Item2); // Verify that test email has been received EmailAssert.EmailReceived("*****@*****.**", "Test Message from Fr8"); } finally { var caseWasDeleted = await DeleteCase(caseIdAndName.Item1, salesforceAuthToken); Assert.IsTrue(caseWasDeleted, "Case created for test purposes failed to be deleted"); //if (plan != null) //{ // await HttpDeleteAsync($"{_baseUrl}plans?id={plan.Id}"); //} } }