fix: Get default value from entityTree instead of configTree (#22682)
## Description Meta Rehydration got regressed due to Datatree splitting (https://github.com/appsmithorg/appsmith/pull/21547). Default value was getting accessed from configTree instead of entityTree. Fixes #22534 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Co-authored-by: Tolulope <adetulatolu@gmail.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
This commit is contained in:
parent
f87ba6a671
commit
d665511c8d
|
|
@ -1,8 +1,7 @@
|
||||||
const dsl = require("../../../../../fixtures/Listv2/MetaHydrationDSL.json");
|
const dsl = require("../../../../../fixtures/Listv2/MetaHydrationDSL.json");
|
||||||
const commonlocators = require("../../../../../locators/commonlocators.json");
|
const commonlocators = require("../../../../../locators/commonlocators.json");
|
||||||
const datasource = require("../../../../../locators/DatasourcesEditor.json");
|
|
||||||
const queryLocators = require("../../../../../locators/QueryEditor.json");
|
|
||||||
const publishPage = require("../../../../../locators/publishWidgetspage.json");
|
const publishPage = require("../../../../../locators/publishWidgetspage.json");
|
||||||
|
import * as _ from "../../../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
import { ObjectsRegistry } from "../../../../../support/Objects/Registry";
|
import { ObjectsRegistry } from "../../../../../support/Objects/Registry";
|
||||||
|
|
||||||
|
|
@ -74,25 +73,7 @@ function testJsontextClear(endp) {
|
||||||
.type(`{${modifierKey}}{del}`, { force: true });
|
.type(`{${modifierKey}}{del}`, { force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyMultiDropdownValuesCount(count, page = 1) {
|
describe("List widget v2 - meta hydration tests", () => {
|
||||||
cy.get(".rc-select-selection-overflow").then(($ele) => {
|
|
||||||
if (
|
|
||||||
$ele.find(".rc-select-selection-overflow-item .remove-icon").length ==
|
|
||||||
count
|
|
||||||
) {
|
|
||||||
cy.reload();
|
|
||||||
if (page == 2) {
|
|
||||||
// Go to next page
|
|
||||||
cy.get(commonlocators.listPaginateNextButton).click({
|
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skipping this test due to regression, issue id to track this regression https://github.com/appsmithorg/appsmith/issues/22534
|
|
||||||
describe.skip("List widget v2 - meta hydration tests", () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
agHelper.AddDsl(dsl);
|
agHelper.AddDsl(dsl);
|
||||||
});
|
});
|
||||||
|
|
@ -105,51 +86,12 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("1. setup serverside data", () => {
|
it("1. setup serverside data", () => {
|
||||||
cy.wait(1000);
|
cy.createAndFillApi(
|
||||||
cy.NavigateToDatasourceEditor();
|
"http://host.docker.internal:5001/v1/mock-api?records=20&page={{List1.pageNo}}&size={{List1.pageSize}}",
|
||||||
|
"",
|
||||||
// // Click on sample(mock) user database.
|
|
||||||
// cy.get(datasource.mockUserDatabase).click();
|
|
||||||
|
|
||||||
// Choose the first data source which consists of users keyword & Click on the "New Query +"" button
|
|
||||||
// Choose the first data source which consists of users keyword & Click on the "New Query +"" button
|
|
||||||
cy.get(`${datasource.datasourceCard}`)
|
|
||||||
.filter(":contains('Users')")
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(`${datasource.createQuery}`).click({ force: true });
|
|
||||||
});
|
|
||||||
// Click the editing field
|
|
||||||
cy.get(".t--action-name-edit-field").click({ force: true });
|
|
||||||
|
|
||||||
// Click the editing field
|
|
||||||
cy.get(queryLocators.queryNameField).type("Query1");
|
|
||||||
|
|
||||||
// switching off Use Prepared Statement toggle
|
|
||||||
cy.get(queryLocators.switch).last().click({ force: true });
|
|
||||||
|
|
||||||
//.1: Click on Write query area
|
|
||||||
cy.get(queryLocators.templateMenu).click();
|
|
||||||
cy.get(queryLocators.query).click({
|
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
// writing query to get the schema
|
|
||||||
cy.get(".CodeMirror textarea")
|
|
||||||
.first()
|
|
||||||
.focus()
|
|
||||||
.type(
|
|
||||||
"SELECT * FROM users OFFSET {{List1.pageNo * List1.pageSize}} LIMIT {{List1.pageSize}};",
|
|
||||||
{
|
|
||||||
force: true,
|
|
||||||
parseSpecialCharSequences: false,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
cy.WaitAutoSave();
|
cy.RunAPI();
|
||||||
|
cy.SearchEntityandOpen("List1");
|
||||||
cy.runQuery();
|
|
||||||
|
|
||||||
cy.get('.t--entity-name:contains("Page1")').click({ force: true });
|
|
||||||
|
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
|
|
@ -157,18 +99,17 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
|
|
||||||
testJsontextClear("items");
|
testJsontextClear("items");
|
||||||
|
|
||||||
cy.testJsontext("items", "{{Query1.data}}");
|
cy.testJsontext("items", "{{Api1.data}}");
|
||||||
|
|
||||||
cy.togglebar(commonlocators.serverSidePaginationCheckbox);
|
cy.togglebar(commonlocators.serverSidePaginationCheckbox);
|
||||||
|
|
||||||
cy.get(toggleJSButton("onpagechange")).click({ force: true });
|
cy.get(toggleJSButton("onpagechange")).click({ force: true });
|
||||||
cy.testJsontext("onpagechange", "{{Query1.run()}}");
|
cy.testJsontext("onpagechange", "{{Api1.run()}}");
|
||||||
|
|
||||||
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`).should(
|
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`).should(
|
||||||
"have.length",
|
"have.length",
|
||||||
3,
|
3,
|
||||||
);
|
);
|
||||||
verifyMultiDropdownValuesCount(6);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("2. using server side data", () => {
|
it("2. using server side data", () => {
|
||||||
|
|
@ -215,7 +156,6 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
verifyMultiDropdownValuesCount(6, 2);
|
|
||||||
// SecondPage
|
// SecondPage
|
||||||
// First Row
|
// First Row
|
||||||
cy.get(`${widgetSelector("List1")}`).scrollIntoView();
|
cy.get(`${widgetSelector("List1")}`).scrollIntoView();
|
||||||
|
|
@ -251,15 +191,15 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
.should("have.length", 3),
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
|
|
||||||
.eq(0)
|
|
||||||
.within(() => {
|
|
||||||
cy.waitUntil(() =>
|
cy.waitUntil(() =>
|
||||||
cy
|
cy
|
||||||
.get(".rc-select-selection-overflow-item .remove-icon")
|
.get(
|
||||||
.should("exist"),
|
`${widgetSelector(
|
||||||
|
"List1",
|
||||||
|
)} ${containerWidgetSelector} .rc-select-selection-overflow-item .remove-icon`,
|
||||||
|
)
|
||||||
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
cy.waitUntil(
|
cy.waitUntil(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -311,15 +251,15 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
.should("have.length", 3),
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
|
|
||||||
.eq(0)
|
|
||||||
.within(() => {
|
|
||||||
cy.waitUntil(() =>
|
cy.waitUntil(() =>
|
||||||
cy
|
cy
|
||||||
.get(".rc-select-selection-overflow-item .remove-icon")
|
.get(
|
||||||
.should("exist"),
|
`${widgetSelector(
|
||||||
|
"List1",
|
||||||
|
)} ${containerWidgetSelector} .rc-select-selection-overflow-item .remove-icon`,
|
||||||
|
)
|
||||||
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
cy.waitUntil(
|
cy.waitUntil(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -436,15 +376,15 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
.should("have.length", 3),
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
|
|
||||||
.eq(0)
|
|
||||||
.within(() => {
|
|
||||||
cy.waitUntil(() =>
|
cy.waitUntil(() =>
|
||||||
cy
|
cy
|
||||||
.get(".rc-select-selection-overflow-item .remove-icon")
|
.get(
|
||||||
.should("exist"),
|
`${widgetSelector(
|
||||||
|
"List1",
|
||||||
|
)} ${containerWidgetSelector} .rc-select-selection-overflow-item .remove-icon`,
|
||||||
|
)
|
||||||
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
cy.waitUntil(
|
cy.waitUntil(
|
||||||
() =>
|
() =>
|
||||||
|
|
@ -496,15 +436,15 @@ describe.skip("List widget v2 - meta hydration tests", () => {
|
||||||
.should("have.length", 3),
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get(`${widgetSelector("List1")} ${containerWidgetSelector}`)
|
|
||||||
.eq(0)
|
|
||||||
.within(() => {
|
|
||||||
cy.waitUntil(() =>
|
cy.waitUntil(() =>
|
||||||
cy
|
cy
|
||||||
.get(".rc-select-selection-overflow-item .remove-icon")
|
.get(
|
||||||
.should("exist"),
|
`${widgetSelector(
|
||||||
|
"List1",
|
||||||
|
)} ${containerWidgetSelector} .rc-select-selection-overflow-item .remove-icon`,
|
||||||
|
)
|
||||||
|
.should("have.length", 3),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
cy.waitUntil(
|
cy.waitUntil(
|
||||||
() =>
|
() =>
|
||||||
|
|
|
||||||
|
|
@ -838,7 +838,7 @@ export const overrideWidgetProperties = (params: {
|
||||||
const propertyOverridingKeyMap =
|
const propertyOverridingKeyMap =
|
||||||
configEntity.propertyOverrideDependency[propertyPath];
|
configEntity.propertyOverrideDependency[propertyPath];
|
||||||
if (propertyOverridingKeyMap.DEFAULT) {
|
if (propertyOverridingKeyMap.DEFAULT) {
|
||||||
const defaultValue = configEntity[propertyOverridingKeyMap.DEFAULT];
|
const defaultValue = entity[propertyOverridingKeyMap.DEFAULT];
|
||||||
const clonedDefaultValue = klona(defaultValue);
|
const clonedDefaultValue = klona(defaultValue);
|
||||||
if (defaultValue !== undefined) {
|
if (defaultValue !== undefined) {
|
||||||
const propertyPathArray = propertyPath.split(".");
|
const propertyPathArray = propertyPath.split(".");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user