0

I'm confused on how to go about e2e testing an angular app running on grails. Grails is running my app and providing the endpoints, but the Karma suite only uses the browser as an engine to run the javascript. Therefore, my endpoints aren't in the "karma world" when the tests execute. How can I do something like the following?

describe('e2e', function() {

    beforeEach(function() {
        browser().navigateTo('/alerts/');
    });
}

Where the /alerts endpoint is defined and routed through grails. Can this be done, or do I have to setup some sort of grails-karma plugin?

Charles
  • 50,943
  • 13
  • 104
  • 142
Clev3r
  • 1,568
  • 1
  • 15
  • 28

1 Answers1

0

Yes it can be done. The test suite has to be served by (any) server. karma will not help much here, since you will have to setup a server anyway.

easier way : if your test suite is part of the web-app, the server is the grails one, and the test suite can be accessed with an url once the grails server is started. The tricky stuff is to have the correct url for brower().navigateTo(), the raw endpoint might the be the right one. Then automate the deletion of the test-suite from the web-app before to deliver into production.

other way : another server serves the test suite, and requests has to be redirected since you will have your Grails server and the test server. It keep things separated but you will have to modify your production code to test it, which is also not perfect.

bdavidxyz
  • 2,492
  • 1
  • 20
  • 40