1
|
|
|
/// <reference types="Cypress" /> |
2
|
|
|
|
3
|
|
|
import MediaPageObject from '../../../support/pages/module/sw-media.page-object'; |
4
|
|
|
|
5
|
|
|
describe('CMS: check validation of product detail page', () => { |
6
|
|
|
beforeEach(() => { |
7
|
|
|
cy.setToInitialState() |
|
|
|
|
8
|
|
|
.then(() => { |
9
|
|
|
cy.loginViaApi(); |
|
|
|
|
10
|
|
|
}) |
11
|
|
|
.then(() => { |
12
|
|
|
return cy.createCmsFixture(); |
|
|
|
|
13
|
|
|
}) |
14
|
|
|
.then(() => { |
15
|
|
|
cy.viewport(1920, 1080); |
|
|
|
|
16
|
|
|
cy.openInitialPage(`${Cypress.env('admin')}#/sw/cms/index`); |
|
|
|
|
17
|
|
|
}); |
18
|
|
|
}); |
19
|
|
|
|
20
|
|
|
it('@content: create product detail page', () => { |
21
|
|
|
cy.onlyOnFeature('FEATURE_NEXT_10078'); |
|
|
|
|
22
|
|
|
|
23
|
|
|
cy.server(); |
24
|
|
|
cy.route({ |
25
|
|
|
url: `${Cypress.env('apiPath')}/cms-page`, |
|
|
|
|
26
|
|
|
method: 'post' |
27
|
|
|
}).as('saveData'); |
28
|
|
|
|
29
|
|
|
// Fill in basic data |
30
|
|
|
cy.contains('Create new layout').click(); |
31
|
|
|
cy.get('.sw-cms-detail').should('be.visible'); |
32
|
|
|
cy.contains('.sw-cms-create-wizard__page-type', 'Product page').click(); |
33
|
|
|
cy.get('.sw-cms-create-wizard__title').contains('Choose a section type to start with.'); |
34
|
|
|
cy.contains('.sw-cms-stage-section-selection__default', 'Full width').click(); |
35
|
|
|
cy.get('.sw-cms-create-wizard__title').contains('How do you want to label your new layout?'); |
36
|
|
|
cy.contains('.sw-button--primary', 'Create layout').should('not.be.enabled'); |
37
|
|
|
cy.get('#sw-field--page-name').typeAndCheck('PDP Layout'); |
38
|
|
|
cy.contains('.sw-button--primary', 'Create layout').should('be.enabled'); |
39
|
|
|
cy.contains('.sw-button--primary', 'Create layout').click(); |
40
|
|
|
cy.get('.sw-loader').should('not.exist'); |
41
|
|
|
cy.get('.sw-cms-section__empty-stage').should('not.be.visible'); |
42
|
|
|
cy.get('.sw-cms-block-product-heading').should('be.visible'); |
43
|
|
|
|
44
|
|
|
cy.get('.sw-cms-detail__save-action').click(); |
45
|
|
|
|
46
|
|
|
// Shows layout assignment modal the first time saving after the wizard |
47
|
|
|
cy.get('.sw-cms-layout-assignment-modal').should('be.visible'); |
48
|
|
|
cy.get('.sw-cms-product-assignment-select').should('be.visible'); |
49
|
|
|
|
50
|
|
|
// Confirm without layout |
51
|
|
|
cy.get('.sw-cms-layout-assignment-modal__action-confirm').click(); |
52
|
|
|
cy.get('.sw-cms-layout-assignment-modal').should('not.be.visible'); |
53
|
|
|
cy.get('.sw-cms-detail__save-action').click(); |
54
|
|
|
}); |
55
|
|
|
}); |
56
|
|
|
|
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.