Total Complexity | 9 |
Complexity/F | 1 |
Lines of Code | 75 |
Function Count | 9 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | describe('Test if breadcrumb works correctly', () => { |
||
2 | beforeEach(() => { |
||
3 | cy.setToInitialState() |
||
|
|||
4 | .then(() => { |
||
5 | cy.searchViaAdminApi({ |
||
6 | endpoint: 'category', |
||
7 | data: { |
||
8 | field: 'name', |
||
9 | value: 'Home' |
||
10 | } |
||
11 | }).then(({id: categoryId}) => { |
||
12 | cy.createCategoryFixture({ |
||
13 | name: 'Test category 1', |
||
14 | type: 'folder', |
||
15 | parentId: categoryId, |
||
16 | children: [ |
||
17 | { |
||
18 | name: 'Sub 1', |
||
19 | type: 'page' |
||
20 | } |
||
21 | ] |
||
22 | }); |
||
23 | |||
24 | cy.createCategoryFixture({ |
||
25 | name: 'Test category 2', |
||
26 | type: 'page', |
||
27 | parentId: categoryId, |
||
28 | children: [ |
||
29 | { |
||
30 | name: 'Sub 2', |
||
31 | type: 'page' |
||
32 | } |
||
33 | ] |
||
34 | }); |
||
35 | |||
36 | cy.createCategoryFixture({ |
||
37 | name: 'Test category 3', |
||
38 | type: 'link', |
||
39 | parentId: categoryId, |
||
40 | children: [ |
||
41 | { |
||
42 | name: 'Sub 3', |
||
43 | type: 'page' |
||
44 | } |
||
45 | ] |
||
46 | }); |
||
47 | }); |
||
48 | }).then(() => { |
||
49 | cy.visit('/'); |
||
50 | }); |
||
51 | }); |
||
52 | |||
53 | it('@breadcrumb: Check if correct category types are clickable', () => { |
||
54 | cy.get('.nav-link.main-navigation-link').contains('Test category 1').trigger('mouseenter').then(() => { |
||
55 | cy.get('.navigation-flyout-content').should('be.visible'); |
||
56 | cy.get('.nav-link.navigation-flyout-link').contains('Sub 1').click(); |
||
57 | |||
58 | cy.get('.cms-breadcrumb .breadcrumb-container').contains('Test category 1').should('have.prop', 'tagName' ).should('eq', 'DIV'); |
||
59 | }); |
||
60 | |||
61 | cy.get('.nav-link.main-navigation-link').contains('Test category 2').trigger('mouseenter').then(() => { |
||
62 | cy.get('.navigation-flyout-content').should('be.visible'); |
||
63 | cy.get('.nav-link.navigation-flyout-link').contains('Sub 2').click(); |
||
64 | |||
65 | cy.get('.cms-breadcrumb .breadcrumb-container').contains('Test category 2').should('have.prop', 'tagName' ).should('eq', 'A'); |
||
66 | }); |
||
67 | |||
68 | cy.get('.nav-link.main-navigation-link').contains('Test category 3').trigger('mouseenter').then(() => { |
||
69 | cy.get('.navigation-flyout-content').should('be.visible'); |
||
70 | cy.get('.nav-link.navigation-flyout-link').contains('Sub 3').click(); |
||
71 | |||
72 | cy.get('.cms-breadcrumb .breadcrumb-container').contains('Test category 3').should('have.prop', 'tagName' ).should('eq', 'A'); |
||
73 | }); |
||
74 | }); |
||
75 | }); |
||
76 |
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.