sfdx-browserforce-plugin 5.2.0-next.5 → 6.0.0-next.10

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.
Files changed (178) hide show
  1. package/README.md +66 -87
  2. package/lib/browserforce-command.d.ts +14 -3
  3. package/lib/browserforce-command.js +117 -17
  4. package/lib/browserforce-command.js.map +1 -1
  5. package/lib/browserforce.d.ts +14 -12
  6. package/lib/browserforce.js +98 -100
  7. package/lib/browserforce.js.map +1 -1
  8. package/lib/commands/browserforce/apply.js +17 -12
  9. package/lib/commands/browserforce/apply.js.map +1 -1
  10. package/lib/commands/browserforce/playwright.js +9 -3
  11. package/lib/commands/browserforce/playwright.js.map +1 -1
  12. package/lib/config-parser.js.map +1 -1
  13. package/lib/pages/login.d.ts +2 -2
  14. package/lib/pages/login.js +5 -15
  15. package/lib/pages/login.js.map +1 -1
  16. package/lib/plugin.d.ts +0 -2
  17. package/lib/plugin.js +0 -2
  18. package/lib/plugin.js.map +1 -1
  19. package/lib/plugins/activity-settings/index.e2e-spec.js +1 -1
  20. package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -1
  21. package/lib/plugins/activity-settings/index.js +92 -21
  22. package/lib/plugins/activity-settings/index.js.map +1 -1
  23. package/lib/plugins/company-information/index.e2e-spec.js +1 -1
  24. package/lib/plugins/company-information/index.e2e-spec.js.map +1 -1
  25. package/lib/plugins/company-information/index.js +100 -31
  26. package/lib/plugins/company-information/index.js.map +1 -1
  27. package/lib/plugins/customer-portal/available-custom-objects/index.js +161 -73
  28. package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -1
  29. package/lib/plugins/customer-portal/available-custom-objects/index.test.js +1 -1
  30. package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -1
  31. package/lib/plugins/customer-portal/enabled/index.js +76 -13
  32. package/lib/plugins/customer-portal/enabled/index.js.map +1 -1
  33. package/lib/plugins/customer-portal/enabled/index.test.js +1 -1
  34. package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -1
  35. package/lib/plugins/customer-portal/index.e2e-spec.js +12 -19
  36. package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -1
  37. package/lib/plugins/customer-portal/index.js +3 -4
  38. package/lib/plugins/customer-portal/index.js.map +1 -1
  39. package/lib/plugins/customer-portal/index.test.js +1 -1
  40. package/lib/plugins/customer-portal/index.test.js.map +1 -1
  41. package/lib/plugins/customer-portal/portals/index.js +186 -110
  42. package/lib/plugins/customer-portal/portals/index.js.map +1 -1
  43. package/lib/plugins/customer-portal/portals/index.test.js +1 -1
  44. package/lib/plugins/customer-portal/portals/index.test.js.map +1 -1
  45. package/lib/plugins/density-settings/index.e2e-spec.js +1 -1
  46. package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -1
  47. package/lib/plugins/density-settings/index.js +91 -22
  48. package/lib/plugins/density-settings/index.js.map +1 -1
  49. package/lib/plugins/email-deliverability/index.e2e-spec.js +1 -1
  50. package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -1
  51. package/lib/plugins/email-deliverability/index.js +93 -22
  52. package/lib/plugins/email-deliverability/index.js.map +1 -1
  53. package/lib/plugins/high-velocity-sales-settings/index.d.ts +1 -1
  54. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +1 -1
  55. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -1
  56. package/lib/plugins/high-velocity-sales-settings/index.js +71 -8
  57. package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -1
  58. package/lib/plugins/high-velocity-sales-settings/page.d.ts +2 -1
  59. package/lib/plugins/high-velocity-sales-settings/page.js +2 -6
  60. package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -1
  61. package/lib/plugins/history-tracking/index.e2e-spec.js +3 -4
  62. package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -1
  63. package/lib/plugins/history-tracking/index.js +156 -94
  64. package/lib/plugins/history-tracking/index.js.map +1 -1
  65. package/lib/plugins/home-page-layouts/index.e2e-spec.js +1 -1
  66. package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -1
  67. package/lib/plugins/home-page-layouts/index.js +121 -57
  68. package/lib/plugins/home-page-layouts/index.js.map +1 -1
  69. package/lib/plugins/home-page-layouts/index.test.js +1 -1
  70. package/lib/plugins/home-page-layouts/index.test.js.map +1 -1
  71. package/lib/plugins/index.d.ts +1 -1
  72. package/lib/plugins/index.js +1 -1
  73. package/lib/plugins/index.js.map +1 -1
  74. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +1 -1
  75. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -1
  76. package/lib/plugins/lightning-experience-settings/index.js +90 -27
  77. package/lib/plugins/lightning-experience-settings/index.js.map +1 -1
  78. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +1 -1
  79. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -1
  80. package/lib/plugins/linkedin-sales-navigator-settings/index.js +84 -6
  81. package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -1
  82. package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +2 -1
  83. package/lib/plugins/linkedin-sales-navigator-settings/page.js +2 -7
  84. package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -1
  85. package/lib/plugins/omni-channel-settings/index.e2e-spec.js +1 -1
  86. package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -1
  87. package/lib/plugins/omni-channel-settings/index.js +87 -14
  88. package/lib/plugins/omni-channel-settings/index.js.map +1 -1
  89. package/lib/plugins/opportunity-splits/index.e2e-spec.js +1 -1
  90. package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -1
  91. package/lib/plugins/opportunity-splits/index.js +103 -18
  92. package/lib/plugins/opportunity-splits/index.js.map +1 -1
  93. package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -1
  94. package/lib/plugins/opportunity-splits/pages/overview.d.ts +2 -1
  95. package/lib/plugins/opportunity-splits/pages/overview.js +2 -3
  96. package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -1
  97. package/lib/plugins/opportunity-splits/pages/setup.d.ts +2 -1
  98. package/lib/plugins/opportunity-splits/pages/setup.js +1 -1
  99. package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -1
  100. package/lib/plugins/permission-sets/index.e2e-spec.js +1 -1
  101. package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -1
  102. package/lib/plugins/permission-sets/index.js.map +1 -1
  103. package/lib/plugins/permission-sets/service-presence-status/index.js +106 -53
  104. package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -1
  105. package/lib/plugins/picklists/field-dependencies/index.js +91 -14
  106. package/lib/plugins/picklists/field-dependencies/index.js.map +1 -1
  107. package/lib/plugins/picklists/field-dependencies/index.test.js +1 -1
  108. package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -1
  109. package/lib/plugins/picklists/field-dependencies/pages.d.ts +3 -2
  110. package/lib/plugins/picklists/field-dependencies/pages.js +5 -14
  111. package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -1
  112. package/lib/plugins/picklists/index.d.ts +1 -1
  113. package/lib/plugins/picklists/index.e2e-spec.js +36 -14
  114. package/lib/plugins/picklists/index.e2e-spec.js.map +1 -1
  115. package/lib/plugins/picklists/index.js +136 -68
  116. package/lib/plugins/picklists/index.js.map +1 -1
  117. package/lib/plugins/picklists/pages.js +13 -28
  118. package/lib/plugins/picklists/pages.js.map +1 -1
  119. package/lib/plugins/picklists/standard-value-set.js +2 -2
  120. package/lib/plugins/picklists/standard-value-set.js.map +1 -1
  121. package/lib/plugins/record-types/index.e2e-spec.js +2 -3
  122. package/lib/plugins/record-types/index.e2e-spec.js.map +1 -1
  123. package/lib/plugins/record-types/index.js +81 -20
  124. package/lib/plugins/record-types/index.js.map +1 -1
  125. package/lib/plugins/record-types/pages.js +1 -5
  126. package/lib/plugins/record-types/pages.js.map +1 -1
  127. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +2 -2
  128. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -1
  129. package/lib/plugins/relate-contact-to-multiple-accounts/index.js +99 -35
  130. package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -1
  131. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +100 -37
  132. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -1
  133. package/lib/plugins/reports-and-dashboards/index.js +1 -1
  134. package/lib/plugins/reports-and-dashboards/index.js.map +1 -1
  135. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +1 -1
  136. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -1
  137. package/lib/plugins/salesforce-cpq-config/index.js +213 -167
  138. package/lib/plugins/salesforce-cpq-config/index.js.map +1 -1
  139. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +1 -2
  140. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -1
  141. package/lib/plugins/salesforce-to-salesforce/index.js +93 -23
  142. package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -1
  143. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +2 -3
  144. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -1
  145. package/lib/plugins/security/authentication-configuration/index.js +122 -50
  146. package/lib/plugins/security/authentication-configuration/index.js.map +1 -1
  147. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +4 -25
  148. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -1
  149. package/lib/plugins/security/certificate-and-key-management/index.js +141 -65
  150. package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -1
  151. package/lib/plugins/security/certificate-and-key-management/index.test.js +1 -1
  152. package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -1
  153. package/lib/plugins/security/index.js +1 -2
  154. package/lib/plugins/security/index.js.map +1 -1
  155. package/lib/plugins/service-channels/capacity/index.js +145 -112
  156. package/lib/plugins/service-channels/capacity/index.js.map +1 -1
  157. package/lib/plugins/service-channels/index.e2e-spec.js +5 -6
  158. package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -1
  159. package/lib/plugins/service-channels/index.js +1 -2
  160. package/lib/plugins/service-channels/index.js.map +1 -1
  161. package/lib/plugins/slack/index.e2e-spec.js +1 -1
  162. package/lib/plugins/slack/index.e2e-spec.js.map +1 -1
  163. package/lib/plugins/slack/index.js +97 -28
  164. package/lib/plugins/slack/index.js.map +1 -1
  165. package/lib/plugins/user-access-policies/index.e2e-spec.js +3 -5
  166. package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -1
  167. package/lib/plugins/user-access-policies/index.js +95 -26
  168. package/lib/plugins/user-access-policies/index.js.map +1 -1
  169. package/lib/plugins/user-access-policies/page.d.ts +2 -1
  170. package/lib/plugins/user-access-policies/page.js +1 -7
  171. package/lib/plugins/user-access-policies/page.js.map +1 -1
  172. package/lib/plugins/utils.js +2 -7
  173. package/lib/plugins/utils.js.map +1 -1
  174. package/oclif.manifest.json +67 -71
  175. package/package.json +10 -8
  176. package/lib/commands/browserforce/plan.d.ts +0 -10
  177. package/lib/commands/browserforce/plan.js +0 -56
  178. package/lib/commands/browserforce/plan.js.map +0 -1
