Skip to content

Integration testing

гλ requested to merge 133-setup-integration-testing into master

Because I fixed up all our linting errors this is a large PR - Happy to split it into multiple pieces if you want but they will need to be merged in the correct order.

With reference to #133 (closed)

Benefits we gain from this:

  • We can start creating cypress e2e & integration tests for BEPSWAP
  • We can actually run unit tests in CI as I deleted redundant tests
  • This fixes hundreds of linting errors
  • Further linting errors will now break the build as they should since they lead to error reduction.
  • Begin to work towards a shared testing methodology PLEASE COMMENT!

Some contentious things here:

  • Decided to eject CRA as opposed to fork or rewire it
    • Why?
      • Project was not configured correctly - eslint was not being picked up by CRA as it is built in.
      • It is the second time I have needed to customise webpack and babel config
        • Here I needed to alter the build script to filter out warnings
        • Styled components really benefits from using the babel plugin but using rewire type hacks make
      • react devtools in chrome does not work with react-app-rewire.
      • Maintaining two repos just for being able to configure webpack and babel seems like more work than maintaining one as you need PRs in both repos

This PR does the following:

  • Install cypress
  • Update README.md with docs on building feature tests
  • Install a simple file server to run in script ci tests against without requiring deployment
  • Allow for running tests against remote server with yarn ci:run
  • Provide super simple smoke test example - more to follow
  • Removed redundant tests from codebase.
  • Ejected create-react-app to be able to gain access to webpack config.
  • Fixed a tonne of linting errors preventing the project from being built using CI.
  • Escaped @binance-chain/javascript-sdk warnings in build script which prevented build from working without removing the ability for lint errors to break the build (as they should)
  • Setup asset cache within gitlab for cypress videos to be hosted for a week

I have included an opinionated document outlining some of my suggestions in terms of testing philosophy for the front end based on practices I have seen work. This is just my opinion - lets work on this all together.

When reviewing this PR please test the functionality well as there are a lot of changes however I don't expect anything to be broken.

Maybe have a read here: https://gitlab.com/thorchain/bepswap/bepswap-react-app/blob/133-setup-integration-testing/docs/proposals/TESTING.md

Not part of this:

  • Cache yarn modules
  • Optimise build assets
  • Demonstrate how to mock external API calls with cypress
Edited by гλ

Merge request reports