mardi 11 septembre 2018

Front-end testing using React and Selenium-Webdriver with Rails as Backend

Background

I have a robust Ruby on Rails (V3.2) backend app and an entiry new and separate front-end app with ReactJs (V16.4).

Problem

We begin to test React app with the help of Selenium-Webdriver and JestJs, we managed to try several views, but the problem arose when we made POST requests to the rails API.

I don't want to fill my database (development) with garbage because of the tests.

Ex: What happens when I want to test the creation of a new user?.

Possible solutions thought

I was thinking in 3 solutions:

  1. Intercept the calls to the api and mock them by imitating their response (ex: at submitting click using selenium-webdriver).
  2. Make use of Rails test environment through React
  3. Just revert the call of the API doing the opposite, this would mean creating often undesirable actions in the controller. (ex: doing a delete for each post)

Aucun commentaire:

Enregistrer un commentaire