Closed qiyi-jiang closed 3 years ago
Current setup: FE: Cypress, BE: RSpec
Observations
Conclusion BE RSpec with Capybara will be used for these all-in-one test cases.
SeleniumDriver
, that is used by Capybara
, supports a number of browser engines to test with:
https://www.rubydoc.info/github/jnicklas/capybara/Capybara/Selenium/Driver
Considerations:
section of the issue.No.2 - Configure RSpec so a specific command could initiate or mount the FE (in testing env) before running test cases. No.4 - Figure out and setup the best testing cloud for testing email and SMS retrieval - for now Mailinator.
These are to be addressed first - as they are the prerequisite technical hurdles to overcome for the whole plan to fall into place.
By implementing this testing setup, we will have 3 different types of testing setups:
I don't think we should get rid of FE Cypress setup in any cases. It is much more productive and atomic to write the FE-only test cases using FE Cypress rather than through all-in-one RSpec/Capybara. Moreover, Cypress has some advantages over Capybara when it comes to synchronous FE testing (i.e. the ability to listen to FE events when compared to Capybara's waiting strategy) Same with BE-only test cases.
In other words, we use 3 different setups depending on the nature/context of the test cases.
I don't want to use Capybara/RSpec for testing because it requires that you have access to the database directly.
So in theory, these end to end tests should be able to run by using the API endpoints for set up and tear down. This way you'd actually be able to run the tests against a staging instance or even the production server.
This will also drive us to create API endpoints that will allow us to perform any number of needed operations in the app.
@ever-dev What do you think?
By means of end-to-end testing, it should test an application workflow from beginning to end. For example, for a user, create, update, delete, modify actions should be tested. But some of those behaviors are missing due to application spec, and also it's impossible to test all cases when the data is vary depending on the date and time.
The easiest way to overcome this is to set a proper value in the database before we test. For this, we might need to provide some APIs to set values in the database, only for testing purposes. In this case, we must make sure that these APIs are not available to call outside of the testing framework.
One thing to consider when we try to test on the production server, the data created for/by testing should not affect the others at all.
I'm not sure how Capybara/RSpec works but for Cypress, we are able to call actual API endpoints and get responses from them. I'll take a look at Capybara/RSpec and add my thoughts on that later.
Question: Is there any way to check third-party libraries? For example, how can we check whether the email is delivered to the user correctly?
To-dos on BE
Until No.3, will be using a predefined/fixed token for the minimal blocking situation.
@ever-dev Here ^
Considerations:
The scenarios where front-end behavior, back-end assertions and assertions on 3rd-party testing clouds are to be in a single test case/flow and verified as a whole. e.g. MAGIC SIGN-IN