Skip to content

Commit

Permalink
test: updated ApiCommands (#33631)
Browse files Browse the repository at this point in the history
RCA: There are many unused commands within ApiCommands.js file

Solution:
Checked the ApiCommands in both CE and EE repository and we are removing
those commands which are not used in any tests as part of cleanup
activity

Equivalent EE PR: appsmithorg/appsmith-ee#4280


/ok-to-test tags="@tag.All"<!-- This is an auto-generated comment:
Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9184697515>
> Commit: f0a8dcf
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9184697515&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
  • Loading branch information
NandanAnantharamu committed May 28, 2024
1 parent a4aad2e commit ba23317
Showing 1 changed file with 0 additions and 167 deletions.
167 changes: 0 additions & 167 deletions app/client/cypress/support/ApiCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,6 @@ Cypress.Commands.add("CreateAPI", (apiname) => {
apiPage.CreateApi(apiname);
});

Cypress.Commands.add("CreateSubsequentAPI", (apiname) => {
cy.get(apiwidget.createApiOnSideBar).first().click({ force: true });
cy.get(apiwidget.resourceUrl).should("be.visible");
// cy.get(ApiEditor.nameOfApi)
cy.get(apiwidget.apiTxt).clear().type(apiname).should("have.value", apiname);
cy.WaitAutoSave();
});

Cypress.Commands.add("EditApiName", (apiname) => {
cy.get(apiwidget.ApiName).click({ force: true });
cy.get(apiwidget.apiTxt)
.clear()
.type(apiname, { force: true })
.should("have.value", apiname);
});

Cypress.Commands.add("EditApiNameFromExplorer", (apiname) => {
/*
cy.xpath(apiwidget.popover)
Expand All @@ -94,10 +78,6 @@ Cypress.Commands.add("RunAPI", () => {
cy.wait("@postExecute");
});

Cypress.Commands.add("RunAPIWithoutWaitingForResolution", () => {
cy.get(ApiEditor.ApiRunBtn).click({ force: true });
});

Cypress.Commands.add("SaveAndRunAPI", () => {
cy.WaitAutoSave();
cy.RunAPI();
Expand All @@ -118,81 +98,13 @@ Cypress.Commands.add(
},
);

Cypress.Commands.add(
"EnterSourceDetailsWithHeader",
(baseUrl, v1method, hKey, hValue) => {
cy.enterDatasourceAndPath(baseUrl, v1method);
cy.get(apiwidget.headerKey)
.first()
.click({ force: true })
.type(hKey, { parseSpecialCharSequences: true });
cy.get(apiwidget.headerValue)
.first()
.click({ force: true })
.type(hValue, { parseSpecialCharSequences: true });
cy.WaitAutoSave();
},
);

Cypress.Commands.add("EditSourceDetail", (baseUrl, v1method) => {
cy.EnableAllCodeEditors();
cy.get(apiwidget.editResourceUrl)
.first()
.click({ force: true })
.clear()
.type(`{backspace}${baseUrl}`);
cy.xpath(apiwidget.autoSuggest).first().click({ force: true });
cy.get(ApiEditor.ApiRunBtn).scrollIntoView();
cy.get(apiwidget.editResourceUrl)
.first()
.focus()
.type(v1method)
.should("have.value", v1method);
cy.WaitAutoSave();
});

Cypress.Commands.add("switchToAPIInputTab", () => {
cy.get(apiwidget.apiInputTab).first().click({ force: true });
});

Cypress.Commands.add("enterUrl", (baseUrl, url, value) => {
cy.get(url).first().type(baseUrl.concat(value), {
force: true,
parseSpecialCharSequences: false,
});
});

Cypress.Commands.add(
"EnterSourceDetailsWithQueryParam",
(baseUrl, v1method, hKey, hValue, qKey, qValue) => {
cy.enterDatasourceAndPath(baseUrl, v1method);
cy.get(apiwidget.headerKey)
.first()
.click({ force: true })
.type(hKey, { parseSpecialCharSequences: true });
cy.get(apiwidget.headerValue)
.first()
.click({ force: true })
.type(hValue, { parseSpecialCharSequences: true });
cy.get(apiwidget.queryKey)
.first()
.click({ force: true })
.type(qKey, { force: true })
.should("have.value", qKey);
cy.get(apiwidget.queryValue)
.first()
.click({ force: true })
.type(qValue, { force: true })
.should("have.value", qValue);
cy.WaitAutoSave();
},
);

Cypress.Commands.add("EnterSourceDetailsWithbody", (baseUrl, v1method) => {
cy.enterDatasourceAndPath(baseUrl, v1method);
cy.get(apiwidget.addHeader).first().click({ first: true });
});

Cypress.Commands.add("CreationOfUniqueAPIcheck", (apiname) => {
dataSources.NavigateToDSCreateNew();
agHelper.GetNClick(apiwidget.createapi);
Expand All @@ -213,50 +125,6 @@ Cypress.Commands.add("CreationOfUniqueAPIcheck", (apiname) => {
cy.get(apiwidget.apiTxt).blur();
});

Cypress.Commands.add("MoveAPIToHome", () => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.copyTo).click({ force: true });
cy.get(apiwidget.home).click({ force: true });
cy.wait("@createNewApi").should(
"have.nested.property",
"response.body.responseMeta.status",
201,
);
});

Cypress.Commands.add("MoveAPIToPage", (pageName) => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.moveTo).click({ force: true });
cy.get(apiwidget.page).contains(pageName).click({ force: true });
cy.wait("@moveAction").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});

Cypress.Commands.add("copyEntityToPage", (pageName) => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.copyTo).click({ force: true });
cy.get(apiwidget.page).contains(pageName).click({ force: true });
cy.wait("@createNewApi").should(
"have.nested.property",
"response.body.responseMeta.status",
201,
);
});

Cypress.Commands.add("CopyAPIToHome", () => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.copyTo).click({ force: true });
cy.get(apiwidget.home).click({ force: true });
cy.wait("@createNewApi").should(
"have.nested.property",
"response.body.responseMeta.status",
201,
);
});

Cypress.Commands.add("RenameEntity", (value, selectFirst) => {
if (selectFirst) {
cy.xpath(apiwidget.popover).first().click({ force: true });
Expand Down Expand Up @@ -291,30 +159,6 @@ Cypress.Commands.add("validateMessage", (value) => {
});
});

Cypress.Commands.add(
"VerifyPopOverMessage",
(msgAbsenceToVerify, presence = false) => {
// Give this element 3 seconds to appear
let shouldCondition = "not.exist";
if (presence) shouldCondition = "exist";
cy.xpath(
"//div[@class='bp3-popover-content'][contains(text(),'" +
msgAbsenceToVerify +
"')]",
{ timeout: 3000 },
).should(shouldCondition);
},
);

Cypress.Commands.add("DeleteAPIFromSideBar", () => {
cy.deleteEntity();
cy.wait("@deleteAction").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});

Cypress.Commands.add("DeleteWidgetFromSideBar", () => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.delete).click({ force: true });
Expand All @@ -325,17 +169,6 @@ Cypress.Commands.add("DeleteWidgetFromSideBar", () => {
);
});

Cypress.Commands.add("deleteEntity", () => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.delete).click({ force: true });
cy.get(apiwidget.deleteConfirm).click({ force: true });
});

Cypress.Commands.add("deleteEntityWithoutConfirmation", () => {
cy.xpath(apiwidget.popover).last().click({ force: true });
cy.get(apiwidget.delete).click({ force: true });
});

Cypress.Commands.add("DeleteAPI", () => {
cy.get(ApiEditor.ApiActionMenu).click({ multiple: true });
cy.get(apiwidget.deleteAPI).first().click({ force: true });
Expand Down

0 comments on commit ba23317

Please sign in to comment.