- Fork the repo.
- Clone your forked repository.
- Run
npm i. - Create a new branch
git checkout -b e2e_testing. - Run the app.
- Resolve tasks.
- Check yourself before submitting the task with a Cypress checklist.
- Create a pull request.
- Do not forget to click on
Re-request reviewif you submit the homework after previous review.
Go to e2e folder and cover listed functionality with e2e tests:
- creating an article;
- editings an article;
- deleting an article;
- sign in (positive);
- sign in (invalid credentials);
- sign up (positive);
- sign up (negative);
- following/unfollowing the user;
- updating bio;
- updating username;
- updating email;
- updating password.
- Clear all data from the database before the test.
- Add
data-qaattributes for all elements you are working with in tests. - Use faker and custom methods to generate a fake data in tests.
Use PageObject pattern for your tests:
- Create a files with POM classes for your pages in
cypress/support/pages. - Use
PageObject.jsfile for the common for the whole app elements.
Observe an example in cypress/e2e/signIn.cy.js.
Find and additinoanl about Page Object in the Cypress topic.
Hint
💡 Usually, front-end tests rely on specific
data-* attributes to locate elements on the page. However, there might be cases when these attributes are missing in the front-end application code, so you might need to add them yourself. If your tests fail because elements cannot be found, double-check that necessary attributes are added in the component files and that your latest changes are pushed to the repository.
