Skip to content

Commit

Permalink
Update README.md (#120)
Browse files Browse the repository at this point in the history
* Update README.md

Update "If you only need the Hyvä tests" section.

* Add emptyCart() function to the cart page-object.
  • Loading branch information
knospe- authored Dec 22, 2023
1 parent 0dce888 commit ff795e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ If you only need the Hyvä tests:

```
rm -rf cypress/{fixtures,page-objects,integration}/luma
rm -rf cypress/{integration}/luma-accessibility
```

If you only need the Luma tests;
Expand Down
14 changes: 14 additions & 0 deletions cypress/page-objects/luma/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,19 @@ export class Cart {
cy.get(cart.addCouponButton).click()
cy.wait(3000)
}

static emptyCart() {
cy.visit(cart.url.cartUrl)
cy.wait(3000)

cy.log('Check of the cart is already empty.')

cy.get('body').then((body) => {
if (body.find(cart.emptyCartTextField).length === 0) {
cy.get(cart.deleteProductButton).as('btn').should('be.visible')
cy.get('@btn').click({force: true, multiple: true})
}
});
}
}

0 comments on commit ff795e6

Please sign in to comment.