The github.com/salesforce/utam-js-wdio-boilerplate
repo includes a simple boilerplate UTAM page object and an end-to-end test file.
-
Clone or fork the repo.
$ git clone https://github.com/salesforce/utam-js-wdio-boilerplate.git $ cd utam-js-wdio-boilerplate
-
Install Volta, which ensures that you use the correct versions of Node.js and Yarn. Volta isn't required, but we recommend it.
If you installed Volta, run this command in
utam-js-wdio-boilerplate
:$ volta install node yarn
If you installed
Volta
from homebrew, you might need to runvolta setup
aftervolta install
and open a new terminal.The command installs Node 14.15.1 and Yarn 1.22.5 and configures your environment.
If you don't install Volta, install Node.js and Yarn:
To ensure you're all set, run:
$ node -v # v14.15.1 $ yarn -v # v1.22.5
-
Install project dependencies.
Run this command to install the project dependencies:
$ yarn install
-
In
package.json
, update thechromedriver
version to match your local version of Google Chrome web browser (It will run fine otherwise, but you will avoid downloading the binary).To find your local version of Chrome, in the Chrome address bar, enter
chrome://settings/help
.Then update
package.json
. For example, if your local version is 88, add:"chromedriver": "^88.0.0",
-
Generate page objects.
$ yarn build
The UTAM compiler generates JavaScript code from the JSON page objects in
src/__utam__
. The generated JavaScript files are stored inpageObjects
. -
Run tests.
To run all tests, enter
yarn test
.To run an individual test, specify the path to the test file. For example:
$ yarn test --spec src/test/example.spec.ts
UTAM is flexible—it isn't tied to a particular test automation framework or language.
This particular repo uses Typescript, and WebdriverIO with Jasmine.