summaryrefslogtreecommitdiffstats
path: root/cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js
blob: 45badf1384f78141709c7662e8e9c0ba4c8b5d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
describe("General Page - E2E test flow with mock", () => {
  describe("Check Boolean DDL", () => {
    beforeEach(() => {
      cy.httpGenerateMappingRulesFileName();
      cy.httpGetDDLData();
      cy.httpCreateNewMcWithBooleanDDL();
      cy.getMCListEmpty();
      cy.homePage();
      cy.get('button[data-tests-id="btn-create-mc"]').click();
    });

    // it.only("Check boolean DDL with value undefined - using true, true - using
    // true and false" +     " - using false.", () => {   cy.fillNewMcForm();   cy
    //   .get('button[data-tests-id="createMonitoring"]')     .as("createButton")
    //  .not("[disabled]")     .should("not.contain", "Disabled");
    // cy.httpCreateNewMcWithBooleanDDL();   cy.emptyRuleEngine("Type1");   cy
    // .get("@createButton")     .click();   cy     .get("#ui-tabpanel-1-label")
    // .should("contain", "map")     .click();   cy
    // .get('button[data-tests-id="setting-gear"]')     .should("be.visible")
    // .first()     .click({multiple: true});   cy     .get(".map-setting-list
    // #mappingType > .field-text")     .should("have.value", "");   cy
    // .get(".map-setting-list > form > #valueUndefined > select")
    // .should("have.value", "true");   cy     .get(".map-setting-list > form >
    // #valueTrue > select")     .should("have.value", "true");   cy
    // .get(".map-setting-list > form > #valueFalse > select")
    // .should("have.value", "false"); });
  });

  describe("Create new MC", () => {
    beforeEach(() => {
      cy.httpGetDDLData();
      cy.getMCListEmpty();
      cy.homePage();
      cy.get('button[data-tests-id="btn-create-mc"]').click();
    });

    it("Create button need to be disabled", () => {
      cy
        .get('button[data-tests-id="createMonitoring"]')
        .should("be.visible")
        .and("be.disabled");
    });

    it("After submit advenced setting description exist in first input", () => {
      cy.fillNewMcForm();
      cy
        .get('button[data-tests-id="createMonitoring"]')
        .as("createButton")
        .not("[disabled]")
        .should("not.contain", "Disabled");

      cy.httpCreateNewMc();
      cy.emptyRuleEngine("Type1");

      cy.get("@createButton").click();
      cy
        .get("#ui-tabpanel-1-label")
        .should("contain", "map")
        .click();
      cy
        .get('button[data-tests-id="setting-gear"]')
        .should("be.visible")
        .first()
        .click({ multiple: true });

      cy
        .get(".map-setting-list #Type1 .help-description")
        .trigger("mouseenter")
        .get(".ui-tooltip")
        .should("be.visible")
        .should(
          "contain",
          "CSV to VES mapping, from the file to generate multiple events or single event"
        );
    });

    it("Fill form then click to submit verify setting button and constrain ddl", () => {
      cy.fillNewMcForm();
      cy
        .get('button[data-tests-id="createMonitoring"]')
        .as("createButton")
        .not("[disabled]")
        .should("not.contain", "Disabled");

      cy.httpCreateNewMc();
      cy.emptyRuleEngine("Type1");

      cy.get("@createButton").click();
      cy
        .get("#ui-tabpanel-1-label")
        .should("contain", "map")
        .click();
      cy
        .get('button[data-tests-id="setting-gear"]')
        .should("be.visible")
        .first()
        .click({ multiple: true });

      cy
        .get(".map-setting-list #mappingType > .field-text")
        .should("have.value", "");
    });
  });

  describe("Flow diagram", () => {
    beforeEach(() => {
      cy.httpGetDDLData();
      cy.getMCListEmpty();
      cy.homePage();
      cy.get('button[data-tests-id="btn-create-mc"]').click();
      cy.fillNewMcForm();
      cy.httpCreateNewMc();
      cy.get('button[data-tests-id="createMonitoring"]').click();
    });

    it("should flow diagram need to exist", () => {
      cy.get("#diagram").should("be.visible");
    });

    it("should flow diagram need to contain 4 connections", () => {
      cy
        .get("#diagram line")
        .its("length")
        .should("be.equal", 4);
    });
  });

  describe("Tabs after MC created", () => {
    beforeEach(() => {
      cy.httpGetDDLData();
      cy.getMCListEmpty();
      cy.homePage();
      cy.get('button[data-tests-id="btn-create-mc"]').click();
      cy.fillNewMcForm();
      cy.httpCreateNewMc();
      cy.get('button[data-tests-id="createMonitoring"]').click();
    });

    // it('should have 4 icon buttons in map tab', () => {   cy
    // .get('#ui-tabpanel-1-label')     .should('contain', 'map')     .click();   cy
    //     .get('.map-bar-icon-container>button')     .should('have.length', 2)
    // .get('.map-bar-icon-container>div>button')     .should('have.length', 2)
    // .and('be.visible'); }); it('should have 2 icon buttons in supplement tab', ()
    // => {   cy     .get('#ui-tabpanel-2-label')     .should('contain',
    // 'supplement')     .click();   cy
    // .get('.supplement-bar-icon-container>button')     .should('have.length', 2)
    // .and('be.visible')     .get('.supplement-bar-icon-container') .children()
    // .should('have.length', 3); });
  });
});