This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LeanFT Headless Chrome on Angular Apps

I have an Angular 8 apps for testing. In the normal Chrome, with LeanFT 14.53, the UI testing works fine. But when I switch to Headless Chrome type execution, LeanFT is not able to identify the Angular components. 

If there any special settings or commands that need to be added to resolve this issue.

  • 0

    By default, when we do npm run test, our unit tests are set up to watch for updates in the code and then run each time there are changes. However, we are targeting a test script that can eventually be used for continuous integration. So, let’s configure a new npm script to run our unit tests only once using Headless Chrome and then exit.

    In package.json we just need to add a new entry called test-headless in our scripts. It should look something like this:

    "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "test-headless": "ng test --watch=false --browsers=ChromeHeadless",
    "lint": "ng lint",
    "e2e": "ng e2e"
    },

    Note the flags:

    • --watch=false
      Specifies that we only want the tests to run once and then exit instead of watching for changes.
    • --browsers=ChromeHeadless
      Specifies that we want to use Headless Chrome as the browser for the tests.