Updated fork/duplicate test (#4923)

* Updated test to handle version

* updated test

* added a small wait

* Assertion updated

* formatted code

* fork test updated

* dsl file added

* Updated test

* Try waiting in the addDsl step

* Other fixes

Co-authored-by: hetunandu <hetu@appsmith.com>
This commit is contained in:
NandanAnantharamu 2021-06-14 19:29:13 +05:30 committed by GitHub
parent a2e3496c8e
commit 861ab7ec81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 19 deletions

View File

@ -0,0 +1 @@
{"dsl":{"widgetName":"MainContainer","backgroundColor":"none","rightColumn":966,"snapColumns":64,"detachFromLayout":true,"widgetId":"0","topRow":0,"bottomRow":320,"containerStyle":"none","snapRows":125,"parentRowSpace":1,"type":"CANVAS_WIDGET","canExtend":true,"version":23,"minHeight":330,"parentColumnSpace":1,"dynamicBindingPathList":[],"leftColumn":0,"children":[{"isVisible":true,"inputType":"TEXT","label":"","widgetName":"Input1","version":1,"resetOnSubmit":true,"isRequired":false,"isDisabled":false,"type":"INPUT_WIDGET","isLoading":false,"parentColumnSpace":14.84375,"parentRowSpace":10,"leftColumn":23,"rightColumn":43,"topRow":8,"bottomRow":12,"parentId":"0","widgetId":"ihviqc47ev"}],"dynamicTriggerPathList":[]}}

View File

@ -1,22 +1,30 @@
const dsl = require("../../../../fixtures/displayWidgetDsl.json");
const dsl = require("../../../../fixtures/basicDsl.json");
const homePage = require("../../../../locators/HomePage.json");
const commonlocators = require("../../../../locators/commonlocators.json");
const explorerlocators = require("../../../../locators/explorerlocators.json");
const widgetsPage = require("../../../../locators/Widgets.json");
let duplicateApplicationDsl;
let parentApplicationDsl;
describe("Duplicate application", function() {
before(() => {
dsl.dsl.version = 23; // latest migrated version
cy.addDsl(dsl);
});
it("Check whether the duplicate application has the same dsl as the original", function() {
cy.get(commonlocators.homeIcon).click({ force: true });
const appname = localStorage.getItem("AppName");
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type("A");
cy.get(commonlocators.editPropCrossButton).click({ force: true });
cy.wait("@updateLayout").then((httpResponse) => {
parentApplicationDsl = httpResponse.response.body.data.dsl;
});
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.NavigateToHome();
cy.get(homePage.searchInput).type(appname);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.get(homePage.applicationCard)
.first()
.trigger("mouseover");
@ -24,17 +32,20 @@ describe("Duplicate application", function() {
.first()
.click({ force: true });
cy.get(homePage.duplicateApp).click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(4000);
cy.wait("@getPage").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.get("@getPage").then((httpResponse) => {
const data = httpResponse.response.body.data;
duplicateApplicationDsl = data.layouts[0].dsl;
expect(duplicateApplicationDsl).to.deep.equal(dsl.dsl);
duplicateApplicationDsl = httpResponse.response.body.data.layouts[0].dsl;
cy.log(JSON.stringify(duplicateApplicationDsl));
cy.log(JSON.stringify(parentApplicationDsl));
expect(JSON.stringify(duplicateApplicationDsl)).to.deep.equal(
JSON.stringify(parentApplicationDsl),
);
});
});
});

View File

@ -1,21 +1,30 @@
const dsl = require("../../../../fixtures/displayWidgetDsl.json");
const dsl = require("../../../../fixtures/basicDsl.json");
const homePage = require("../../../../locators/HomePage.json");
const commonlocators = require("../../../../locators/commonlocators.json");
const widgetsPage = require("../../../../locators/Widgets.json");
let forkedApplicationDsl;
let parentApplicationDsl;
describe("Fork application across orgs", function() {
before(() => {
dsl.dsl.version = 23; // latest migrated version
cy.addDsl(dsl);
});
it("Check if the forked application has the same dsl as the original", function() {
cy.get(commonlocators.homeIcon).click({ force: true });
const appname = localStorage.getItem("AppName");
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type("A");
cy.get(commonlocators.editPropCrossButton).click({ force: true });
cy.wait("@updateLayout").then((response) => {
parentApplicationDsl = response.response.body.data.dsl;
});
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.NavigateToHome();
cy.get(homePage.searchInput).type(appname);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
cy.get(homePage.applicationCard)
.first()
.trigger("mouseover");
@ -29,18 +38,20 @@ describe("Fork application across orgs", function() {
.last()
.click({ force: true });
cy.get(homePage.forkAppOrgButton).click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(4000);
cy.wait("@postForkAppOrg").then((httpResponse) => {
expect(httpResponse.status).to.equal(200);
});
cy.get("@getPage").then((httpResponse) => {
expect(httpResponse.status).to.deep.equal(200);
});
// check that forked application has same dsl
cy.get("@getPage").then((httpResponse) => {
const data = httpResponse.response.body.data;
forkedApplicationDsl = data.layouts[0].dsl;
expect(forkedApplicationDsl).to.deep.equal(dsl.dsl);
cy.log(JSON.stringify(forkedApplicationDsl));
cy.log(JSON.stringify(parentApplicationDsl));
expect(JSON.stringify(forkedApplicationDsl)).to.contain(
JSON.stringify(parentApplicationDsl),
);
});
cy.NavigateToHome();
});
});

View File

@ -1645,6 +1645,7 @@ Cypress.Commands.add("addDsl", (dsl) => {
});
});
});
cy.wait("@updateLayout");
});
Cypress.Commands.add("DeleteAppByApi", () => {