Passed
Push — master ( 613332...527243 )
by Christian
12:35 queued 10s
created

src/Administration/Resources/app/administration/test/e2e/cypress/integration/content/sw-cms/save-product-page.spec.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 53
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 37
mnd 0
bc 0
fnc 6
dl 0
loc 53
rs 10
bpm 0
cpm 1
noi 7
c 0
b 0
f 0
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()
0 ignored issues
show
Bug introduced by
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
                cy.loginViaApi();
0 ignored issues
show
Bug introduced by
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
            })
11
            .then(() => {
12
                return cy.createCmsFixture();
0 ignored issues
show
Bug introduced by
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
            .then(() => {
15
                cy.viewport(1920, 1080);
0 ignored issues
show
Bug introduced by
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...
16
                cy.openInitialPage(`${Cypress.env('admin')}#/sw/cms/index`);
0 ignored issues
show
Bug introduced by
The variable Cypress seems to be never declared. If this is a global, consider adding a /** global: Cypress */ 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...
17
            });
18
    });
19
20
    it('@content: create product detail page', () => {
21
        cy.onlyOnFeature('FEATURE_NEXT_10078');
0 ignored issues
show
Bug introduced by
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...
22
23
        cy.server();
24
        cy.route({
25
            url: `${Cypress.env('apiPath')}/cms-page`,
0 ignored issues
show
Bug introduced by
The variable Cypress seems to be never declared. If this is a global, consider adding a /** global: Cypress */ 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...
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