Search code examples
angularjsspring-bootcucumberbdd

E2E Tests With SpringBoot Backend and Angular Frontend


I am working on an application which has 2 modules.

  1. server module which is SpringBoot.
  2. ui which is in Angular

I am unable to run any E2E tests for my application as it is not starting before the tests run. I have below defined in the test class which should bring up the application context but it seems it does not.

@ContextConfiguration(classes=Application.class, loader = SpringBootContextLoader.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)

The application does start fine and run proper on localhost:8080 when I start the application normally using the run button in my IDE. I am not sure why does the application not come up when I try to run the tests.

Is it because of the different modules?


Solution

  • The issue was not with the modules. There were 2 issues,

    1. I was using an older version of Chrome driver for running the tests.
    2. The E2E tests were trying to access the application using https but the certificates I was using were self signed certificates. To overcome this, I added the below argument to my chromeoptions.

    chromeOptions.addArguments("allow-insecure-localhost");