Workflow:
- Fork the repo.
- Clone your forked repository.
- Create a new branch
git checkout -b develop
. - Resolve tasks in the
cypress
/integration
/signIn.spec.js
. - Create a pull request.
App for testing: https://demoqa.com/login
Create your account before tests register page. Note: that action you should perform only once. Do not automate it!
Your task is to automate the next test cases:
- Login as your registered account
- Check your username after login username
- Navigate to books list
- Type into search field "Speaking JavaScript"
- Click on 'Speaking JavaScript' link
- Click on [Add To Your Collection] button on Speaking JavaScript preview page
- Confirm popup. You can do it with cy.on()
cy.on('window:alert', (str) => {
expect(str).to.equal(`Book added to your collection.`)
})
- Open your profile page
- Assert 'Speaking JavaScript' in your shopping list
- Delete Speaking JavaScript book from your list
In order to be logged in before each test, do the following:
- Create beforeEach method for login before your tests
- Add custom cypress cy.login(email, password) command (In this step you should not use cy.request)
- Move beforeEach method to support/index.js file and run login before each IT
- Rewrite Login method using cy.request().then((resp) => {resp.body.token ....})
- Add cookies to defaults
Cypress.Cookies.defaults({
preserve: [...]
})