In Chapter 6, Testing and Continuous Integration, we saw that some of the e2e tests were commented out because of the difficulty in generating tests for an entity with a required relationship. Try to fix the tests with the following approach:
- Add a method to delete entities after creation, similar to what we saw in Chapter 6, Testing and Continuous Integration, for the customer entity spec.
- Uncomment the commented-out e2e tests in the files under src/test/javascript/e2e/entities.
- Navigate the protractor to the related entity page and create a new item. If the related entity has required relationships, then follow the same approach and nest them until all the required entities are in place. This can be done in a beforeAll method of the test as well.
- Now go back to the entity under test and see whether the test works fine.
- Once the test is complete, delete the created entities in the afterAll method of the test.
- Explore whether you can automate the creation of an entity item on the page object of the entity and use it when needed.