This repository contains the source code for the automation tests for the Salesforce Extensions for VS Code.
This project is based on ExTester, available at https://github.com/redhat-developer/vscode-extension-tester
If you are interested in contributing, please take a look at the CONTRIBUTING guide.
After cloning this repo, you will also need to have a folder called salesforcedx-vscode
residing side-by-side in the same parent location, and have the vsixes you want to test in salesforcedx-vscode/extensions
directory. e.g:
.
├── ...
├── salesforcedx-vscode-automation-tests-redhat # E2E Tests repo
├── salesforcedx-vscode
│ └── extensions # Directory containing the salesforce extensions
│ ├── salesforcedx-vscode-core-63.0.0.vsix
│ ├── salesforcedx-vscode-apex-63.0.0.vsix
│ └── ...
└── ...
To install the test dependencies, run npm install
. You do not need to compile - when running the e2e automation tests, the code is dynamically compiled.
The following is a list of environment variables that are used with this project. Each has a default value and are obtained using the environmentSettings class.
-
DEV_HUB_ALIAS_NAME
- Default value:
vscodeOrg
- Default value:
-
DEV_HUB_USER_NAME
- Default value:
svcideebot@salesforce.com
- Default value:
-
EXTENSION_PATH
-
Default value:
{cwd}/../../salesforcedx-vscode/extensions
Note: If your folder structure does not match the folder structure shown above in Getting Started section,
EXTENSION_PATH
will need to be set to the relative path to 'salesforcedx-vscode/extensions'. If it does match, then no changes are needed.
-
-
THROTTLE_FACTOR
- Default value:
1
- Default value:
-
SFDX_AUTH_URL
- Provides the dev hub auth URL to be used to authenticate the dev hub as part of test setup. There is no default value. In order to get it, run
sf org display -o vscodeOrg --verbose --json
in your terminal and get the value fromsfdxAuthUrl
property.
- Provides the dev hub auth URL to be used to authenticate the dev hub as part of test setup. There is no default value. In order to get it, run
-
SPEC_FILES (optional)
- Used to specify the name of the file from which you want to run the tests. Note that it needs to be the compiled file, so it should have a
.js
extension. For example:soql.e2e.js
- Used to specify the name of the file from which you want to run the tests. Note that it needs to be the compiled file, so it should have a
A requirement of this project is for a Dev Hub to have been enabled on the user's machine. The default Dev Hub name is "vscodeOrg" and the default username is "svcideebot@salesforce.com", though this can be configured with the DEV_HUB_ALIAS_NAME
and DEV_HUB_USER_NAME
environment variables.
Run Task: Authorize DevHub - E2E Testing Org
through command palette (Cmd+shift+P).
Once you are connected to the org with DEV_HUB_ALIAS_NAME
and DEV_HUB_USER_NAME
, you can run a single or all end-to-end test suites.
After the dependencies have been installed, the vsixes downloaded and stored in the right folder, and the environment variables have been set, open salesforcedx-vscode-automation-tests-redhat
repo in Visual Studio Code, then debug using the Debug Automation Test from env var SPEC_FILES
configuration in RUN AND DEBUG section in the left sidebar.
Note: At this point you should already have authorized vscodeOrg
which will be used as your target DevHub, so don't forget to comment out await this.setupAndAuthorizeOrg();
in setup() method from test-setup-and-runner so you don't run into errors during setup while running E2E Tests locally.
Note: if no changes are made to _specFiles
property in environmentSettings class, then all tests will be run. If you want to run only some, comment out './test/specs/**/*.e2e.ts'
line in that file and uncomment the tests you want to run.