isaacplmann / ngx-cypress-builder

Run e2e tests in the angular cli using cypress
18 stars 8 forks source link

Add run and open builder + sample #2

Closed b-barry closed 6 years ago

b-barry commented 6 years ago

Changelog:

Add new options for the builder i.e mode, reporterPath and env. We could add more if people request it

Reasons: 
- `reporterPath` option is needed if we would like to use a custom reporter such as mochawesome. Moreover, if you are setting your e2e into the projects folder, Cypress will have some difficulties to find the `node_modules` so we use this option to help him to locate the `reporter module` 
- `env` option is needed if we would like to provide some environment variable required during the execution of the test
- `mode` option to switch between `console`and `browser` running mode. Default value is `console`. `console` mode execute our tests and display it directly to the console. `browser`mode execute our tests and see them running directly in Chrome. So debugging feels easier 

Add sample to show how to execute cypress when his configuration is in the root folder

Reasons: 
- Project example to demonstrate that we could use this builder if we had the cypress folder in the root of the project. We have to update the path of the `root`property of the project in the `angular.json` 

Add sample to show how to execute cypress when his configuration is in the app folder

Reasons: 
    - Project example to demonstrate that we could use this builder if we had the e2e angular app located in the projects. We have to update the path of the `root` property of the project in the `angular.json` 

Add sample to show how to execute cypress in run or open mode

Reasons: 
        - Project example to demonstrate that we could use this builder to execute cypress in console or browser mode. Use the `cypress-open` builder for the browser mode and the `cypress-run` in the `angular.json` 

Breaking Changes:

The previous builder is replaced by the cypress-run, you may need to update the path of the root property of the project in the angular.json The version was bumped to 1.0.0

isaacplmann commented 6 years ago

😁I think you wrote more in this PR than I wrote initially. Could you talk through the changes you made and your reasons for making them?

b-barry commented 6 years ago

@isaacplmann I have made some update in my previous comment. Could you review it? Sorry for the big PR, we updated it in my project to fit our requirement. Your project was a good start for us πŸ’―

isaacplmann commented 6 years ago

Thanks for the run down. Why not use the same cypress builder and use configuration option to switch to open mode instead of the default run option?

It looks like there's just a couple lines of code that are different between the two builders. And it would save on writing an abstract class to share the code between the two.

isaacplmann commented 6 years ago

Oh, and I forgot to say thanks a lot for contributing! This is awesome work. You started using it in your app before I got around to it.

b-barry commented 6 years ago

@isaacplmann Update done. Do you have other remarks?

isaacplmann commented 6 years ago

Looks great. Thanks! πŸŽ‰