test: Appsmith upgrade tests (#20294)
## Description - Added test for appsmith upgrade ## Type of change - Cypress ## How Has This Been Tested? - Cypress ## Checklist: ### 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
This commit is contained in:
parent
b32abd7792
commit
d51b12719c
|
|
@ -165,5 +165,5 @@
|
|||
"fileBindingValue": "{{FilePicker1.isDirty}}",
|
||||
"UPGRADEUSERNAME": "arslan+upgrade160@appsmith.com",
|
||||
"UPGRADEPASSWORD": "Test@123",
|
||||
"APPURL": "/applications/62e2e63c11fae56b4ef05150/pages/62e2e63c11fae56b4ef05152"
|
||||
"APPURL": "http://localhost:8081/app/app1/page1-63d38854252ca15b7ec9fabb"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
/* eslint-disable no-console */
|
||||
const testdata = require("../../../fixtures/testdata.json");
|
||||
import { ObjectsRegistry } from "../../../support/Objects/Registry";
|
||||
|
||||
let agHelper = ObjectsRegistry.AggregateHelper;
|
||||
const tedUrl = "http://localhost:5001/v1/parent/cmd";
|
||||
|
||||
describe("Upgrade appsmith version", () => {
|
||||
it("Upgrade Appsmith version and verify the Applications", () => {
|
||||
const uuid = () => Cypress._.random(0, 10000);
|
||||
const name = uuid();
|
||||
agHelper.Sleep(2000);
|
||||
|
||||
cy.GetPath(tedUrl, "appsmith").then((path) => {
|
||||
path = path.split(" ");
|
||||
path = path[1].split(" ");
|
||||
path = path[0].slice(0, -7);
|
||||
|
||||
localStorage.setItem("ContainerName", `appsmith-${name}`);
|
||||
|
||||
//Start CE Container with old stack
|
||||
cy.StartCEContainer(
|
||||
tedUrl,
|
||||
path + "/oldstack/tempStacks/oldstacks",
|
||||
"cicontainer",
|
||||
`appsmith-${name}`,
|
||||
);
|
||||
//Wait for the container to be up
|
||||
agHelper.Sleep(60000);
|
||||
|
||||
// Get and verify the logs
|
||||
cy.GetAndVerifyLogs(tedUrl, `appsmith-${name}`);
|
||||
});
|
||||
|
||||
//verify the Applications after upgrade
|
||||
cy.forceVisit(testdata.APPURL);
|
||||
agHelper.GetNClick(".t--widget-iconbuttonwidget button", 0, true);
|
||||
agHelper.Sleep(1000);
|
||||
agHelper.GetNAssertElementText(
|
||||
".tbody>div",
|
||||
"1Developmentexpertise",
|
||||
"have.text",
|
||||
1,
|
||||
);
|
||||
|
||||
agHelper.GetNClick(".tbody>div", 1, true, 1000);
|
||||
agHelper.GetNAssertElementText(
|
||||
".t--jsonformfield-label input",
|
||||
"Development",
|
||||
"have.value",
|
||||
);
|
||||
agHelper.GetNAssertElementText(
|
||||
".t--jsonformfield-type input",
|
||||
"expertise",
|
||||
"have.value",
|
||||
);
|
||||
agHelper.GetNAssertElementText(
|
||||
".t--jsonformfield-rowIndex input",
|
||||
"1",
|
||||
"have.value",
|
||||
);
|
||||
|
||||
cy.get(".t--jsonformfield-label input")
|
||||
.clear()
|
||||
.type("DevelopmentUpdate");
|
||||
agHelper.GetNClick(".t--jsonform-footer button", 1, true);
|
||||
agHelper.Sleep(2000);
|
||||
agHelper.GetNClick(".t--widget-iconbuttonwidget button", 0, true, 1000);
|
||||
agHelper.GetNAssertElementText(
|
||||
".tbody>div",
|
||||
"1DevelopmentUpdateexpertise",
|
||||
"have.text",
|
||||
1,
|
||||
);
|
||||
|
||||
//Resetting the data
|
||||
agHelper.GetNClick(".tbody>div", 1, true, 1000);
|
||||
cy.get(".t--jsonformfield-label input")
|
||||
.clear()
|
||||
.type("Development");
|
||||
agHelper.GetNClick(".t--jsonform-footer button", 1, true);
|
||||
agHelper.Sleep(2000);
|
||||
agHelper.GetNClick(".t--widget-iconbuttonwidget button", 0, true, 1000);
|
||||
agHelper.GetNAssertElementText(
|
||||
".tbody>div",
|
||||
"1Developmentexpertise",
|
||||
"have.text",
|
||||
1,
|
||||
);
|
||||
|
||||
// stop the container
|
||||
cy.StopContainer(tedUrl, localStorage.getItem("ContainerName"));
|
||||
agHelper.Sleep(2000);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
const publishPage = require("../../../locators/publishWidgetspage.json");
|
||||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
const testUrl = "http://localhost:5001/v1/parent/cmd";
|
||||
describe.skip("Upgrade appsmith version", () => {
|
||||
it.skip("Upgrade Appsmith version and verify the Applications", () => {
|
||||
const uuid = () => Cypress._.random(0, 10000);
|
||||
const name = uuid();
|
||||
cy.wait(2000);
|
||||
|
||||
cy.GetCWD(testUrl);
|
||||
|
||||
cy.log("Stop the container");
|
||||
cy.StopTheContainer(testUrl, "appsmith"); // stop the old container
|
||||
cy.wait(2000);
|
||||
|
||||
cy.GetCWD(testUrl);
|
||||
|
||||
cy.log("Get path");
|
||||
cy.GetPath(testUrl, "appsmith").then((path) => {
|
||||
cy.log(path);
|
||||
path = path.split(" ");
|
||||
path = path[1].split(" ");
|
||||
path = path[0].slice(0, -7);
|
||||
cy.log(path);
|
||||
|
||||
localStorage.setItem("ContainerName", `appsmith-160_${name}_updated`);
|
||||
|
||||
cy.log("Start old stack container");
|
||||
cy.CreateAContainer(
|
||||
testUrl,
|
||||
path + "/oldstack",
|
||||
"fatcontainer",
|
||||
`appsmith-160_${name}_updated`,
|
||||
);
|
||||
cy.wait(45000);
|
||||
|
||||
cy.log("Verify Logs");
|
||||
cy.GetAndVerifyLogs(testUrl, `appsmith-160_${name}_updated`); // Get and verify the logs
|
||||
});
|
||||
|
||||
//verify the Applications after upgrade
|
||||
cy.LoginFromAPI(testdata.UPGRADEUSERNAME, testdata.UPGRADEPASSWORD);
|
||||
cy.visit(testdata.APPURL);
|
||||
|
||||
cy.get(".t--buttongroup-widget").should("exist");
|
||||
cy.get(".t--buttongroup-widget")
|
||||
.children()
|
||||
.should("have.length", 3);
|
||||
|
||||
cy.get(publishPage.backToEditor).click({ force: true });
|
||||
|
||||
cy.get(".t--buttongroup-widget").should("exist");
|
||||
cy.get(".t--buttongroup-widget")
|
||||
.children()
|
||||
.should("have.length", 3);
|
||||
|
||||
cy.log("Stop the container");
|
||||
cy.StopTheContainer(testUrl, localStorage.getItem("ContainerName")); // stop the old container
|
||||
cy.wait(2000);
|
||||
});
|
||||
|
||||
it.skip("Upgrade Appsmith from CE to EE and verify the Applications", () => {
|
||||
cy.log("Stop the appsmith container");
|
||||
cy.StopTheContainer(testUrl, "appsmith"); // stop the old container
|
||||
cy.wait(2000);
|
||||
|
||||
const uuid = () => Cypress._.random(0, 10000);
|
||||
const name = uuid();
|
||||
cy.wait(2000);
|
||||
|
||||
cy.log("Get path");
|
||||
cy.GetPath(testUrl, "appsmith").then((path) => {
|
||||
path = path.split(" ");
|
||||
path = path[1].split(" ");
|
||||
path = path[0].slice(0, -7);
|
||||
cy.log(path);
|
||||
|
||||
localStorage.setItem(
|
||||
"ContainerName",
|
||||
`appsmith-160-ce-${name}-enterprise`,
|
||||
);
|
||||
|
||||
cy.log("Start old stack container");
|
||||
cy.CreateEEContainer(
|
||||
testUrl,
|
||||
path + "/oldstack",
|
||||
"fatcontainer",
|
||||
`appsmith-160-ce-${name}-enterprise`,
|
||||
);
|
||||
cy.wait(45000);
|
||||
|
||||
cy.log("Verify Logs");
|
||||
cy.GetAndVerifyLogs(testUrl, `appsmith-160-ce-${name}-enterprise`); // Get and verify the logs
|
||||
});
|
||||
|
||||
//verify the Applications after upgrade
|
||||
cy.LoginFromAPI(testdata.UPGRADEUSERNAME, testdata.UPGRADEPASSWORD);
|
||||
cy.visit(testdata.APPURL);
|
||||
|
||||
cy.get(".t--buttongroup-widget").should("exist");
|
||||
cy.get(".t--buttongroup-widget")
|
||||
.children()
|
||||
.should("have.length", 3);
|
||||
|
||||
cy.get(publishPage.backToEditor).click({ force: true });
|
||||
|
||||
cy.get(".t--buttongroup-widget").should("exist");
|
||||
cy.get(".t--buttongroup-widget")
|
||||
.children()
|
||||
.should("have.length", 3);
|
||||
});
|
||||
});
|
||||
|
|
@ -1792,7 +1792,7 @@ Cypress.Commands.add("restoreLocalStorageCache", () => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("StopTheContainer", (path, containerName) => {
|
||||
Cypress.Commands.add("StopContainer", (path, containerName) => {
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: path,
|
||||
|
|
@ -1800,8 +1800,7 @@ Cypress.Commands.add("StopTheContainer", (path, containerName) => {
|
|||
cmd: "docker stop " + containerName,
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log(res.body.stderr);
|
||||
cy.log(res.body.stdout);
|
||||
cy.log(res.body.stdout, res.body.stderr);
|
||||
expect(res.status).equal(200);
|
||||
});
|
||||
});
|
||||
|
|
@ -1818,31 +1817,28 @@ Cypress.Commands.add("StopAllContainer", (path) => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("StartTheContainer", (path, containerName) => {
|
||||
Cypress.Commands.add("StartContainer", (path, containerName) => {
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: path,
|
||||
qs: {
|
||||
cmd: "docker start " + containerName,
|
||||
cmd: "docker restart " + containerName,
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log(res.body.stderr);
|
||||
cy.log(res.body.stdout);
|
||||
cy.log(res.body.stdout, res.body.stderr);
|
||||
expect(res.status).equal(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"CreateAContainer",
|
||||
"StartCEContainer",
|
||||
(url, path, version, containerName) => {
|
||||
let comm =
|
||||
"cd " +
|
||||
path +
|
||||
";docker run -d --name " +
|
||||
"docker run -d --name " +
|
||||
containerName +
|
||||
' -p 80:80 -p 9001:9001 -v "' +
|
||||
' -p 8081:80 -p 9002:9002 -v "' +
|
||||
path +
|
||||
'/stacks:/appsmith-stacks" appsmith/appsmith-ce:' +
|
||||
'/stacks:/appsmith-stacks" ' +
|
||||
version;
|
||||
|
||||
cy.log(comm);
|
||||
|
|
@ -1853,24 +1849,22 @@ Cypress.Commands.add(
|
|||
cmd: comm,
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log("ContainerID", res.body.stdout);
|
||||
cy.log(res.body.stderr);
|
||||
cy.log(res.body.stdout);
|
||||
expect(res.status).equal(200);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Cypress.Commands.add(
|
||||
"CreateEEContainer",
|
||||
"StartEEContainer",
|
||||
(url, path, version, containerName) => {
|
||||
let comm =
|
||||
"cd " +
|
||||
path +
|
||||
";docker run -d --name " +
|
||||
"docker run -d --name " +
|
||||
containerName +
|
||||
' -p 80:80 -p 9001:9001 -v "' +
|
||||
' -p 8081:80 -p 9002:9002 -v "' +
|
||||
path +
|
||||
'/stacks:/appsmith-stacks" appsmith/appsmith-ee:' +
|
||||
'/stacks:/appsmith-stacks" ' +
|
||||
version;
|
||||
|
||||
cy.log(comm);
|
||||
|
|
@ -1881,8 +1875,7 @@ Cypress.Commands.add(
|
|||
cmd: comm,
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log(res.body.stderr);
|
||||
cy.log(res.body.stdout);
|
||||
cy.log(res.body.stdout, res.body.stderr);
|
||||
expect(res.status).equal(200);
|
||||
});
|
||||
},
|
||||
|
|
@ -1924,10 +1917,8 @@ Cypress.Commands.add("GetAndVerifyLogs", (path, containerName) => {
|
|||
cmd: "docker logs " + containerName + " 2>&1 | grep 'APPLIED'",
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log(res.body.stderr);
|
||||
cy.log(res.body.stdout);
|
||||
expect(res.status).equal(200);
|
||||
// expect(res.body.stdout).not.equal("");
|
||||
//expect(res.body.stdout).not.equal("");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1986,3 +1977,22 @@ Cypress.Commands.add("LogintoAppTestUser", (uname, pword) => {
|
|||
cy.wait(3000);
|
||||
initLocalstorage();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("execute", (url, command) => {
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: url,
|
||||
qs: {
|
||||
cmd: command,
|
||||
},
|
||||
}).then((res) => {
|
||||
cy.log(res.body.stdout, res.body.error);
|
||||
expect(res.status).equal(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("forceVisit", (url) => {
|
||||
cy.window().then((win) => {
|
||||
return win.open(url, "_self");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ after(function() {
|
|||
//-- LogOut Application---//
|
||||
cy.LogOut();
|
||||
|
||||
//Commenting until Upgrade Appsmith cases are fixed
|
||||
// const testUrl = "http://localhost:5001/v1/parent/cmd";
|
||||
// Commenting until Upgrade Appsmith cases are fixed
|
||||
// const tedUrl = "http://localhost:5001/v1/parent/cmd";
|
||||
// cy.log("Start the appsmith container");
|
||||
// cy.StartTheContainer(testUrl, "appsmith"); // stop the old container
|
||||
// cy.StartContainer(tedUrl, "appsmith"); // start the old container
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user