Passed
Push — develop ( acc51d...b423f4 )
by Bastien
01:55
created

operation_allcontent_delete_html-document.js ➔ describe(ꞌoperation :: workspace > delete > html-documentꞌ)   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 52
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 42
nc 1
dl 0
loc 52
rs 8.872
c 0
b 0
f 0
nop 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A operation_allcontent_delete_html-document.js ➔ ... ➔ it(ꞌall content > delete html-docꞌ) 0 42 1
A operation_allcontent_delete_html-document.js ➔ ... ➔ beforeEach 0 3 1
A operation_allcontent_delete_html-document.js ➔ ... ➔ ??? 0 4 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
describe('operation :: workspace > delete > html-document', function () {
2
  before(() => {
3
    cy.resetDB()
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...
4
    cy.setupBaseDB()
5
  })
6
7
  beforeEach(function () {
8
    cy.login('administrators')
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...
9
  })
10
  it('all content > delete html-doc', function () {
11
    cy.visit('/ui/workspaces/1/dashboard')
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...
12
    cy.get('.dashboard__workspace__detail').should('be.visible')
13
    cy.get('.dashboard__calltoaction .fa-file-text-o').should('be.visible')
14
    cy.get('.dashboard__calltoaction .fa-file-text-o').click()
15
    var titre1 = 'createhtml-document'
16
    cy.get('.cardPopup__container .createcontent .createcontent__contentname').should('be.visible')
17
    cy.get('.cardPopup__container .createcontent .createcontent__form__input').should('have.attr', 'placeholder')
18
    cy.get('.cardPopup__container .createcontent .createcontent__form__input').type(titre1)
19
    cy.get('.cardPopup__container .createcontent .createcontent__form__input').should('have.attr', 'value', titre1)
20
    cy.get('.cardPopup__container .createcontent .createcontent__form__button.btn-primary').click()
21
    cy.get('.cardPopup__container .createcontent .createcontent__contentname').should('not.be.visible')
22
    cy.get('.html-document.visible').should('be.visible')
23
    cy.get('.html-document.visible .html-document__contentpage__messagelist__version.revision').should('be.visible')
24
    cy.get('.html-document.visible .wsContentGeneric__header__title').contains(titre1)
25
    //        cy.get('iframe#wysiwygNewVersion_ifr').should('be.visible')
26
    //        const $tinymce = Cypress.$.event(document)
27
    cy.wait(2000)
28
    cy.get('.html-document.visible .wsContentGeneric__header__close.html-document__header__close').should('be.visible')
29
    cy.get('.html-document.visible .wsContentGeneric__header__close.html-document__header__close').click()
30
    cy.get('.html-document.visible').should('not.be.visible')
31
    cy.wait(2000)
32
    cy.get('.content__name').contains(titre1).should('be.visible')
33
    cy.visit('/ui/workspaces/1/contents')
34
    cy.get('.pageTitleGeneric__title__icon').should('be.visible')
35
    var titre1 = 'createhtml-document'
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable titre1 already seems to be declared on line 15. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
36
    cy.get('.content__name').each(($elm) => {
37
      cy.wrap($elm).invoke('text').then((text) => {
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...
38
        if (text === titre1) {
39
          cy.get('.content__name').contains(titre1).click()
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...
40
          cy.get('.html-document.visible').should('be.visible')
41
          cy.get('.html-document.visible .wsContentGeneric__header__title').contains(titre1)
42
          cy.wait(2000)
43
          cy.get('.align-items-center button:nth-child(2)').click()
44
          cy.get('.html-document__contentpage__textnote__state__btnrestore').should('be.visible')
45
          cy.get('.html-document__header__close').click()
46
          cy.get('.html-document.visible').should('not.be.visible')
47
          cy.wait(2000)
48
        }
49
      })
50
    })
51
  })
52
})
53