Total Complexity | 8 |
Complexity/F | 1 |
Lines of Code | 42 |
Function Count | 8 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /// <reference types="Cypress" /> |
||
3 | const promotionCodeFixedSelector = '#sw-field--promotion-code'; |
||
4 | |||
5 | describe('Promotion v2: Test crud operations', () => { |
||
6 | before(() => { |
||
7 | cy.onlyOnFeature('FEATURE_NEXT_12016'); |
||
|
|||
8 | }); |
||
9 | |||
10 | beforeEach(() => { |
||
11 | cy.setToInitialState().then(() => { |
||
12 | cy.loginViaApi(); |
||
13 | }).then(() => { |
||
14 | return cy.createDefaultFixture('promotion'); |
||
15 | }).then(() => { |
||
16 | cy.openInitialPage(`${Cypress.env('admin')}#/sw/promotion/v2/index`); |
||
17 | }); |
||
18 | }); |
||
19 | |||
20 | it('@base @marketing: generate and save a fixed promotion code', () => { |
||
21 | cy.server(); |
||
22 | cy.get('.sw-data-grid__cell--name > .sw-data-grid__cell-content > a').click(); |
||
23 | |||
24 | const testPromoCode = 'WelcomeIAmAPromotionCode'; |
||
25 | |||
26 | // Select fixed code type and edit manually |
||
27 | cy.get(promotionCodeFixedSelector).should('not.be.visible'); |
||
28 | cy.get('#sw-field--selectedCodeType').select('Fixed promotion code'); |
||
29 | cy.get(promotionCodeFixedSelector).should('be.visible'); |
||
30 | cy.get(promotionCodeFixedSelector).type(testPromoCode); |
||
31 | |||
32 | // Save |
||
33 | cy.get('.sw-promotion-v2-detail__save-action').click(); |
||
34 | cy.get('.sw-loader').should('not.be.visible'); |
||
35 | |||
36 | // Generate and check code |
||
37 | cy.get(promotionCodeFixedSelector).should('contain.value', testPromoCode); |
||
38 | cy.get('.sw-promotion-v2-detail-base__button-generate-fixed').click(); |
||
39 | cy.get(promotionCodeFixedSelector).should('not.contain.value', testPromoCode); |
||
40 | cy.get(promotionCodeFixedSelector).should((code) => { |
||
41 | expect(code[0].value).to.have.length(8); |
||
42 | }); |
||
43 | }); |
||
44 | }); |
||
45 |
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.