You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Instead of manually running these commands while developing, we will run the E2E tests instead:
65
+
66
+
```shell
67
+
npm run test:e2e -- -g "AdminsCanLogInAsAnyUser"
68
+
AdminsCanLogInAsAnyUser
69
+
✔ should enable
70
+
✔ should already be enabled
71
+
✔ should disable
72
+
✔ should already be disabled
73
+
4 passing (6s)
74
+
```
60
75
61
76
## Developing plugins
62
77
63
78
For the following, we assume that your scaffolded plugin lives in `src/plugins/admins-can-log-in-as-any-user`.
64
79
65
-
```console
80
+
```shell
66
81
$ tree src/plugins/admins-can-log-in-as-any-user
67
82
src/plugins/admins-can-log-in-as-any-user
68
-
├── disable.json <-- example config file for e2e test
69
-
├── enable.json <-- example config file for e2e test
83
+
├── disable.json <-- example config file formanual testing
84
+
├── enable.json <-- example config file formanual testing
70
85
├── index.e2e-spec.ts <-- end-to-end test
71
86
├── index.ts <-- implementation
72
87
└── schema.json <-- schema for configuration
@@ -149,32 +164,35 @@ The execution will apply as few changes as necessary and so you will be able to
149
164
Both the result of the `retrieve` function and the argument of the `apply` function are objects in the format defined in your `schema.json`.
150
165
In this example, you would return `{enabled: boolean}` as part of `retrieve`, and expect `{enabled: boolean}` as argument in `apply`.
151
166
152
-
## Debugging
153
-
154
-
The [Salesforce CLI Plug-In Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_debug.htm) describes debugging sfdx plugins using VS Code very well.
155
-
156
167
## Testing
157
168
158
169
To run **unit tests**:
159
170
160
-
> Note: Make sure to run these commands in your sfdx-browserforce-plugin directory.
171
+
> [!NOTE]
172
+
> Make sure to run these commands in your sfdx-browserforce-plugin directory.
161
173
162
-
```console
174
+
```shell
163
175
npm run test
164
176
```
165
177
166
-
To run the **end to end tests**, you might want to create a new **default scratch org** first.
178
+
To run **end to end tests**:
167
179
168
-
> Note: Your default scratch org will be used in the tests!
180
+
> [!CAUTION]
181
+
> Your default scratch org will be used in the E2E tests!
169
182
170
-
```console
171
-
sf org create scratch -f config/project-scratch-def.json -d
183
+
```shell
184
+
npm run test:e2e -- -g "AdminsCanLogInAsAnyUser"# will only run tests matching `AdminsCanLogInAsAnyUser`
172
185
```
173
186
174
-
```console
175
-
npm run test:e2e
176
-
npm run test:e2e -- -g "AdminsCanLogInAsAnyUser" # will only run tests matching `AdminsCanLogInAsAnyUser`
187
+
> [!IMPORTANT]
188
+
> E2E tests should be implemented to be **re-runnable**.
189
+
>
190
+
> Please run the test at least 7 times to reduce the risk of a flaky implementation:
191
+
192
+
```shell
193
+
foriin {1..7};do npm run test:e2e -- -g "AdminsCanLogInAsAnyUser";done
177
194
```
178
195
179
-
> Note: You can run the e2e tests in non-headless mode (opening a browser) by setting the environment variable `BROWSER_DEBUG=true`.
180
-
> Note: You can also slow down the e2e test in non-headless mode by setting the environmnet variable, where the number is milliseconds of delay `BROWSER_SLOWMO=250`.
196
+
## Debugging
197
+
198
+
The [Salesforce CLI Plug-In Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_debug.htm) describes debugging sfdx plugins using VS Code very well.
Copy file name to clipboardExpand all lines: README.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ For example, the Currency Locale in `Setup -> Company Settings -> Company Inform
24
24
25
25
👉 This is where Browserforce (sfdx-browserforce-plugin) comes to the rescue. It fills this gap by applying these unsupported settings through browser automation!
26
26
27
-
# Example
27
+
##Example
28
28
29
29
To change the Currency Locale, the Browserforce config file (here: `./config/currency.json`) looks like this:
- 🔧 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
56
- 🧠 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
57
- 🏎️ browser automation powered by Puppeteer and "Chrome for Testing", [learn more about Puppeteer and Browserforce](#puppeteer)
58
58
59
-
# Supported Browserforce Settings
59
+
##Supported Browserforce Settings
60
60
61
61
Top settings:
62
62
@@ -75,11 +75,11 @@ But there's more:
75
75
- Please see the [Browserforce Settings](https://github.com/amtrack/sfdx-browserforce-plugin/wiki/Browserforce-Settings) wiki page with screenshots.
76
76
- 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
77
78
-
# Installation
78
+
##Installation
79
79
80
80
There are several different methods to install `sfdx-browserforce-plugin`:
- 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.
153
153
154
-
# Contributing
154
+
##Contributing
155
155
156
156
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for getting started.
0 commit comments