Skip to content

Commit 0bfda99

Browse files
arunattri26Arun Kumar Attri
andauthored
FORMS-17559: fix rule-editor test (#1492)
* FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: fix rule-editor test * FORMS-17559: updated rule-editor test * FORMS-17559: updated rule editor test * FORMS-17559: updated rule editor test * FORMS-17559: updated rule editor test * FORMS-17559: updated rule editor test * FORMS-17559: updated rule editor test * FORMS-17559: updated rule editor test --------- Co-authored-by: Arun Kumar Attri <[email protected]>
1 parent cae28ed commit 0bfda99

File tree

7 files changed

+134
-191
lines changed

7 files changed

+134
-191
lines changed

ui.tests/test-module/specs/customfunctions/checkbox.enum.enumName.cy.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,25 @@ describe('Test UpdateEnum, UpdateEnumName for Checkbox', () => {
4545
let enums = ["one", "two", "three"],
4646
enumNames = ["India", "US", "Singapore"];
4747

48+
let toggle_array = [];
49+
before(() => {
50+
cy.fetchFeatureToggles().then((response) => {
51+
if (response.status === 200) {
52+
toggle_array = response.body.enabled;
53+
}
54+
});
55+
});
56+
4857
/**
4958
* initialization of form container before every test
5059
* */
51-
beforeEach(() => {
60+
beforeEach(function() {
61+
if (!toggle_array.includes("FT_FORMS-11269") || !toggle_array.includes("FT_FORMS-11541")) {
62+
this.skip();
63+
}
5264
cy.previewForm(pagePath).then(p => {
5365
formContainer = p;
54-
})
66+
});
5567
});
5668

5769
describe('Checkbox with no options', () => {

ui.tests/test-module/specs/customfunctions/dropdown.enum.enumName.cy.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,25 @@ describe('Test UpdateEnum, UpdateEnumName for dropdown', () => {
5353
/**
5454
* initialization of form container before every test
5555
* */
56-
beforeEach(() => {
56+
let toggle_array = [];
57+
before(() => {
58+
cy.fetchFeatureToggles().then((response) => {
59+
if (response.status === 200) {
60+
toggle_array = response.body.enabled;
61+
}
62+
});
63+
});
64+
65+
/**
66+
* initialization of form container before every test
67+
* */
68+
beforeEach(function() {
69+
if (!toggle_array.includes("FT_FORMS-11269") || !toggle_array.includes("FT_FORMS-11541")) {
70+
this.skip();
71+
}
5772
cy.previewForm(pagePath).then(p => {
5873
formContainer = p;
59-
})
74+
});
6075
});
6176

6277
describe('Dropdown with no options', () => {

ui.tests/test-module/specs/customfunctions/radiobutton.enum.enumName.cy.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,25 @@ describe('Test UpdateEnum, UpdateEnumName for RadioButton', () => {
4848
/**
4949
* initialization of form container before every test
5050
* */
51-
beforeEach(() => {
51+
let toggle_array = [];
52+
before(() => {
53+
cy.fetchFeatureToggles().then((response) => {
54+
if (response.status === 200) {
55+
toggle_array = response.body.enabled;
56+
}
57+
});
58+
});
59+
60+
/**
61+
* initialization of form container before every test
62+
* */
63+
beforeEach(function() {
64+
if (!toggle_array.includes("FT_FORMS-11269") || !toggle_array.includes("FT_FORMS-11541")) {
65+
this.skip();
66+
}
5267
cy.previewForm(pagePath).then(p => {
5368
formContainer = p;
54-
})
69+
});
5570
});
5671

5772
describe('Radiobutton with no options', () => {

ui.tests/test-module/specs/ruleeditor/authoring/ruleEditor.authoring.cy.js

Lines changed: 34 additions & 152 deletions
Large diffs are not rendered by default.

ui.tests/test-module/specs/ruleeditor/runtime/customFunction.runtime.cy.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,24 @@ describe('Form with custom functions configured in client lib', () => {
2121
let formContainer = null;
2222
let toggle_array = [];
2323

24+
before(() => {
25+
cy.fetchFeatureToggles().then((response) => {
26+
if (response.status === 200) {
27+
toggle_array = response.body.enabled;
28+
}
29+
});
30+
});
31+
2432
/**
2533
* initialization of form container before every test
2634
* */
27-
beforeEach(() => {
35+
beforeEach(function() {
36+
if (!toggle_array.includes("FT_FORMS-11541")) {
37+
this.skip();
38+
}
2839
cy.previewForm(formPath).then(p => {
2940
formContainer = p;
3041
});
31-
cy.fetchFeatureToggles().then((response) => {
32-
if (response.status === 200) {
33-
toggle_array = response.body.enabled;
34-
}
35-
});
3642
});
3743

3844
it('should have custom function definition loaded in the window object', () => {

ui.tests/test-module/specs/ruleeditor/runtime/ruleEditorSanity.runtime.cy.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ describe('Rule editor runtime sanity for core-components',function(){
2121
});
2222

2323
it("should have merged custom function list registered in FunctionRuntime from both clientlibs", () => {
24-
expect(formContainer, "formcontainer is initialized").to.not.be.null;
25-
let func;
26-
cy.window().then(win => {
27-
func = win.FormView.FunctionRuntime.customFunctions.testFunction1; // from corecomponent.it.customfunction
28-
expect(func).to.not.be.null;
29-
expect(func).to.not.be.undefined;
30-
31-
func = win.FormView.FunctionRuntime.customFunctions.testSubmitFormPreprocessor; // from corecomponent.it.customfunction
32-
expect(func).to.not.be.null;
33-
expect(func).to.not.be.undefined;
34-
35-
func = win.FormView.FunctionRuntime.customFunctions.testSetProperty; // from corecomponent.it.customfunction2
36-
expect(func).to.not.be.null;
37-
expect(func).to.not.be.undefined;
38-
})
24+
if (toggle_array.includes("FT_FORMS-11269") && toggle_array.includes("FT_FORMS-11541")) {
25+
expect(formContainer, "formcontainer is initialized").to.not.be.null;
26+
let func;
27+
cy.window().then(win => {
28+
func = win.FormView.FunctionRuntime.customFunctions.testFunction1; // from corecomponent.it.customfunction
29+
expect(func).to.not.be.null;
30+
expect(func).to.not.be.undefined;
31+
32+
func = win.FormView.FunctionRuntime.customFunctions.testSubmitFormPreprocessor; // from corecomponent.it.customfunction
33+
expect(func).to.not.be.null;
34+
expect(func).to.not.be.undefined;
35+
36+
func = win.FormView.FunctionRuntime.customFunctions.testSetProperty; // from corecomponent.it.customfunction2
37+
expect(func).to.not.be.null;
38+
expect(func).to.not.be.undefined;
39+
})
40+
}
3941
})
4042

4143
if (cy.af.isLatestAddon()) {

ui.tests/test-module/specs/ruleeditor/runtime/uichange.runtime.cy.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
describe('Form with custom functions containing ui change action configured in client lib', () => {
2020
const formPath = "content/forms/af/core-components-it/samples/ruleeditor/uichange.html";
2121
let formContainer = null;
22+
let toggle_array = [];
23+
24+
before(() => {
25+
cy.fetchFeatureToggles().then((response) => {
26+
if (response.status === 200) {
27+
toggle_array = response.body.enabled;
28+
}
29+
});
30+
});
2231

2332
/**
2433
* initialization of form container before every test
@@ -30,18 +39,20 @@ describe('Form with custom functions containing ui change action configured in c
3039
});
3140

3241
it("ui change action should reset field model based on custom function", () => {
33-
// Rule on textBox1: set value of textBox1 to "test", which is output of custom function testFunction1()
34-
expect(formContainer, "formcontainer is initialized").to.not.be.null;
35-
const [numberInput1, fieldView1] = Object.entries(formContainer._fields)[0]
36-
const [numberInput7, fieldView2] = Object.entries(formContainer._fields)[6]
37-
const numberInput1Model = formContainer._model.getElement(numberInput1)
38-
const numberInput7Model = formContainer._model.getElement(numberInput7)
39-
numberInput1Model.value = 123;
40-
cy.get(`#${numberInput1}`).find("input").should('have.value',"123")
41-
// let's trigger ui change action by doing changes via the dom API's
42-
cy.get(`#${numberInput7}`).find("input").clear().type("93").blur().then(x => {
43-
cy.get(`#${numberInput1}`).find("input").should('have.value',"")
44-
})
42+
if (toggle_array.includes("FT_FORMS-11541")) {
43+
// Rule on textBox1: set value of textBox1 to "test", which is output of custom function testFunction1()
44+
expect(formContainer, "formcontainer is initialized").to.not.be.null;
45+
const [numberInput1, fieldView1] = Object.entries(formContainer._fields)[0]
46+
const [numberInput7, fieldView2] = Object.entries(formContainer._fields)[6]
47+
const numberInput1Model = formContainer._model.getElement(numberInput1)
48+
const numberInput7Model = formContainer._model.getElement(numberInput7)
49+
numberInput1Model.value = 123;
50+
cy.get(`#${numberInput1}`).find("input").should('have.value',"123")
51+
// let's trigger ui change action by doing changes via the dom API's
52+
cy.get(`#${numberInput7}`).find("input").clear().type("93").blur().then(x => {
53+
cy.get(`#${numberInput1}`).find("input").should('have.value',"")
54+
})
55+
}
4556
})
4657

4758

0 commit comments

Comments
 (0)