amtrack / sfdx-browserforce-plugin

sfdx plugin for browser automation
MIT License
112 stars 39 forks source link

Add salesforce-cpq-config #627

Closed shukrikhalid closed 1 month ago

shukrikhalid commented 2 months ago

Add salesforce-cpq-config to Browserforce Plugin

image

Summary:

This PR introduces a new configuration option, salesforce-cpq-config, into the Browserforce plugin. This feature allows users to set up the Salesforce CPQ package via a JSON configuration file, enabling automated updates in scratch orgs.

Purpose:

The primary goal is to enable SEEK to automate the configuration of the Salesforce CPQ package as part of its daily pipeline activities. This feature eliminates the need for manual configuration when creating new scratch orgs, allowing developers to focus on coding and other tasks without needing to replicate configurations from staging sandboxes.

Changes:

Use Case:

This plugin will be used by SEEK’s DevOps and CRM teams to automate Salesforce CPQ configuration in new scratch orgs as part of the daily CI/CD pipeline. It simplifies the process for Salesforce developers, reducing manual steps and enabling them to continue working without having to configure settings manually or copy configurations from the staging sandbox.

Testing:

Verified compatibility with SEEK's existing pipeline for Salesforce deployments.

Contact:

For any questions or issues related to this PR, please contact

amtrack commented 1 month ago

@shukrikhalid Thank you for creating this PR! I'm wondering if it's ready for review, because it's still in Draft mode...

shukrikhalid commented 1 month ago

Hi @amtrack, This PR is now ready. We monitored the scheduled overnight pipeline, successfully running while generating the scratch org pool. Please review the PR at your convenience.

amtrack commented 1 month ago

Hi @shukrikhalid , is there anything more to set up in a Scratch Org?

I've created a Scratch Org using the CPQ feature and installed the Managed Package:

diff --git a/config/project-scratch-def.json b/config/project-scratch-def.json
index 12352af..426bddf 100644
--- a/config/project-scratch-def.json
+++ b/config/project-scratch-def.json
@@ -2,5 +2,9 @@
   "orgName": "Browserforce",
   "edition": "Developer",
   "language": "en_US",
   "features": [
+    "CPQ",
      "DeferSharingCalc",
      "HighVelocitySales"
  ]
 }
diff --git a/scripts/develop.sh b/scripts/develop.sh
index 046aa41..d74f491 100755
--- a/scripts/develop.sh
+++ b/scripts/develop.sh
@@ -39,6 +39,7 @@ _main() {
     ${POSITIONAL_ARGS[@]}
   sf org display -o "$alias"
   sf project deploy start -o "$alias"
+  sf package install --package "04t6T000000t6QXQAY" --no-prompt --wait 30 # Salesforce CPQ (SBQQ) 252.3.0.1
 }

 if [[ "$0" == "${BASH_SOURCE[0]}" ]]; then

When I try to run the E2E tests, I get an error:

$ yarn test:e2e -g SalesforceCpqConfig
yarn run v1.22.21
$ tsc --resolveJsonModule -p test && mocha --require ts-node/register --slow 30s --timeout 2m --file test/e2e-setup.ts "test/**/*.e2e-spec.ts" "src/**/*.e2e-spec.ts" -g SalesforceCpqConfig

  SalesforceCpqConfig
Clicking on 'Generate Integration User Permissions' button
The button 'Generate Integration User Permissions' is not found. It might be already clicked before.
    ✔ should enable
Clicking on 'Generate Integration User Permissions' button
The button 'Generate Integration User Permissions' is not found. It might be already clicked before.
    1) should already be enabled

  1 passing (24s)
  1 failing

  1) SalesforceCpqConfig
       should already be enabled:
     AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

+ undefined
- {
-   message: 'no action necessary'
- }
      at Context.<anonymous> (src/plugins/salesforce-cpq-config/index.e2e-spec.ts:17:12)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
shukrikhalid commented 1 month ago

Hi @amtrack , I have updated test spec for SalesforceCpqConfig.

amtrack commented 1 month ago

@shukrikhalid I have no experience with Salesforce CPQ but I'm wondering where the settings of the "Settings Editor" are actually stored? In Custom Metadata Types, Custom Settings or SObjects or somewhere else?

I fear that query selectors like name='page:form:pb:j_id72:j_id73:j_id75' might change when the Salesforce CPQ package get's updated. Have to monitored these names over a few package versions?

Looking forward to your answer to understand more about how Salesforce CPQ config actually works.

shukrikhalid commented 1 month ago

Hi @amtrack, The last few packages changed the field names remain the same, except for a new field. We need to update if a new field is added to allow CPQ config using Browserforce.

cc @ashokkumar14, @matinraj

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 4.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: