Conditions | 1 |
Paths | 1 |
Total Lines | 52 |
Code Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | describe('operation :: workspace > delete > html-document', function () { |
||
2 | before(() => { |
||
3 | cy.resetDB() |
||
|
|||
4 | cy.setupBaseDB() |
||
5 | }) |
||
6 | |||
7 | beforeEach(function () { |
||
8 | cy.login('administrators') |
||
9 | }) |
||
10 | it('all content > delete html-doc', function () { |
||
11 | cy.visit('/ui/workspaces/1/dashboard') |
||
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' |
||
36 | cy.get('.content__name').each(($elm) => { |
||
37 | cy.wrap($elm).invoke('text').then((text) => { |
||
38 | if (text === titre1) { |
||
39 | cy.get('.content__name').contains(titre1).click() |
||
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 |
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.