Autogenerating user test data

We cannot rely on fixed data in our test because previously registered users cannot register. We need to autogenerate the user's test data, mainly username, email address, first name, and last name. We can use a fixed password. The generated data must be accessible by other tests as well.

The perfect place to do that is in the end-to-end test file for the register page. We can add the logic of auto-generating to the before() method and save the data into frontend/tests/e2e/data/user.js. In the tests for the register page, we will use the generated user data to test the registration. In other tests, like the tests on the login page, we can import data/user.js and use the generated data to log in.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.119.81