|
17 | 17 |
|
18 | 18 | const sitesSelectors = require('../../libs/commons/sitesSelectors'), |
19 | 19 | afConstants = require('../../libs/commons/formsConstants'); |
| 20 | +const formsSelectors = require("../../libs/commons/guideSelectors"); |
20 | 21 |
|
21 | 22 | /** |
22 | 23 | * Testing CheckBoxGroup with Sites Editor |
@@ -49,15 +50,6 @@ describe('Page - Authoring', function () { |
49 | 50 | .then(cy.wrap) |
50 | 51 | } |
51 | 52 |
|
52 | | - const getRuleEditorIframe = () => { |
53 | | - // get the iframe > document > body |
54 | | - // and retry until the body element is not empty |
55 | | - return cy |
56 | | - .get('iframe#af-rule-editor') |
57 | | - .its('0.contentDocument.body').should('not.be.empty') |
58 | | - .then(cy.wrap) |
59 | | - } |
60 | | - |
61 | 53 | const testCheckBoxGroupBehaviour = function(checkBoxGroupEditPathSelector, checkBoxGroupDrop, isSites) { |
62 | 54 | if (isSites) { |
63 | 55 | dropTextInputInSites(); |
@@ -211,34 +203,37 @@ describe('Page - Authoring', function () { |
211 | 203 | }); |
212 | 204 |
|
213 | 205 | // adding retry since rule editor sometimes does not open at first try |
214 | | - it('rule editor is working with rich text enum names', { retries: 3 }, function(){ |
| 206 | + it('rule editor is working with rich text enum names', {retries: 2}, function () { |
215 | 207 | cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + checkBoxGroupEditPathSelector); |
216 | | - cy.invokeEditableAction("[data-action='editexpression']"); |
217 | | - cy.get("#af-rule-editor").should("be.visible"); |
218 | | - getRuleEditorIframe().find("#objectNavigationTree").should("be.visible"); |
219 | | - getRuleEditorIframe().find("#create-rule-button").click(); |
220 | | - getRuleEditorIframe().find('#create-rule-button').then(($el) => { |
221 | | - $el[0].click(); |
222 | | - getRuleEditorIframe().find('.child-choice-name').click(); |
223 | | - getRuleEditorIframe().find('coral-selectlist-item[value="EVENT_SCRIPTS"]').then(($el) => { |
224 | | - $el[0].scrollIntoView(); |
225 | | - $el[0].click(); |
226 | | - getRuleEditorIframe().find('.EVENT_AND_COMPARISON_OPERATOR').then(($el) => { |
227 | | - $el[0].click(); |
228 | | - getRuleEditorIframe().find('coral-selectlist-item[value="CONTAINS"]').then(($el) => { |
229 | | - $el[0].click(); |
230 | | - getRuleEditorIframe().find('.PRIMITIVE_EXPRESSION .NUMERIC_LITERAL button').then(($el) => { |
231 | | - $el[0].click(); |
232 | | - getRuleEditorIframe().find('[handle="selectList"] coral-list-item-content').first().should("have.text", "Select 1"); |
233 | | - }); |
234 | | - }); |
235 | | - }); |
236 | | - }); |
237 | | - getRuleEditorIframe().find('.exp-Close-Button').then(($el) => { |
238 | | - $el[0].click(); |
239 | | - }); |
240 | | - }); |
241 | | - }); |
| 208 | + cy.get(formsSelectors.ruleEditor.action.editRule).should("exist"); |
| 209 | + cy.initializeEventHandlerOnChannel("af-rule-editor-initialized").as("isRuleEditorInitialized"); |
| 210 | + cy.get(formsSelectors.ruleEditor.action.editRule).click(); |
| 211 | + |
| 212 | + // click on create option from rule editor header |
| 213 | + cy.get("@isRuleEditorInitialized").its('done').should('equal', true); |
| 214 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.action.createRuleButton).should("be.visible").click(); |
| 215 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.action.sideToggleButton + ":first").click(); |
| 216 | + |
| 217 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.STATEMENT + " .child-choice-name").should("exist"); |
| 218 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.STATEMENT + " .child-choice-name").click(); |
| 219 | + |
| 220 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.STATEMENT + " .expeditor-customoverlay.is-open coral-selectlist-item[value='EVENT_SCRIPTS']") |
| 221 | + .click({force: true}); |
| 222 | + |
| 223 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.EVENT_AND_COMPARISON_OPERATOR + " .choice-view-default").should("exist"); |
| 224 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.EVENT_AND_COMPARISON_OPERATOR + " .choice-view-default").click(); |
| 225 | + |
| 226 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.operator.CONTAINS).should("exist"); |
| 227 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.operator.CONTAINS).click(); |
| 228 | + |
| 229 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.PRIMITIVE_EXPRESSION + " .NUMERIC_LITERAL button").should("exist"); |
| 230 | + cy.getRuleEditorIframe().find(formsSelectors.ruleEditor.choiceModels.PRIMITIVE_EXPRESSION + " .NUMERIC_LITERAL button").first().click(); |
| 231 | + |
| 232 | + cy.getRuleEditorIframe().find('[handle="selectList"] coral-list-item-content').first().contains("Select 1"); |
| 233 | + cy.getRuleEditorIframe().find('.exp-Cancel-Button').click(); |
| 234 | + cy.getRuleEditorIframe().find('.exp-Close-Button').click(); |
| 235 | + cy.deleteComponentByPath(checkBoxGroupDrop); |
| 236 | + }); |
242 | 237 | }); |
243 | 238 | /* |
244 | 239 | context('Open Sites Editor', function () { |
|
0 commit comments