salesforcelts

Can't run Lightning Testing Service (LTS) for Salesforce


I have been using SFDX to automate Salesforce development for a little while now with Teamcity. SFDX doesn't always provide the best error messages but the documentation is usually very helpful. Well, or so I thought, until I started working with LTS. Here's the documentation to install LTS - https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_testing_install.htm. I have read the docs and followed the instructions but I cannot get LTS to work for me. I am able to create a scratch org, and install LTS but I am not able to run the tests.

sfdx force:lightning:test:run -a jasmineTests.app The following command allows you to run the sample Jasmin test. Whenever I try that command I get the following error: ERROR running force:lightning:test:run: Unable to connect to selenium. In the documentation, it doesn't specify the server requiring selenium.

Although the docs don't mention anything about selenium, I have tried downloading selenium-standalone-chrome. I tried running selenium/standalone-chrome as a docker container. But it doesn't work.

Links tried: https://github.com/forcedotcom/LightningTestingService/issues/46 https://github.com/forcedotcom/LightningTestingService/issues/46#issuecomment-457829523 https://github.com/forcedotcom/LightningTestingService/issues/46#issuecomment-347928851

Please help, I have tried almost everything.


Solution

  • Updating the answer in case anyone ever runs into this issue... I got it to work! It turns out that the link I shared above was helpful after all LINK: https://github.com/forcedotcom/LightningTestingService/issues/46

    1. I had to add a variable SELENIUM_REMOTE_URL=http://selenium:4444/wd/hub/ to TeamCity
    2. And create a docker-compose.yml to start up selenium/standalone-chrome:latest
    version: "3"
    services:
      selenium:
        image: selenium/standalone-chrome:latest
        ports:
          - "4444:4444"