Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AppSidebarButton,
AppSidebar,
AppSidebar
} from "../../../../support/Pages/EditorNavigation";

const testdata = require("../../../../fixtures/testdata.json");
Expand All @@ -10,8 +10,9 @@ import {
agHelper,
apiPage,
dataSources,
entityItems,
entityItems
} from "../../../../support/Objects/ObjectsCore";
import apiLocators from "../../../../locators/apiLocators";

describe(
"API Panel Test Functionality",
Expand Down Expand Up @@ -39,12 +40,8 @@ describe(
agHelper.AssertAutoSave();
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.echoMethod,
testdata.Put,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});
cy.ResponseCheck("updatedAt");
});
Expand All @@ -63,12 +60,8 @@ describe(
agHelper.AssertAutoSave();
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.echoMethod,
testdata.Post,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});
cy.ResponseCheck("createdAt");
});
Expand All @@ -87,12 +80,8 @@ describe(
agHelper.AssertAutoSave();
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.echoMethod,
testdata.Patch,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});
cy.ResponseCheck("updatedAt");
});
Expand All @@ -111,12 +100,8 @@ describe(
agHelper.AssertAutoSave();
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.echoMethod,
testdata.Delete,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});
});

Expand All @@ -127,12 +112,8 @@ describe(
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.ResponseCheck(testdata.responsetext);
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.methods,
testdata.Get,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
Comment thread
sagar-qa007 marked this conversation as resolved.
Outdated

apiPage.SelectPaneTab("Pagination");
agHelper.GetNClick(apiwidget.paginationWithUrl);
Expand All @@ -144,12 +125,8 @@ describe(
cy.clickTest(apiwidget.TestNextUrl);
apiPage.ResponseStatusCheck("200 OK");
cy.ResponseCheck("Josh M Krantz");
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.next,
testdata.Get,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");

apiPage.SelectPaneTab("Pagination");
cy.enterUrl(
Expand All @@ -160,12 +137,8 @@ describe(
cy.clickTest(apiwidget.TestPreUrl);
apiPage.ResponseStatusCheck("200 OK");
cy.ResponseCheck(testdata.responsetext);
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.prev,
testdata.Get,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});

it("6. API check with query params test API feature", function () {
Expand All @@ -174,12 +147,8 @@ describe(
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200 OK");
cy.ResponseCheck(testdata.responsetext3);
cy.validateRequest(
"Executed successfully",
testdata.baseUrl,
testdata.queryAndValue,
testdata.Get,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
});

it("7. API check with Invalid Header", function () {
Expand All @@ -188,14 +157,9 @@ describe(
agHelper.AssertAutoSave();
apiPage.RunAPI(false);
apiPage.ResponseStatusCheck("5000");
cy.validateRequest(
"Execution failed",
testdata.baseUrl,
testdata.methods,
testdata.Get,
true,
);
agHelper.GetNClickByContains(apiLocators.apiResponseTabsList, "Logs");
agHelper.AssertContains("Executed successfully from user request");
cy.ResponseCheck("Invalid value for Content-Type");
});
},
);
);
1 change: 1 addition & 0 deletions app/client/cypress/locators/ApiEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ export default {
slashCommandButton: ".commands-button",
apiResponseObject: ".object-key",
apiDebuggerLink: ".debugger-entity-link",
apiResponseTabsList : ".ads-v2-tabs__list"
};
12 changes: 12 additions & 0 deletions app/client/cypress/support/Pages/AggregateHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,18 @@ export class AggregateHelper {
) as Cypress.Chainable<boolean>;
}

IsElementVisibleWithEq(selector: ElementType, eq: number = 0) {
Comment thread
sagar-qa007 marked this conversation as resolved.
return this.GetElement(selector)
.eq(eq)
.then(($element) => {
// Check if the element is present and visible
const isVisible =
Cypress.$($element).length > 0 && Cypress.$($element).is(":visible");
console.log(`Element visibility: ${isVisible}`);
return isVisible;
}) as Cypress.Chainable<boolean>;
}

public FailIfErrorToast(error: string) {
cy.get("body").then(($ele) => {
if ($ele.find(this.locator._toastMsg).length > 0) {
Expand Down