Skip to content

Commit 2a7ddb1

Browse files
committed
Migrate PQE2EWithSMTest to 252
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 9327ff0 commit 2a7ddb1

File tree

3 files changed

+125
-10
lines changed

3 files changed

+125
-10
lines changed

src/integrationTest/java/com/salesforce/revoman/integration/core/pq/PQE2EWithSMTest.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.salesforce.revoman.integration.core.pq.connect.response.PlaceQuoteOutputRepresentation;
2828
import com.salesforce.revoman.output.postman.PostmanEnvironment;
2929
import com.salesforce.revoman.output.report.StepReport;
30+
import java.util.Arrays;
3031
import java.util.List;
3132
import java.util.Map;
3233
import kotlin.random.Random;
@@ -37,9 +38,14 @@
3738
/**
3839
* ----------------------------------------~~~~~ NOTE ~~~~~-----------------------------------------
3940
* This is only a sample to demo a full-blown test. You may not be able to execute this, as it needs
40-
* a specific server setup.
41+
* a specific server setup. If you are a Salesforce core developer, it takes less than 5 minutes to
42+
* setup an SM org,
4143
*
42-
* <p>TODO: Add a mock server setup for this test.
44+
* <p>- Follow these instructions: <a href="http://sfdc.co/sm-org-setup">SM Org setup</a>. - Replace
45+
* baseUrl of your server, username and password of the org admin here: <a
46+
* href="///resources/pm-templates/pq/pq-env.postman_environment.json">pq-env.postman_environment.json</a>
47+
*
48+
* <p>- TODO: Add a mock server setup for this test.
4349
*/
4450
class PQE2EWithSMTest {
4551
private static final Logger LOGGER = LoggerFactory.getLogger(PQE2EWithSMTest.class);
@@ -99,7 +105,8 @@ void revUpPQ() {
99105
afterAllStepsWithURIPathEndingWith(PQ_URI_PATH),
100106
(stepReport, ignore) -> {
101107
validatePQResponse(stepReport); // <10>
102-
final var isSyncStep = stepReport.responseInfo.get().containsHeader(IS_SYNC_HEADER);
108+
final var isSyncStep =
109+
stepReport.responseInfo.get().containsHeader(IS_SYNC_HEADER);
103110
if (!isSyncStep) {
104111
LOGGER.info(
105112
"Waiting in PostHook of the Async Step: {}, for the Quote's Asynchronous processing to finish",
@@ -144,10 +151,13 @@ private static void validateCompositeGraphResponse(StepReport stepReport) {
144151
private static void assertAfterPQCreate(PostmanEnvironment<Object> env) {
145152
// Quote: LineItemCount, quoteCalculationStatus
146153
assertThat(env).containsEntry("lineItemCount", 10);
147-
assertThat(env)
148-
.containsEntry(
149-
"quoteCalculationStatus",
150-
PricingPref.valueOf(env.getString("$pricingPref")).completeStatus);
154+
final var pricingPrefFromEnv = env.getString("$pricingPref");
155+
final var actualCompleteStatus =
156+
Arrays.stream(PricingPref.values())
157+
.filter(e -> e.name().equalsIgnoreCase(pricingPrefFromEnv))
158+
.findFirst()
159+
.map(e -> e.completeStatus);
160+
assertThat(env).containsEntry("quoteCalculationStatus", actualCompleteStatus.get());
151161
// QLIs: Product2Id
152162
final var productIdsFromEnv = env.valuesForKeysEndingWith(String.class, "ProductId");
153163
final var productIdsFromCreatedQLIs =

src/integrationTest/resources/pm-templates/pq/[sm] user-creation-with-ps-and-setup-pq.postman_collection.json

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "[sm] user-creation-with-ps-and-setup-pq",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
66
"_exporter_id": "23827434",
7-
"_collection_link": "https://salesforce-734821.postman.co/workspace/Delphinus-%25F0%259F%2590%25AC~8b8cf020-27dc-46b1-8de1-2b679073163c/collection/23827434-887a1603-ed57-4a39-ac5f-0d2c02d72767?action=share&source=collection_link&creator=23827434"
7+
"_collection_link": "https://salesforce-734821.postman.co/workspace/Delphinus-%F0%9F%90%AC~8b8cf020-27dc-46b1-8de1-2b679073163c/collection/23827434-887a1603-ed57-4a39-ac5f-0d2c02d72767?action=share&source=collection_link&creator=23827434"
88
},
99
"item": [
1010
{
@@ -698,6 +698,111 @@
698698
{
699699
"name": "setup",
700700
"item": [
701+
{
702+
"name": "StdPricebook",
703+
"item": [
704+
{
705+
"name": "StandardPriceBook",
706+
"event": [
707+
{
708+
"listen": "test",
709+
"script": {
710+
"exec": [
711+
"var jsonData = pm.response.json()",
712+
"pm.environment.set(\"standardPricebookId\", jsonData.records[0].Id);"
713+
],
714+
"type": "text/javascript"
715+
}
716+
}
717+
],
718+
"protocolProfileBehavior": {
719+
"disableBodyPruning": true
720+
},
721+
"request": {
722+
"method": "GET",
723+
"header": [
724+
{
725+
"key": "Content-Type",
726+
"value": "application/json",
727+
"type": "text"
728+
},
729+
{
730+
"key": "Sforce-Call-Options",
731+
"value": "client=SfdcInternalQA/...",
732+
"type": "text"
733+
}
734+
],
735+
"body": {
736+
"mode": "raw",
737+
"raw": ""
738+
},
739+
"url": {
740+
"raw": "{{baseUrl}}{{versionPath}}/query/?q=SELECT Id FROM Pricebook2 WHERE IsStandard = true",
741+
"host": [
742+
"{{baseUrl}}{{versionPath}}"
743+
],
744+
"path": [
745+
"query",
746+
""
747+
],
748+
"query": [
749+
{
750+
"key": "q",
751+
"value": "SELECT Id FROM Pricebook2 WHERE IsStandard = true"
752+
}
753+
]
754+
}
755+
},
756+
"response": []
757+
},
758+
{
759+
"name": "Pricebook",
760+
"event": [
761+
{
762+
"listen": "test",
763+
"script": {
764+
"exec": [
765+
""
766+
],
767+
"type": "text/javascript"
768+
}
769+
}
770+
],
771+
"request": {
772+
"method": "PATCH",
773+
"header": [
774+
{
775+
"key": "Content-Type",
776+
"name": "Content-Type",
777+
"value": "application/json",
778+
"type": "text"
779+
},
780+
{
781+
"key": "Sforce-Call-Options",
782+
"value": "client=SfdcInternalQA/...",
783+
"type": "text"
784+
}
785+
],
786+
"body": {
787+
"mode": "raw",
788+
"raw": "{\n \"IsActive\": true\n}"
789+
},
790+
"url": {
791+
"raw": "{{baseUrl}}{{versionPath}}/sobjects/Pricebook2/{{standardPricebookId}}",
792+
"host": [
793+
"{{baseUrl}}{{versionPath}}"
794+
],
795+
"path": [
796+
"sobjects",
797+
"Pricebook2",
798+
"{{standardPricebookId}}"
799+
]
800+
}
801+
},
802+
"response": []
803+
}
804+
]
805+
},
701806
{
702807
"name": "billing-setup",
703808
"item": [
@@ -2947,4 +3052,4 @@
29473052
}
29483053
}
29493054
]
2950-
}
3055+
}

src/integrationTest/resources/pm-templates/pq/pq-env.postman_environment.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"key" : "username",
13-
"value" : "linux-sm@250.org",
13+
"value" : "linux@252.org",
1414
"type" : "default",
1515
"enabled" : true
1616
},

0 commit comments

Comments
 (0)