package/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # sfdx-browserforce-plugin
2
2
 
3
- > sfdx plugin to apply settings in the Salesforce Setup Menu using browser automation
3
+ > sf plugin to apply settings in the Salesforce Setup Menu using browser automation
4
4
 
5
5
  [![Actions Status](https://github.com/amtrack/sfdx-browserforce-plugin/actions/workflows/default.yml/badge.svg?branch=main)](https://github.com/amtrack/sfdx-browserforce-plugin/actions?query=branch:main)
6
6
 
7
+ > [!NOTE]
8
+ > Since v6 we're using Playwright instead of Puppeteer. Please see the [MIGRATION](./docs/MIGRATION.md) guide.
9
+
7
10
  ✅ Most settings in the Salesforce Setup Menu are represented as [Settings](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_settings.htm) in the Metadata API.
8
11
 
9
12
  For example, the highlighted checkbox "Show View Hierarchy link on account pages" in Account Settings is indeed represented in the Metadata `AccountSettings` as `showViewHierarchyLink`.
@@ -24,7 +27,7 @@ For example, the Currency Locale in `Setup -> Company Settings -> Company Inform
24
27
 
25
28
  👉 This is where Browserforce (sfdx-browserforce-plugin) comes to the rescue. It fills this gap by applying these unsupported settings through browser automation!
26
29
 
27
- # Example
30
+ ## Example
28
31
 
29
32
  To change the Currency Locale, the Browserforce config file (here: `./config/currency.json`) looks like this:
30
33
 
@@ -44,19 +47,19 @@ Apply the config:
44
47
  ```console
45
48
  $ sf browserforce apply -f ./config/currency.json --target-org myOrg@example.com
46
49
  logging in... done
47
- Applying definition file ./config/currency.json to org myOrg@example.com
50
+ Applying config file ./config/currency.json to org myOrg@example.com
48
51
  [CompanyInformation] retrieving state... done
49
52
  [CompanyInformation] changing 'defaultCurrencyIsoCode' to '"English (South Africa) - ZAR"'... done
50
53
  logging out... done
51
54
  ```
52
55
 
53
- # Key Concepts
56
+ ## Key Concepts
54
57
 
55
58
  - 🔧 configuration using JSON Schema (similar to the [Scratch Org Definition Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm))
56
59
  - 🧠 idempotency of the `apply` command only applies what's necessary and allows re-execution (concept similar to [terraform](https://www.terraform.io/docs/commands/apply.html))
57
60
  - 🏎️ browser automation powered by Playwright, [learn more about Playwright and Browserforce](#playwright)
58
61
 
59
- # Supported Browserforce Settings
62
+ ## Supported Browserforce Settings
60
63
 
61
64
  Top settings:
62
65
 
@@ -75,129 +78,105 @@ But there's more:
75
78
  - Please see the [Browserforce Settings](https://github.com/amtrack/sfdx-browserforce-plugin/wiki/Browserforce-Settings) wiki page with screenshots.
76
79
  - Explore the JSON schema powered configuration using a [full-blown example](https://github.dev/amtrack/sfdx-browserforce-plugin/blob/main/examples/full.json) or start with an [empty configuration](https://github.dev/amtrack/sfdx-browserforce-plugin/blob/main/examples/empty.json).
77
80
 
78
- # Installation
79
-
80
- There are several different methods to install `sfdx-browserforce-plugin`:
81
+ ## Installation
81
82
 
82
- ```console
83
- # as an sf plugin globally
83
+ ```shell
84
84
  sf plugins install sfdx-browserforce-plugin
85
+ ```
85
86
 
86
- # or standalone globally
87
- npm install --global sfdx-browserforce-plugin
87
+ > [!IMPORTANT]
88
+ > Playwright does not come with a browser automatically
88
89
 
89
- # or standalone locally (as a dependency in your Node.js project)
90
- npm install --save-dev sfdx-browserforce-plugin
91
- ```
90
+ You might need to install a browser explicitly or configure Browserforce to use an existing browser.
92
91
 
93
- # Usage
92
+ > [!TIP]
93
+ > If you're using Browserforce on GitHub Actions with the `ubuntu-latest` (v24) Docker image, we can use the preinstalled Google Chrome automatically.
94
+ > No further configuration and installation needed, because the `CHROME_BIN` environment variable is already set.
94
95
 
95
- Depending on your choice of installation, you can find the `browserforce` namespace:
96
+ ### Option 1: Install a browser using our Playwright wrapper command
96
97
 
97
- ```console
98
- # globally in the sf cli
99
- sf browserforce
98
+ ```shell
99
+ sf browserforce playwright -- install chromium
100
+ ```
101
+
102
+ > [!IMPORTANT]
103
+ > The two hyphens `--` are intentional and separate the sf command from the arguments to be passed to the playwright executable.
104
+
105
+ ### Option 2: Configure Browserforce to use an existing browser
100
106
 
101
- # globally in the sfdx-browserforce-plugin executable
102
- sfdx-browserforce-plugin browserforce
107
+ You can use one of the following environment variables:
103
108
 
104
- # locally in the sfdx-browserforce-plugin executable (npx is awesome!)
105
- npx sfdx-browserforce-plugin browserforce
109
+ ```shell
110
+ PLAYWRIGHT_BROWSER_CHANNEL="chrome"
111
+ PLAYWRIGHT_BROWSER_CHANNEL="chromium"
112
+ # or
113
+ PLAYWRIGHT_EXECUTABLE_PATH="/usr/bin/google-chrome"
114
+ CHROME_BIN="/usr/bin/google-chrome"
106
115
  ```
107
116
 
117
+ ## Usage
118
+
108
119
  ```console
109
- $ sfdx-browserforce browserforce -h
110
- browser automation
120
+ $ sf browserforce -h
121
+ browser automation for Salesforce setup pages
111
122
 
112
123
  USAGE
113
- $ sfdx-browserforce-plugin browserforce COMMAND
124
+ $ sf browserforce COMMAND
114
125
 
115
126
  COMMANDS
116
- browserforce apply apply a plan from a definition file
117
- browserforce plan retrieve state and generate plan file
127
+ browserforce apply apply a plan from a config file
128
+ browserforce playwright access the Playwright CLI
118
129
  ```
119
130
 
120
- Both the `browserforce apply` and `browserforce plan` commands expect a config file and a target username or alias for the org.
131
+ Both the `apply` and `plan` commands expect a config file and a target username or alias for the org.
121
132
 
122
- # Environment Variables
133
+ ## Environment Variables
123
134
 
124
- - `BROWSER_DEBUG` run in non-headless mode (default: `false`)
135
+ - `PLAYWRIGHT_BROWSER_CHANNEL`: let Playwright figure out the path to a browser (`chromium` or `chrome`)
136
+ - `PLAYWRIGHT_EXECUTABLE_PATH` or `CHROME_BIN`: point Playwright to a specific browser executable (e.g. `/usr/bin/google-chrome`)
137
+ - `BROWSERFORCE_HEADLESS`: run in headless mode (default: `true`)
125
138
  - `BROWSERFORCE_NAVIGATION_TIMEOUT_MS`: adjustable for slow internet connections (default: `90000`)
126
139
  - `BROWSERFORCE_RETRY_MAX_RETRIES`: number of retries on failures opening a page (default: `4`)
127
140
  - `BROWSERFORCE_RETRY_TIMEOUT_MS`: initial time between retries in exponential mode (default: `4000`)
128
141
 
129
- # Migration to Playwright
130
-
131
- **Important Notice for Next Version Release:**
132
-
133
- This project is transitioning from Puppeteer to Playwright for browser automation. The migration is planned for the next major version release.
142
+ ## Playwright
134
143
 
135
- ## What This Means for Users
144
+ We use [Playwright](https://playwright.dev/) for browser automation.
136
145
 
137
- ### Current Version (Puppeteer-based)
138
- - Continues to work as expected
139
- - No action required from users
140
- - Maintained for stability
146
+ For more information on browser automation best practices, see the [Playwright documentation](./docs/PLAYWRIGHT.md).
141
147
 
142
- ### Next Version (Playwright-based)
143
- The upcoming release will include:
148
+ ## Alternative Installation
144
149
 
145
- 1. **Improved Reliability**: Playwright offers better auto-waiting and more robust element interaction
146
- 2. **Better Frame Support**: Native iframe handling without workarounds
147
- 3. **Enhanced Debugging**: Built-in trace viewer and inspector tools
148
- 4. **Modern API**: More intuitive locator-based API
150
+ You can also install the `sfdx-browserforce-plugin` NPM package without `sf`. The package exports a `sfdx-browserforce-plugin` executable:
149
151
 
150
- ### Migration Actions Required
152
+ Example:
151
153
 
152
- **For Plugin Developers:**
153
- If you've created custom plugins or extended this project:
154
-
155
- 1. **Update Browser Automation Code**:
156
- - Replace `page.$()` with `page.locator()`
157
- - Replace `page.$$()` with `page.locator().all()`
158
- - Update `ElementHandle` references to `Locator`
159
- - Review frame handling code (Playwright has better native support)
160
-
161
- 2. **Update Dependencies**:
162
- - Remove `puppeteer` dependency
163
- - Add `playwright` or `@playwright/test` dependency
164
-
165
- 3. **Review Documentation**:
166
- - See [`docs/PLAYWRIGHT.md`](docs/PLAYWRIGHT.md) for best practices
167
-
168
- **For End Users:**
169
- - No configuration changes required
170
- - Browser download process remains similar
171
- - Environment variables remain compatible
172
- - All existing configuration files will continue to work
173
-
174
- # Playwright
175
-
176
- We use [Playwright](https://playwright.dev/) for browser automation which comes with its own Chromium browser.
177
-
178
- The Playwright [installation guide](https://playwright.dev/docs/intro) describes how this works:
179
-
180
- > Playwright comes with bundled browser binaries for Chromium, Firefox, and WebKit. When you install Playwright, it automatically downloads the Chromium browser to ensure consistent automation across different environments. The browser is downloaded to the OS-specific cache directory.
181
-
182
- In most cases this just works! If you want to skip the download and use another browser installation, you can do this as follows:
154
+ ```shell
155
+ npm install --save-dev sfdx-browserforce-plugin
156
+ npx sfdx-browserforce-plugin browserforce -h
157
+ ```
183
158
 
159
+ ## Troubleshooting
184
160
 
185
- For more information on browser automation best practices, see the [Playwright documentation](docs/PLAYWRIGHT.md).
161
+ If no browser is installed or launching fails, you'll get an error message from Playwright with a suggestion.
186
162
 
187
- Troubleshooting:
163
+ Typically this will guide you to install a browser.
164
+ If you've installed sfdx-browserforce-plugin using `sf`, you can replace the following:
188
165
 
189
- - The installation is triggered via the `postinstall` hook of npm/yarn. If you've disabled running scripts with npm (`--ignore-scripts` or via config file), it will not download the browser.
190
- - If you encounter issues with browser downloads, you can manually install browsers with: `npx playwright install chromium`
166
+ ```diff
167
+ - npx playwright install chromium
168
+ + sf browserforce playwright -- install chromium
169
+ ```
191
170
 
192
- # Contributing
171
+ ## Contributing
193
172
 
194
173
  Please see [CONTRIBUTING.md](CONTRIBUTING.md) for getting started.
195
174
 
196
- # Sponsors
175
+ ## Sponsors
197
176
 
198
177
  - [PARX](https://www.parx.com)
199
178
  - [IPfolio](https://www.ipfolio.com)
200
179
 
201
- # License
180
+ ## License
202
181
 
203
182
  MIT © [Matthias Rolke](mailto:mr.amtrack@gmail.com)
@@ -4,12 +4,23 @@ export declare abstract class BrowserforceCommand<T> extends SfCommand<T> {
4
4
  static baseFlags: {
5
5
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
6
6
  definitionfile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
- planfile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
- statefile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ headless: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ 'slow-mo': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
10
+ timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ trace: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ exe: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ channel: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'max-retries': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'retry-timeout': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
9
16
  'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
17
  };
11
- protected bf: Browserforce;
18
+ protected browserforce: Browserforce;
12
19
  protected settings: any[];
20
+ protected retryConfig?: {
21
+ retries: number;
22
+ minTimeout: number;
23
+ };
13
24
  init(): Promise<void>;
14
25
  finally(err?: Error): Promise<void>;
15
26
  }
@@ -1,6 +1,7 @@
1
1
  import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
2
2
  import { promises } from 'fs';
3
3
  import * as path from 'path';
4
+ import { chromium } from 'playwright';
4
5
  import { Browserforce } from './browserforce.js';
5
6
  import { ConfigParser } from './config-parser.js';
6
7
  import { handleDeprecations } from './plugins/deprecated.js';
@@ -11,21 +12,69 @@ export class BrowserforceCommand extends SfCommand {
11
12
  'target-org': Flags.requiredOrg(),
12
13
  definitionfile: Flags.string({
13
14
  char: 'f',
14
- description: 'path to a browserforce state file',
15
+ description: 'path to a browserforce config file',
15
16
  }),
16
- planfile: Flags.string({
17
- char: 'p',
18
- name: 'plan',
19
- description: 'path to a browserforce plan file',
17
+ 'dry-run': Flags.boolean({
18
+ char: 'd',
19
+ description: 'dry run',
20
+ env: 'BROWSERFORCE_DRY_RUN',
20
21
  }),
21
- statefile: Flags.string({
22
- char: 's',
23
- name: 'state',
24
- description: 'path to a browserforce definition file\nThe schema is similar to the scratch org definition file.\nSee https://github.com/amtrack/sfdx-browserforce-plugin#supported-org-preferences for supported values.',
22
+ // browser configuration
23
+ headless: Flags.boolean({
24
+ helpGroup: 'Browser Configuration',
25
+ summary: 'run in headless mode (default: true)',
26
+ allowNo: true,
27
+ env: 'BROWSERFORCE_HEADLESS',
28
+ default: !(process.env.BROWSER_DEBUG === 'true'), // for backwards-compatibility
29
+ }),
30
+ 'slow-mo': Flags.integer({
31
+ helpGroup: 'Browser Configuration',
32
+ summary: 'slow motion in milliseconds (default: 0)',
33
+ env: 'BROWSERFORCE_SLOWMO',
34
+ default: Number(process.env.BROWSER_SLOWMO ?? '0'), // for backwards-compatibility
35
+ }),
36
+ timeout: Flags.integer({
37
+ helpGroup: 'Browser Configuration',
38
+ summary: 'the default navigation timeout in milliseconds',
39
+ env: 'BROWSERFORCE_NAVIGATION_TIMEOUT_MS',
40
+ default: 90_000,
41
+ }),
42
+ trace: Flags.boolean({
43
+ helpGroup: 'Browser Configuration',
44
+ summary: 'create a playwright trace',
45
+ description: 'The trace-date.zip file can be viewed with sf browserforce playwright show-trace trace-date.zip.',
46
+ env: 'PLAYWRIGHT_TRACE',
47
+ }),
48
+ exe: Flags.string({
49
+ helpGroup: 'Browser Configuration',
50
+ summary: 'the path to a browser executable',
51
+ description: 'on GitHub Actions with ubuntu-latest, this is set to /usr/bin/google-chrome',
52
+ env: 'PLAYWRIGHT_EXECUTABLE_PATH',
53
+ default: process.env.CHROME_BIN?.length ? process.env.CHROME_BIN : undefined,
54
+ }),
55
+ channel: Flags.string({
56
+ helpGroup: 'Browser Configuration',
57
+ summary: 'the channel (e.g. chromium or chrome) to use',
58
+ description: 'Playwright will try to figure out the path to the browser executable automatically.',
59
+ env: 'PLAYWRIGHT_BROWSER_CHANNEL',
60
+ }),
61
+ // retry config
62
+ 'max-retries': Flags.integer({
63
+ helpGroup: 'Retry Configuration',
64
+ summary: 'the maximum number of retries for retryable actions',
65
+ env: 'BROWSERFORCE_RETRY_MAX_RETRIES',
66
+ default: 6,
67
+ }),
68
+ 'retry-timeout': Flags.integer({
69
+ helpGroup: 'Retry Configuration',
70
+ summary: 'the inital timeout in milliseconds for retryable actions (exponentially increased)',
71
+ env: 'BROWSERFORCE_RETRY_TIMEOUT_MS',
72
+ default: 4_000,
25
73
  }),
26
74
  };
27
- bf;
75
+ browserforce;
28
76
  settings;
77
+ retryConfig;
29
78
  async init() {
30
79
  await super.init();
31
80
  const { flags } = await this.parse({
@@ -38,24 +87,75 @@ export class BrowserforceCommand extends SfCommand {
38
87
  definition = JSON.parse(definitionFileData);
39
88
  }
40
89
  catch (err) {
41
- throw new Error('Failed parsing definitionfile');
90
+ throw new Error('Failed parsing config file');
42
91
  }
43
92
  }
44
93
  handleDeprecations(definition);
45
- // TODO: use require.resolve to dynamically load plugins from npm packages
46
94
  this.settings = ConfigParser.parse(DRIVERS, definition);
47
- this.bf = new Browserforce(flags['target-org'], new Ux({ jsonEnabled: this.jsonEnabled() }));
95
+ const connection = flags['target-org'].getConnection();
96
+ const browserContext = await createBrowserContextFromFlags(flags);
97
+ const options = {
98
+ logger: new Ux({ jsonEnabled: this.jsonEnabled() }),
99
+ ...createRetryOptionsFromFlags(flags),
100
+ };
101
+ this.browserforce = new Browserforce(connection, browserContext, options);
48
102
  this.spinner.start('logging in');
49
- await this.bf.login();
103
+ await this.browserforce.browserContext.tracing.group('login');
104
+ await this.browserforce.login();
50
105
  this.spinner.stop();
106
+ await this.browserforce.browserContext.tracing.groupEnd();
51
107
  }
52
108
  async finally(err) {
53
- this.spinner.stop(err?.message);
54
- if (this.bf) {
109
+ this.spinner.stop(err?.toString());
110
+ if (err?.cause instanceof Error) {
111
+ this.logToStderr(`Cause: ${err.cause.toString()}`);
112
+ }
113
+ if (this.browserforce) {
55
114
  this.spinner.start('logging out');
56
- await this.bf.logout();
115
+ try {
116
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
117
+ const tracePath = `trace-${timestamp}.zip`;
118
+ await this.browserforce.browserContext.tracing.stop({ path: tracePath });
119
+ this.logToStderr(`Playwright trace saved to: ${tracePath}`);
120
+ }
121
+ catch (_) { }
122
+ await this.browserforce.browserContext.browser().close();
57
123
  this.spinner.stop();
58
124
  }
59
125
  }
60
126
  }
127
+ async function createBrowserContextFromFlags(flags) {
128
+ const browser = await chromium.launch({
129
+ ...(flags.channel
130
+ ? {
131
+ channel: flags.channel,
132
+ }
133
+ : {}),
134
+ ...(flags.exe
135
+ ? {
136
+ executablePath: flags.exe,
137
+ }
138
+ : {}),
139
+ headless: flags.headless,
140
+ slowMo: flags['slow-mo'],
141
+ });
142
+ const browserContext = await browser.newContext({
143
+ viewport: { width: 1280, height: 1536 },
144
+ });
145
+ browserContext.setDefaultNavigationTimeout(flags.timeout);
146
+ if (flags.trace) {
147
+ await browserContext.tracing.start({
148
+ screenshots: true,
149
+ snapshots: true,
150
+ sources: true,
151
+ });
152
+ }
153
+ return browserContext;
154
+ }
155
+ function createRetryOptionsFromFlags(flags) {
156
+ return {
157
+ retries: flags['max-retries'],
158
+ minTimeout: flags['retry-timeout'],
159
+ };
160
+ }
61
161
  //# sourceMappingURL=browserforce-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserforce-command.js","sourceRoot":"","sources":["../src/browserforce-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,MAAM,OAAgB,mBAAuB,SAAQ,SAAY;IAC/D,MAAM,CAAC,SAAS,GAAG;QACjB,GAAG,SAAS,CAAC,SAAS;QACtB,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC;YAC3B,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,IAAI,EAAE,GAAG;YACT,IAAI,EA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CAAC;AAED,SAAS,2BAA2B,CAAC,KAAK;IACxC,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC;QAC7B,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC;KACnC,CAAC;AACJ,CAAC"}
@@ -1,18 +1,20 @@
1
- import { Org } from '@salesforce/core';
1
+ import { type Connection } from '@salesforce/core';
2
2
  import { type Ux } from '@salesforce/sf-plugins-core';
3
- import { type Browser, type BrowserContext, type Page, type FrameLocator } from 'playwright';
3
+ import { Options as RetryOptions } from 'p-retry';
4
+ import { type BrowserContext, type FrameLocator, type Page } from 'playwright';
5
+ export type SalesforceUrlPath = `/${string}`;
6
+ export type BrowserforceOptions = {
7
+ logger?: Ux;
8
+ retry?: RetryOptions;
9
+ };
4
10
  export declare class Browserforce {
5
- org: Org;
11
+ connection: Connection;
12
+ browserContext: BrowserContext;
6
13
  logger?: Ux;
7
- browser: Browser;
8
- context: BrowserContext;
9
- page: Page;
10
- lightningSetupUrl: string;
11
- constructor(org: Org, logger?: Ux);
14
+ private retryConfig?;
15
+ constructor(connection: Connection, browserContext: BrowserContext, options?: BrowserforceOptions);
12
16
  login(): Promise<Browserforce>;
13
- logout(): Promise<Browserforce>;
14
- getNewPage(): Promise<Page>;
15
- openPage(urlPath: string): Promise<Page>;
17
+ openPage(urlPath: SalesforceUrlPath): Promise<Page>;
16
18
  waitForSelectorInFrameOrPage(page: Page, selector: string): Promise<Page | FrameLocator>;
17
19
  getMyDomain(): string | null;
18
20
  getInstanceUrl(): string;
@@ -20,6 +22,6 @@ export declare class Browserforce {
20
22
  * @returns the setup url (e.g. https://[MyDomainName].my.salesforce-setup.com)
21
23
  */
22
24
  getLightningSetupUrl(): Promise<string>;
25
+ retry<T>(input: (attemptCount: number) => PromiseLike<T> | T): Promise<T>;
23
26
  }
24
27
  export declare function waitForPageErrors(page: Page, timeout?: number): Promise<void>;
25
- export declare function retry<T>(input: (attemptCount: number) => PromiseLike<T> | T): Promise<T>;