1 | let product = {}; |
||
2 | |||
3 | describe('Test if the offcanvas menus could be closed with the browser back button', () => { |
||
4 | beforeEach(() => { |
||
5 | cy.setToInitialState().then(() => { |
||
0 ignored issues
–
show
|
|||
6 | cy.createProductFixture().then(() => { |
||
0 ignored issues
–
show
The variable
cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN.
Loading history...
|
|||
7 | return cy.createDefaultFixture('category'); |
||
0 ignored issues
–
show
The variable
cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN.
Loading history...
|
|||
8 | }).then(() => { |
||
9 | return cy.fixture('product'); |
||
0 ignored issues
–
show
The variable
cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN.
Loading history...
|
|||
10 | }).then((result) => { |
||
11 | product = result; |
||
12 | cy.visit('/'); |
||
0 ignored issues
–
show
The variable
cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN.
Loading history...
|
|||
13 | }); |
||
14 | }); |
||
15 | }); |
||
16 | |||
17 | it('Should close offcanvas on browser back', () => { |
||
18 | // set to mobile viewport |
||
19 | cy.viewport(360, 640); |
||
0 ignored issues
–
show
The variable
cy seems to be never declared. If this is a global, consider adding a /** global: cy */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN.
Loading history...
|
|||
20 | |||
21 | // go to product |
||
22 | cy.get('.search-toggle-btn').click(); |
||
23 | cy.get('.header-search-input').should('be.visible'); |
||
24 | cy.get('.header-search-input').type(product.name); |
||
25 | cy.get('.search-suggest-product-name').contains(product.name); |
||
26 | cy.get('.search-suggest-product-price').contains(product.price[0].gross); |
||
27 | cy.get('.search-suggest-product-name').click(); |
||
28 | cy.get('.product-detail-name').contains(product.name); |
||
29 | |||
30 | // open offcanvas (product description) |
||
31 | cy.get('#description-tab').click(); |
||
32 | cy.get('.offcanvas.is-open').should('be.exist'); |
||
33 | cy.get('.offcanvas .product-detail-description-title').contains(product.name); |
||
34 | |||
35 | // close offcanvas with browser back |
||
36 | cy.go('back'); |
||
37 | cy.get('.offcanvas').should('not.exist'); |
||
38 | |||
39 | // ensure, it is still the product detail page |
||
40 | cy.get('.product-detail-name').contains(product.name); |
||
41 | |||
42 | // ensure normal closing via click still works |
||
43 | cy.get('.header-cart').click(); |
||
44 | cy.get('.offcanvas.is-open').should('be.exist'); |
||
45 | cy.get('.offcanvas .offcanvas-cart-header').contains('Shopping cart'); |
||
46 | cy.get('.offcanvas.is-open .offcanvas-close').click(); |
||
47 | cy.get('.offcanvas').should('not.exist'); |
||
48 | |||
49 | // ensure, it is still the product detail page |
||
50 | cy.get('.product-detail-name').contains(product.name); |
||
51 | }); |
||
52 | }); |
||
53 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.