- Fork the repo.
- Clone your forked repository.
- Run the command
npm i -D @types/cypress@latest
. - Create a new branch
git checkout -b testing
. - Resolve tasks in the
cypress
/e2e
/signUp.cy.js
. - Create a pull request.
- Do not forget to click on
Re-request review
if you submit the homework after previous review.
App for testing: https://react-redux.realworld.io
Your task is to automate the next flow:
- Go to "Sign Up" page.
- Fill in username, email, and password fields using
generateUser
method. - Click on [Sign up] button.
- Assert your username appeared in site navigation (header) menu.
To install faker
plugin, run the command: npm install [email protected]
.
To use faker
in your tests, go to support
/generate.js
file and write the next code:
const faker = require('faker');
function generateUser() {
const random = Math.random().toString().slice(2, 6);
const username = faker.internet.userName() + '_' + random;
const email = `${username}@mail.com`;
const password = '12345Qwert!';
return { email, password, username };
}
module.exports = { generateUser };
Now, you can generate a new user in your tests:
const { generateUser } = require('../support/generate');
describe('Sign Up page', () => {
it('should provide an ability to register new account', () => {
const user = generateUser();
<your_code>
});
});