sfdx-browserforce-plugin 5.1.1 → 5.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -16
- package/lib/browserforce-command.d.ts +15 -0
- package/lib/browserforce-command.js +61 -0
- package/lib/browserforce-command.js.map +1 -0
- package/lib/browserforce.d.ts +29 -0
- package/lib/browserforce.js +194 -0
- package/lib/browserforce.js.map +1 -0
- package/lib/commands/browserforce/apply.d.ts +10 -0
- package/lib/commands/browserforce/apply.js +54 -0
- package/lib/commands/browserforce/apply.js.map +1 -0
- package/lib/commands/browserforce/plan.d.ts +10 -0
- package/lib/commands/browserforce/plan.js +56 -0
- package/lib/commands/browserforce/plan.js.map +1 -0
- package/lib/config-parser.d.ts +16 -0
- package/lib/config-parser.js +24 -0
- package/lib/config-parser.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/jsforce-utils.d.ts +5 -0
- package/lib/jsforce-utils.js +14 -0
- package/lib/jsforce-utils.js.map +1 -0
- package/lib/pages/login.d.ts +8 -0
- package/lib/pages/login.js +39 -0
- package/lib/pages/login.js.map +1 -0
- package/lib/plugin.d.ts +17 -0
- package/lib/plugin.js +30 -0
- package/lib/plugin.js.map +1 -0
- package/lib/plugins/activity-settings/index.d.ts +9 -0
- package/lib/plugins/activity-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/activity-settings/index.e2e-spec.js +36 -0
- package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/activity-settings/index.js +34 -0
- package/lib/plugins/activity-settings/index.js.map +1 -0
- package/lib/plugins/company-information/index.d.ts +8 -0
- package/lib/plugins/company-information/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/company-information/index.e2e-spec.js +37 -0
- package/lib/plugins/company-information/index.e2e-spec.js.map +1 -0
- package/lib/plugins/company-information/index.js +60 -0
- package/lib/plugins/company-information/index.js.map +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +14 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.js +114 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js +39 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/enabled/index.d.ts +6 -0
- package/lib/plugins/customer-portal/enabled/index.js +26 -0
- package/lib/plugins/customer-portal/enabled/index.js.map +1 -0
- package/lib/plugins/customer-portal/enabled/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/enabled/index.test.js +34 -0
- package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/index.d.ts +15 -0
- package/lib/plugins/customer-portal/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/customer-portal/index.e2e-spec.js +202 -0
- package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -0
- package/lib/plugins/customer-portal/index.js +59 -0
- package/lib/plugins/customer-portal/index.js.map +1 -0
- package/lib/plugins/customer-portal/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/index.test.js +84 -0
- package/lib/plugins/customer-portal/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/portals/index.d.ts +25 -0
- package/lib/plugins/customer-portal/portals/index.js +216 -0
- package/lib/plugins/customer-portal/portals/index.js.map +1 -0
- package/lib/plugins/customer-portal/portals/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/portals/index.test.js +140 -0
- package/lib/plugins/customer-portal/portals/index.test.js.map +1 -0
- package/lib/plugins/density-settings/index.d.ts +10 -0
- package/lib/plugins/density-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/density-settings/index.e2e-spec.js +39 -0
- package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/density-settings/index.js +54 -0
- package/lib/plugins/density-settings/index.js.map +1 -0
- package/lib/plugins/deprecated.d.ts +4 -0
- package/lib/plugins/deprecated.js +28 -0
- package/lib/plugins/deprecated.js.map +1 -0
- package/lib/plugins/email-deliverability/index.d.ts +9 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.js +55 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -0
- package/lib/plugins/email-deliverability/index.js +42 -0
- package/lib/plugins/email-deliverability/index.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.d.ts +10 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +29 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.js +42 -0
- package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/page.d.ts +7 -0
- package/lib/plugins/high-velocity-sales-settings/page.js +28 -0
- package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -0
- package/lib/plugins/history-tracking/index.d.ts +17 -0
- package/lib/plugins/history-tracking/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/history-tracking/index.e2e-spec.js +106 -0
- package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -0
- package/lib/plugins/history-tracking/index.js +176 -0
- package/lib/plugins/history-tracking/index.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.d.ts +14 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.js +47 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.js +94 -0
- package/lib/plugins/home-page-layouts/index.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.test.d.ts +1 -0
- package/lib/plugins/home-page-layouts/index.test.js +104 -0
- package/lib/plugins/home-page-layouts/index.test.js.map +1 -0
- package/lib/plugins/index.d.ts +24 -0
- package/lib/plugins/index.js +25 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/lightning-experience-settings/index.d.ts +18 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +40 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/lightning-experience-settings/index.js +101 -0
- package/lib/plugins/lightning-experience-settings/index.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +8 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +29 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.js +15 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +10 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.js +42 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -0
- package/lib/plugins/omni-channel-settings/index.d.ts +9 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js +30 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/omni-channel-settings/index.js +21 -0
- package/lib/plugins/omni-channel-settings/index.js.map +1 -0
- package/lib/plugins/opportunity-splits/index.d.ts +9 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.js +46 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -0
- package/lib/plugins/opportunity-splits/index.js +32 -0
- package/lib/plugins/opportunity-splits/index.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +8 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.js +15 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/overview.d.ts +10 -0
- package/lib/plugins/opportunity-splits/pages/overview.js +33 -0
- package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/setup.d.ts +8 -0
- package/lib/plugins/opportunity-splits/pages/setup.js +17 -0
- package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -0
- package/lib/plugins/permission-sets/index.d.ts +10 -0
- package/lib/plugins/permission-sets/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/permission-sets/index.e2e-spec.js +47 -0
- package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -0
- package/lib/plugins/permission-sets/index.js +22 -0
- package/lib/plugins/permission-sets/index.js.map +1 -0
- package/lib/plugins/permission-sets/service-presence-status/index.d.ts +10 -0
- package/lib/plugins/permission-sets/service-presence-status/index.js +67 -0
- package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/index.d.ts +11 -0
- package/lib/plugins/picklists/field-dependencies/index.js +56 -0
- package/lib/plugins/picklists/field-dependencies/index.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/index.test.d.ts +1 -0
- package/lib/plugins/picklists/field-dependencies/index.test.js +64 -0
- package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/pages.d.ts +14 -0
- package/lib/plugins/picklists/field-dependencies/pages.js +49 -0
- package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -0
- package/lib/plugins/picklists/index.d.ts +23 -0
- package/lib/plugins/picklists/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/picklists/index.e2e-spec.js +100 -0
- package/lib/plugins/picklists/index.e2e-spec.js.map +1 -0
- package/lib/plugins/picklists/index.js +153 -0
- package/lib/plugins/picklists/index.js.map +1 -0
- package/lib/plugins/picklists/pages.d.ts +41 -0
- package/lib/plugins/picklists/pages.js +166 -0
- package/lib/plugins/picklists/pages.js.map +1 -0
- package/lib/plugins/picklists/standard-value-set.d.ts +1 -0
- package/lib/plugins/picklists/standard-value-set.js +80 -0
- package/lib/plugins/picklists/standard-value-set.js.map +1 -0
- package/lib/plugins/record-types/index.d.ts +13 -0
- package/lib/plugins/record-types/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/record-types/index.e2e-spec.js +73 -0
- package/lib/plugins/record-types/index.e2e-spec.js.map +1 -0
- package/lib/plugins/record-types/index.js +70 -0
- package/lib/plugins/record-types/index.js.map +1 -0
- package/lib/plugins/record-types/pages.d.ts +15 -0
- package/lib/plugins/record-types/pages.js +56 -0
- package/lib/plugins/record-types/pages.js.map +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +11 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +29 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js +62 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +8 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +3 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +55 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/index.d.ts +11 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +3 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/index.js +29 -0
- package/lib/plugins/reports-and-dashboards/index.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +17 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.js +649 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/index.d.ts +7 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +37 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/index.js +214 -0
- package/lib/plugins/salesforce-cpq-config/index.js.map +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.d.ts +9 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +35 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.js +36 -0
- package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -0
- package/lib/plugins/security/authentication-configuration/index.d.ts +11 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +101 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -0
- package/lib/plugins/security/authentication-configuration/index.js +67 -0
- package/lib/plugins/security/authentication-configuration/index.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.d.ts +23 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +63 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.js +154 -0
- package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.js +61 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -0
- package/lib/plugins/security/index.d.ts +13 -0
- package/lib/plugins/security/index.js +42 -0
- package/lib/plugins/security/index.js.map +1 -0
- package/lib/plugins/service-channels/capacity/index.d.ts +18 -0
- package/lib/plugins/service-channels/capacity/index.js +162 -0
- package/lib/plugins/service-channels/capacity/index.js.map +1 -0
- package/lib/plugins/service-channels/index.d.ts +12 -0
- package/lib/plugins/service-channels/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/service-channels/index.e2e-spec.js +61 -0
- package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -0
- package/lib/plugins/service-channels/index.js +38 -0
- package/lib/plugins/service-channels/index.js.map +1 -0
- package/lib/plugins/slack/index.d.ts +9 -0
- package/lib/plugins/slack/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/slack/index.e2e-spec.js +47 -0
- package/lib/plugins/slack/index.e2e-spec.js.map +1 -0
- package/lib/plugins/slack/index.js +46 -0
- package/lib/plugins/slack/index.js.map +1 -0
- package/lib/plugins/user-access-policies/index.d.ts +19 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.js +63 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -0
- package/lib/plugins/user-access-policies/index.js +107 -0
- package/lib/plugins/user-access-policies/index.js.map +1 -0
- package/lib/plugins/user-access-policies/page.d.ts +29 -0
- package/lib/plugins/user-access-policies/page.js +115 -0
- package/lib/plugins/user-access-policies/page.js.map +1 -0
- package/lib/plugins/utils.d.ts +3 -0
- package/lib/plugins/utils.js +47 -0
- package/lib/plugins/utils.js.map +1 -0
- package/oclif.manifest.json +153 -0
- package/package.json +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { SalesforceCpqConfig } from './index.js';
|
|
4
|
+
const defaultConfig = JSON.parse(readFileSync(new URL('./default.json', import.meta.url), 'utf8'));
|
|
5
|
+
const describeOrSkip = process.env['CPQ'] === 'true' ? describe : describe.skip;
|
|
6
|
+
describeOrSkip(SalesforceCpqConfig.name, function () {
|
|
7
|
+
let plugin;
|
|
8
|
+
before(() => {
|
|
9
|
+
plugin = new SalesforceCpqConfig(global.bf);
|
|
10
|
+
});
|
|
11
|
+
const configDefault = defaultConfig.settings.salesforceCpqConfig;
|
|
12
|
+
const configCustom = {
|
|
13
|
+
documents: {
|
|
14
|
+
documentFolder: 'Quotes',
|
|
15
|
+
hideDocumentName: true,
|
|
16
|
+
},
|
|
17
|
+
quote: {
|
|
18
|
+
disableInitialQuoteSync: true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
it('should apply default config', async () => {
|
|
22
|
+
await plugin.run(configDefault);
|
|
23
|
+
});
|
|
24
|
+
it('should already be configured', async () => {
|
|
25
|
+
const res = await plugin.run(configDefault);
|
|
26
|
+
assert.deepStrictEqual(res, { message: 'no action necessary' });
|
|
27
|
+
});
|
|
28
|
+
it('should apply custom config', async () => {
|
|
29
|
+
const res = await plugin.run(configCustom);
|
|
30
|
+
assert.notDeepStrictEqual(res, { message: 'no action necessary' });
|
|
31
|
+
});
|
|
32
|
+
it('should already be configured', async () => {
|
|
33
|
+
const res = await plugin.run(configCustom);
|
|
34
|
+
assert.deepStrictEqual(res, { message: 'no action necessary' });
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.e2e-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-cpq-config/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAA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AAE;QAC1C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3C,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../plugin.js';
|
|
2
|
+
import { formConfig } from './formConfig.js';
|
|
3
|
+
const BASE_PATH = '0A3?setupid=ImportedPackage&retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DStudio';
|
|
4
|
+
const AUTH_PATH = 'setup/secur/RemoteAccessAuthorizationPage.apexp';
|
|
5
|
+
const CONFIGURE_SELECTOR = '.actionLink[title*="Configure"][title*="Salesforce CPQ"]';
|
|
6
|
+
const GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR = 'input[name="page:form:pb:j_id185:j_id197:setupIntegrationUserPermissions"]';
|
|
7
|
+
const SAVE_SELECTOR = 'input[name="page:form:j_id2:j_id3:j_id11"]';
|
|
8
|
+
const AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR = 'span#page\\:form\\:pb\\:calculatorOptions\\:j_id201\\:j_id203 a';
|
|
9
|
+
const ALLOW_SELECTOR = 'input[name="save"]';
|
|
10
|
+
export class SalesforceCpqConfig extends BrowserforcePlugin {
|
|
11
|
+
logger = this.browserforce.logger;
|
|
12
|
+
async retrieve(definition) {
|
|
13
|
+
const page = await this.browserforce.openPage(BASE_PATH);
|
|
14
|
+
await page.locator(CONFIGURE_SELECTOR).waitFor();
|
|
15
|
+
await page.locator(CONFIGURE_SELECTOR).click();
|
|
16
|
+
await page.waitForLoadState('load');
|
|
17
|
+
const response = {};
|
|
18
|
+
if (definition) {
|
|
19
|
+
for (const [keyTab, valueTab] of Object.entries(formConfig)) {
|
|
20
|
+
if (definition[keyTab]) {
|
|
21
|
+
await page.locator(`td[id="${valueTab.id}"]`).waitFor();
|
|
22
|
+
await page.locator(`td[id="${valueTab.id}"]`).click();
|
|
23
|
+
for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
|
|
24
|
+
if (!(definition[keyTab][keyItem] === undefined)) {
|
|
25
|
+
const item = valueItem;
|
|
26
|
+
response[keyTab] = response[keyTab] || {};
|
|
27
|
+
try {
|
|
28
|
+
if (item.component === 'input' && item.type === 'boolean') {
|
|
29
|
+
response[keyTab][keyItem] = await page
|
|
30
|
+
.locator(`${item.component}[name="${item.name}"]`)
|
|
31
|
+
.isChecked();
|
|
32
|
+
}
|
|
33
|
+
else if (item.component === 'input' &&
|
|
34
|
+
item.type === 'string') {
|
|
35
|
+
response[keyTab][keyItem] = await page
|
|
36
|
+
.locator(`${item.component}[name="${item.name}"]`)
|
|
37
|
+
.evaluate((el) => el.value);
|
|
38
|
+
}
|
|
39
|
+
else if (item.component === 'select') {
|
|
40
|
+
response[keyTab][keyItem] = await page
|
|
41
|
+
.locator(`${item.component}[name="${item.name}"]`)
|
|
42
|
+
.evaluate((el) => el.selectedOptions[0].text);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (e instanceof Error &&
|
|
47
|
+
e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
|
|
48
|
+
this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
await page.close();
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
async apply(config) {
|
|
63
|
+
const page = await this.browserforce.openPage(BASE_PATH);
|
|
64
|
+
await page.locator(CONFIGURE_SELECTOR).click();
|
|
65
|
+
await page.waitForLoadState('load');
|
|
66
|
+
/*
|
|
67
|
+
This to click on the 'Generate Integration User Permissions button' for first time setup.
|
|
68
|
+
Once the button is clicked, it will not be available for the next time.
|
|
69
|
+
*/
|
|
70
|
+
this.logger?.log(`Checking for 'Generate Integration User Permissions' button`);
|
|
71
|
+
await page
|
|
72
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
73
|
+
.waitFor();
|
|
74
|
+
await page
|
|
75
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
76
|
+
.click();
|
|
77
|
+
const generateButtonCount = await page
|
|
78
|
+
.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR)
|
|
79
|
+
.count();
|
|
80
|
+
if (generateButtonCount > 0) {
|
|
81
|
+
this.logger?.log(`Clicking on 'Generate Integration User Permissions' button`);
|
|
82
|
+
await page
|
|
83
|
+
.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR)
|
|
84
|
+
.click();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.logger?.log(`The button 'Generate Integration User Permissions' is not found. It might be already clicked before.`);
|
|
88
|
+
}
|
|
89
|
+
/*
|
|
90
|
+
This to loop through the formConfig and set the value based on the config provided.
|
|
91
|
+
*/
|
|
92
|
+
for (const [keyTab, valueTab] of Object.entries(formConfig)) {
|
|
93
|
+
if (config[keyTab]) {
|
|
94
|
+
await page.locator(`td[id="${valueTab.id}"]`).waitFor();
|
|
95
|
+
await page.locator(`td[id="${valueTab.id}"]`).click();
|
|
96
|
+
for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
|
|
97
|
+
if (!(config[keyTab][keyItem] === undefined)) {
|
|
98
|
+
const item = valueItem;
|
|
99
|
+
try {
|
|
100
|
+
this.logger?.log(`Updating: '${keyTab}.${keyItem}' (${item.label}) with component '${item.component}[name="${item.name}"]' with value: '${config[keyTab][keyItem]}'`);
|
|
101
|
+
if (item.component === 'input' && item.type === 'boolean') {
|
|
102
|
+
const checkbox = await page.locator(`input[name="${item.name}"]`);
|
|
103
|
+
if (!(await checkbox.isDisabled())) {
|
|
104
|
+
if (config[keyTab][keyItem]) {
|
|
105
|
+
await checkbox.check();
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
await checkbox.uncheck();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (item.component === 'input' && item.type === 'string') {
|
|
113
|
+
await page
|
|
114
|
+
.locator(`input[name="${item.name}"]`)
|
|
115
|
+
.fill(config[keyTab][keyItem]);
|
|
116
|
+
}
|
|
117
|
+
else if (item.component === 'select') {
|
|
118
|
+
const selectFieldOptions = await page
|
|
119
|
+
.locator(`select[name="${item.name}"] option`)
|
|
120
|
+
.evaluateAll((options) => {
|
|
121
|
+
return options.map((option) => {
|
|
122
|
+
return {
|
|
123
|
+
text: option.text,
|
|
124
|
+
value: option.value,
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
const chooseFieldOption = selectFieldOptions.find((x) => x.text === config[keyTab][keyItem]);
|
|
129
|
+
if (!chooseFieldOption) {
|
|
130
|
+
const availableOption = selectFieldOptions.map((option) => option.text);
|
|
131
|
+
throw new Error(`Fail to set '${item.label}' with value '${config[keyTab][keyItem]}'. \nPlease make sure to select one of this available options: ${JSON.stringify(availableOption)}\n`);
|
|
132
|
+
}
|
|
133
|
+
await page
|
|
134
|
+
.locator(`select[name="${item.name}"]`)
|
|
135
|
+
.selectOption(chooseFieldOption.value);
|
|
136
|
+
}
|
|
137
|
+
if (item.immediatelySave) {
|
|
138
|
+
await page.locator(SAVE_SELECTOR).click();
|
|
139
|
+
await page.waitForLoadState('load');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
if (e instanceof Error &&
|
|
144
|
+
e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
|
|
145
|
+
this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
this.logger?.warn(`Error: at Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
149
|
+
throw e;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
await page.locator(SAVE_SELECTOR).click();
|
|
156
|
+
await page.waitForLoadState('load');
|
|
157
|
+
}
|
|
158
|
+
/*
|
|
159
|
+
This to click on the 'Authorize New Calculation Service' link under Pricing and Calculation tab.
|
|
160
|
+
Once authorized, it will not appear the next time.
|
|
161
|
+
*/
|
|
162
|
+
try {
|
|
163
|
+
this.logger?.log(`'Authorize New Calculation Service' link`);
|
|
164
|
+
await page
|
|
165
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
166
|
+
.waitFor();
|
|
167
|
+
await page
|
|
168
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
169
|
+
.click();
|
|
170
|
+
const authorizeLinkCount = await page
|
|
171
|
+
.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR)
|
|
172
|
+
.count();
|
|
173
|
+
if (authorizeLinkCount > 0) {
|
|
174
|
+
// Click on 'Authorize New Calculation Service' link and wait for popup
|
|
175
|
+
const popupPromise = page
|
|
176
|
+
.context()
|
|
177
|
+
.waitForEvent('page', (newPage) => newPage.url().includes(AUTH_PATH));
|
|
178
|
+
await page.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR).click();
|
|
179
|
+
const newPage = await popupPromise;
|
|
180
|
+
if (newPage) {
|
|
181
|
+
// Click on 'Allow' button
|
|
182
|
+
await newPage.locator(ALLOW_SELECTOR).waitFor();
|
|
183
|
+
await newPage.locator(ALLOW_SELECTOR).click();
|
|
184
|
+
await page.waitForLoadState('load'); // Wait for the main page to refresh
|
|
185
|
+
this.logger?.log('The main page has refreshed after allowing.');
|
|
186
|
+
await newPage.close();
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.logger?.warn('Failed to retrieve the new page from the popup.');
|
|
190
|
+
}
|
|
191
|
+
this.logger?.log('The authorization process has been completed.');
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.logger?.log(`The link 'Authorize New Calculation Service' was not found. It might be already clicked before.`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
if (e instanceof Error &&
|
|
199
|
+
e.message.includes(`No element found for selector: ${AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR}`)) {
|
|
200
|
+
this.logger?.log(`The link Authorize New Calculation Service' is not found. It might be already clicked before.`);
|
|
201
|
+
}
|
|
202
|
+
else if (e instanceof Error &&
|
|
203
|
+
e.message.includes(`Waiting for selector \`input[name="save"]\` failed: waitForFunction failed: frame got detached.`)) {
|
|
204
|
+
this.logger?.log(`ALLOW button is not found. It might be already clicked before.`);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
this.logger?.warn(`Error clicking Authorize New Calculation Service' button with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
208
|
+
throw e;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
await page.close();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-cpq-config/index.ts"],"names":[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@@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { SalesforceToSalesforce } from './index.js';
|
|
3
|
+
describe(SalesforceToSalesforce.name, function () {
|
|
4
|
+
this.timeout('2m');
|
|
5
|
+
let plugin;
|
|
6
|
+
before(() => {
|
|
7
|
+
plugin = new SalesforceToSalesforce(global.bf);
|
|
8
|
+
});
|
|
9
|
+
const configEnabled = {
|
|
10
|
+
enabled: true,
|
|
11
|
+
};
|
|
12
|
+
const configDisabled = {
|
|
13
|
+
enabled: false,
|
|
14
|
+
};
|
|
15
|
+
it('should enable', async () => {
|
|
16
|
+
await plugin.run(configEnabled);
|
|
17
|
+
});
|
|
18
|
+
it('should be enabled', async () => {
|
|
19
|
+
const state = await plugin.retrieve();
|
|
20
|
+
assert.deepStrictEqual(state, configEnabled);
|
|
21
|
+
});
|
|
22
|
+
it('should fail to disable', async () => {
|
|
23
|
+
let err;
|
|
24
|
+
try {
|
|
25
|
+
await plugin.apply(configDisabled);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
err = e;
|
|
29
|
+
}
|
|
30
|
+
assert.throws(() => {
|
|
31
|
+
throw err;
|
|
32
|
+
}, /cannot be disabled/);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.e2e-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-to-salesforce/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,QAAQ,CAAC,sBAAsB,CAAC,IAAI,EAAE;IACpC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,IAAI,MAA8B,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,IAAI;KACd,CAAC;IACF,MAAM,cAAc,GAAG;QACrB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,IAAI,GAAG,CAAC;QACR,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,GAAG,GAAG,CAAC,CAAC;QACV,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACjB,MAAM,GAAG,CAAC;QACZ,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import pRetry from 'p-retry';
|
|
2
|
+
import { BrowserforcePlugin } from '../../plugin.js';
|
|
3
|
+
const BASE_PATH = '_ui/s2s/ui/PartnerNetworkEnable/e';
|
|
4
|
+
export class SalesforceToSalesforce extends BrowserforcePlugin {
|
|
5
|
+
async retrieve() {
|
|
6
|
+
const page = await this.browserforce.openPage(BASE_PATH);
|
|
7
|
+
const response = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
};
|
|
10
|
+
const checkedImageCount = await page
|
|
11
|
+
.getByRole('img', { name: 'Checked' })
|
|
12
|
+
.count();
|
|
13
|
+
if (checkedImageCount === 0) {
|
|
14
|
+
response.enabled = false;
|
|
15
|
+
}
|
|
16
|
+
await page.close();
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
19
|
+
async apply(config) {
|
|
20
|
+
if (config.enabled === false) {
|
|
21
|
+
throw new Error('`enabled` cannot be disabled once enabled');
|
|
22
|
+
}
|
|
23
|
+
// sometimes the setting is not being applied although no error is being displayed
|
|
24
|
+
await pRetry(async () => {
|
|
25
|
+
const page = await this.browserforce.openPage(BASE_PATH);
|
|
26
|
+
await page.locator('#penabled').check();
|
|
27
|
+
await page.getByRole('button', { name: 'save' }).first().click();
|
|
28
|
+
await page.close();
|
|
29
|
+
const result = await this.retrieve();
|
|
30
|
+
if (result.enabled !== config.enabled) {
|
|
31
|
+
throw new Error('setting was not applied as expected');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-to-salesforce/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAMtD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IACrD,KAAK,CAAC,QAAQ;QACnB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG;YACf,OAAO,EAAE,IAAI;SACd,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,IAAI;aACjC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;aACrC,KAAK,EAAE,CAAC;QACX,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QAED,kFAAkF;QAClF,MAAM,MAAM,CAAC,KAAK,IAAI,EAAE;YACtB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAEzD,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;YACjE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAEnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
2
|
+
export type Config = {
|
|
3
|
+
services: Array<{
|
|
4
|
+
label: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
export declare class AuthenticationConfiguration extends BrowserforcePlugin {
|
|
9
|
+
retrieve(definition: Config): Promise<Config>;
|
|
10
|
+
apply(plan: Config): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import * as child from 'child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { AuthenticationConfiguration } from './index.js';
|
|
6
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
7
|
+
describe(AuthenticationConfiguration.name, function () {
|
|
8
|
+
let plugin;
|
|
9
|
+
before(() => {
|
|
10
|
+
plugin = new AuthenticationConfiguration(global.bf);
|
|
11
|
+
});
|
|
12
|
+
describe('authentication configuration', () => {
|
|
13
|
+
const configRetrieveSingle = {
|
|
14
|
+
services: [{ label: 'Login Form', enabled: true }],
|
|
15
|
+
};
|
|
16
|
+
const configRmoveSingle = {
|
|
17
|
+
services: [{ label: 'Login Form', enabled: false }],
|
|
18
|
+
};
|
|
19
|
+
const configApplyMultiple = {
|
|
20
|
+
services: [
|
|
21
|
+
{ label: 'Login Form', enabled: false },
|
|
22
|
+
{ label: 'TestAuthMethod', enabled: true },
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
const configApplyMissing = {
|
|
26
|
+
services: [{ label: 'FakeAuthMethod', enabled: true }],
|
|
27
|
+
};
|
|
28
|
+
const resetTestState = {
|
|
29
|
+
services: [
|
|
30
|
+
{ label: 'Login Form', enabled: true },
|
|
31
|
+
{ label: 'TestAuthMethod', enabled: false },
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
it('should retrieve the single enabled Login Form auth', async () => {
|
|
35
|
+
const res = await plugin.retrieve(configRetrieveSingle);
|
|
36
|
+
assert.deepStrictEqual(res, configRetrieveSingle);
|
|
37
|
+
});
|
|
38
|
+
it('should not do anything when the configuration is already set', async () => {
|
|
39
|
+
const res = await plugin.run(configRetrieveSingle);
|
|
40
|
+
assert.deepStrictEqual(res, { message: 'no action necessary' });
|
|
41
|
+
});
|
|
42
|
+
it('should throw an error when trying to remove the only enabled service', async () => {
|
|
43
|
+
let err;
|
|
44
|
+
try {
|
|
45
|
+
await plugin.apply(configRmoveSingle);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
err = e;
|
|
49
|
+
}
|
|
50
|
+
assert.throws(() => {
|
|
51
|
+
throw err;
|
|
52
|
+
}, /You must select at least one authentication service/);
|
|
53
|
+
});
|
|
54
|
+
it('should deploy an AuthProvider for testing', () => {
|
|
55
|
+
const sourceDeployCmd = child.spawnSync('sf', [
|
|
56
|
+
'project',
|
|
57
|
+
'deploy',
|
|
58
|
+
'start',
|
|
59
|
+
'-d',
|
|
60
|
+
path.join(__dirname, 'sfdx-source'),
|
|
61
|
+
'--json',
|
|
62
|
+
]);
|
|
63
|
+
assert.deepStrictEqual(sourceDeployCmd.status, 0, sourceDeployCmd.output.toString());
|
|
64
|
+
});
|
|
65
|
+
it('should update multiple auth services', async () => {
|
|
66
|
+
await plugin.apply(configApplyMultiple);
|
|
67
|
+
const res = await plugin.retrieve(configApplyMultiple);
|
|
68
|
+
assert.deepStrictEqual(res, configApplyMultiple);
|
|
69
|
+
});
|
|
70
|
+
it('should throw an error when trying to apply a missing service', async () => {
|
|
71
|
+
let err;
|
|
72
|
+
try {
|
|
73
|
+
await plugin.apply(configApplyMissing);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
err = e;
|
|
77
|
+
}
|
|
78
|
+
assert.throws(() => {
|
|
79
|
+
throw err;
|
|
80
|
+
}, /not found/);
|
|
81
|
+
});
|
|
82
|
+
it('should reset auth services back to default', async () => {
|
|
83
|
+
await plugin.apply(resetTestState);
|
|
84
|
+
const res = await plugin.retrieve(resetTestState);
|
|
85
|
+
assert.deepStrictEqual(res, resetTestState);
|
|
86
|
+
});
|
|
87
|
+
it('should remove the testing AuthProvider', () => {
|
|
88
|
+
const sourceDeployCmd = child.spawnSync('sf', [
|
|
89
|
+
'project',
|
|
90
|
+
'delete',
|
|
91
|
+
'source',
|
|
92
|
+
'--metadata',
|
|
93
|
+
'AuthProvider:TestAuthMethod',
|
|
94
|
+
'--no-prompt',
|
|
95
|
+
'--json',
|
|
96
|
+
]);
|
|
97
|
+
assert.deepStrictEqual(sourceDeployCmd.status, 0, sourceDeployCmd.output.toString());
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=index.e2e-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../../src/plugins/security/authentication-configuration/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAe,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,QAAQ,CAAC,2BAA2B,CAAC,IAAI,EAAE;IACzC,IAAI,MAAmC,CAAC;IAExC,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,2BAA2B,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC5C,MAAM,oBAAoB,GAAW;YACnC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACnD,CAAC;QACF,MAAM,iBAAiB,GAAW;YAChC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SACpD,CAAC;QACF,MAAM,mB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cAAc,CAAC,CAAC;YAClD,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC5C,SAAS;gBACT,QAAQ;gBACR,QAAQ;gBACR,YAAY;gBACZ,6BAA6B;gBAC7B,aAAa;gBACb,QAAQ;aACT,CAAC,CAAC;YACH,MAAM,CAAC,eAAe,CACpB,eAAe,CAAC,MAAM,EACtB,CAAC,EACD,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,CAClC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
2
|
+
const EDIT_VIEW_PATH = 'lightning/setup/OrgDomain/page?address=%2Fdomainname%2FEditLogin.apexp';
|
|
3
|
+
const SETUP_FORM_SELECTOR = 'form[id="BrandSetup:brandSetupForm"]';
|
|
4
|
+
const SERVICE_CHECKBOX_SELECTOR = 'input.authOption[type="checkbox"]';
|
|
5
|
+
const SAVE_BUTTON_SELECTOR = 'input[id$=":Save"]';
|
|
6
|
+
export class AuthenticationConfiguration extends BrowserforcePlugin {
|
|
7
|
+
async retrieve(definition) {
|
|
8
|
+
const page = await this.browserforce.openPage(EDIT_VIEW_PATH);
|
|
9
|
+
const frameOrPage = await this.browserforce.waitForSelectorInFrameOrPage(page, SETUP_FORM_SELECTOR);
|
|
10
|
+
const services = await frameOrPage
|
|
11
|
+
.locator(SERVICE_CHECKBOX_SELECTOR)
|
|
12
|
+
.evaluateAll((inputs, definedServices) => inputs
|
|
13
|
+
.map((cb) => {
|
|
14
|
+
const labelElement = document.querySelector(`label[for="${cb.id}"]`);
|
|
15
|
+
const label = labelElement
|
|
16
|
+
? labelElement.textContent.trim()
|
|
17
|
+
: cb.id;
|
|
18
|
+
return {
|
|
19
|
+
label,
|
|
20
|
+
enabled: cb.checked,
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
.filter((service) => definedServices.some((definedService) => definedService.label === service.label)), definition.services);
|
|
24
|
+
await page.close();
|
|
25
|
+
return { services };
|
|
26
|
+
}
|
|
27
|
+
async apply(plan) {
|
|
28
|
+
const page = await this.browserforce.openPage(EDIT_VIEW_PATH);
|
|
29
|
+
const frameOrPage = await this.browserforce.waitForSelectorInFrameOrPage(page, SETUP_FORM_SELECTOR);
|
|
30
|
+
for (const svc of plan.services) {
|
|
31
|
+
const checkboxId = (await frameOrPage
|
|
32
|
+
.locator(SERVICE_CHECKBOX_SELECTOR)
|
|
33
|
+
.evaluateAll((inputs, serviceName) => {
|
|
34
|
+
for (const inp of inputs) {
|
|
35
|
+
const labelElement = document.querySelector(`label[for="${inp.id}"]`);
|
|
36
|
+
if (labelElement &&
|
|
37
|
+
labelElement.textContent.trim() === serviceName) {
|
|
38
|
+
return inp.id;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}, svc.label));
|
|
43
|
+
if (!checkboxId) {
|
|
44
|
+
throw new Error(`Authentication service "${svc.label}" not found`);
|
|
45
|
+
}
|
|
46
|
+
const selector = `[id="${checkboxId}"]`;
|
|
47
|
+
const isChecked = await frameOrPage
|
|
48
|
+
.locator(selector)
|
|
49
|
+
.evaluate((el) => el.checked);
|
|
50
|
+
if (svc.enabled !== isChecked) {
|
|
51
|
+
await frameOrPage.locator(selector).click();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const anyChecked = await frameOrPage
|
|
55
|
+
.locator(SERVICE_CHECKBOX_SELECTOR)
|
|
56
|
+
.evaluateAll((inputs) => inputs.some((cb) => cb.checked));
|
|
57
|
+
if (!anyChecked) {
|
|
58
|
+
throw new Error('Change failed: "You must select at least one authentication service."');
|
|
59
|
+
}
|
|
60
|
+
await frameOrPage.locator(SAVE_BUTTON_SELECTOR).first().click();
|
|
61
|
+
await page.waitForLoadState();
|
|
62
|
+
// Wait for Salesforce to update the data in the background
|
|
63
|
+
await page.waitForTimeout(2000);
|
|
64
|
+
await page.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/security/authentication-configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AASxD,MAAM,cAAc,GAClB,wEAAwE,CAAC;AAE3E,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AACtE,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IAC1D,KAAK,CAAC,QAAQ,CAAC,UAAkB;QACtC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,4BAA4B,CACtE,IAAI,EACJ,mBAAmB,CACpB,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,WAAW;aAC/B,OAAO,CAAC,yBAAyB,CAAC;aAClC,WAAW,CACV,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,CACzB,MAA6B;aAC3B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACV,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CACzC,cAAc,EAAE,CAAC,EAAE,IAAI,CACxB,CAAC;YACF,MAAM,KAAK,GAAG,YAAY;gBACxB,CAAC,CAAC,YAAY,CAAC,WAAY,CAAC,IAAI,EAAE;gBAClC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YACV,OAAO;gBACL,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AK,aAAa,CAAC,CAAC;YACrE,CAAC;YAED,MAAM,QAAQ,GAAG,QAAQ,UAAU,IAAI,CAAC;YACxC,MAAM,SAAS,GAAG,MAAM,WAAW;iBAChC,OAAO,CAAC,QAAQ,CAAC;iBACjB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,CAAE,EAAuB,CAAC,OAAO,CAAC,CAAC;YAEtD,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,WAAW;aACjC,OAAO,CAAC,yBAAyB,CAAC;aAClC,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE,CACrB,MAA6B,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CACxD,CAAC;QACJ,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;QACJ,CAAC;QACD,MAAM,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;QAChE,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,2DAA2D;QAC3D,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
2
|
+
export type Config = {
|
|
3
|
+
certificates?: Certificate[];
|
|
4
|
+
importFromKeystore?: KeyStore[];
|
|
5
|
+
};
|
|
6
|
+
type Certificate = {
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
exportable?: boolean;
|
|
10
|
+
keySize?: number;
|
|
11
|
+
_id?: string;
|
|
12
|
+
};
|
|
13
|
+
type KeyStore = {
|
|
14
|
+
name: string;
|
|
15
|
+
filePath?: string;
|
|
16
|
+
password?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare class CertificateAndKeyManagement extends BrowserforcePlugin {
|
|
19
|
+
retrieve(definition: Config): Promise<Config>;
|
|
20
|
+
diff(state?: Config, definition?: Config): Config | undefined;
|
|
21
|
+
apply(plan: Config): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|